From 53ea6e6386e1749f2e2d6f7c06cd44f76ebcea9e Mon Sep 17 00:00:00 2001 From: Kim Ravn Hansen Date: Mon, 13 Oct 2025 11:31:28 +0200 Subject: [PATCH] Misc bookkeeping and documentation --- utils/dice.js | 0 utils/id.js | 0 utils/random.js | 0 utils/regex.js | 0 utils/tileOptionsParser.js | 18 +++++++++++++++++- 5 files changed, 17 insertions(+), 1 deletion(-) mode change 100644 => 100755 utils/dice.js mode change 100644 => 100755 utils/id.js mode change 100644 => 100755 utils/random.js mode change 100644 => 100755 utils/regex.js 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 *