Misc bookkeeping and documentation
This commit is contained in:
0
utils/dice.js
Normal file → Executable file
0
utils/dice.js
Normal file → Executable file
0
utils/id.js
Normal file → Executable file
0
utils/id.js
Normal file → Executable file
0
utils/random.js
Normal file → Executable file
0
utils/random.js
Normal file → Executable file
0
utils/regex.js
Normal file → Executable file
0
utils/regex.js
Normal file → Executable file
@@ -1,6 +1,6 @@
|
|||||||
/** A call represents the name of a function as well as the arguments passed to it */
|
/** A call represents the name of a function as well as the arguments passed to it */
|
||||||
export class TileOptions {
|
export class TileOptions {
|
||||||
/** @type {string} Name of the function */ name;
|
/** @type {string} Name of the function */ name;
|
||||||
/** @type {TileArgs[]} Args passed to function */ args;
|
/** @type {TileArgs[]} Args passed to function */ args;
|
||||||
|
|
||||||
constructor(name, args) {
|
constructor(name, args) {
|
||||||
@@ -8,6 +8,22 @@ export class TileOptions {
|
|||||||
this.args = args;
|
this.args = args;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {string} name
|
||||||
|
* @param {Record<string,any>} 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
|
* Find an arg by name, but fall back to an index position
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user