diff --git a/utils/dice.js b/utils/dice.js old mode 100644 new mode 100755 diff --git a/utils/id.js b/utils/id.js old mode 100644 new mode 100755 diff --git a/utils/random.js b/utils/random.js old mode 100644 new mode 100755 diff --git a/utils/regex.js b/utils/regex.js old mode 100644 new mode 100755 diff --git a/utils/tileOptionsParser.js b/utils/tileOptionsParser.js index 8f0e6eb..3c86de0 100755 --- a/utils/tileOptionsParser.js +++ b/utils/tileOptionsParser.js @@ -1,6 +1,6 @@ /** A call represents the name of a function as well as the arguments passed to it */ export class TileOptions { - /** @type {string} Name of the function */ name; + /** @type {string} Name of the function */ name; /** @type {TileArgs[]} Args passed to function */ args; constructor(name, args) { @@ -8,6 +8,22 @@ export class TileOptions { this.args = args; } + /** + * @param {string} name + * @param {Record} args + */ + static fromObject(name, args) { + // + const result = new TileOptions(name, []); + + for (const [k, v] of Object.entries(args)) { + const arg = new TileArgs(k, v); + result.args.push(arg); + } + + return result; + } + /** * Find an arg by name, but fall back to an index position *