diff --git a/src/node/apiUtils.mjs b/src/node/apiUtils.mjs index 18f4e5d9..4ee8a2c0 100644 --- a/src/node/apiUtils.mjs +++ b/src/node/apiUtils.mjs @@ -56,6 +56,9 @@ function transformArgs(originalArgs, newArgs) { if (["toggleString"].indexOf(argument.type) > -1) { argument.string = newArgs[key].string; argument.option = newArgs[key].option; + } else if (argument.type === "editableOption") { + // takes key: "option", key: {name, val: "string"}, key: {name, val: [...]} + argument.value = typeof newArgs[key] === "string" ? newArgs[key]: newArgs[key].value; } else { argument.value = newArgs[key]; } diff --git a/test/tests/nodeApi/ops.mjs b/test/tests/nodeApi/ops.mjs index 80ed87b3..553cbb5b 100644 --- a/test/tests/nodeApi/ops.mjs +++ b/test/tests/nodeApi/ops.mjs @@ -27,6 +27,7 @@ import { bitShiftRight, cartesianProduct, CSSMinify, + toBase64, } from "../../../src/node/index"; import TestRegister from "../../TestRegister"; @@ -115,6 +116,22 @@ color: white; preserveComments: true, }); assert.strictEqual(result.toString(), "header {// comment width: 100%;color: white;}"); + }), + + it("toBase64: editableOption", () => { + const result = toBase64("some input", { + alphabet: { + value: "0-9A-W" + }, + }); + assert.strictEqual(result.toString(), "SPI1R1T0"); + }), + + it("toBase64: editableOptions key is value", () => { + const result = toBase64("some input", { + alphabet: "0-9A-W", + }); + assert.strictEqual(result.toString(), "SPI1R1T0"); })