spreadsheet
typeScript/javascript spreadsheet parser, with formulas.
git clone https://git.vogt.world/spreadsheet.git
Log | Files | README.md
← All files
name: src/Utilities/ObjectBuilder.ts
-rw-r--r--
489
 1/**
 2 * Utility class to help build objects programmatically. Basically this allows me to have source code where constants
 3 * are keys in objects.
 4 */
 5class ObjectBuilder {
 6  public o : Object = {};
 7
 8  public static add(k, v) : ObjectBuilder {
 9    let m = new ObjectBuilder();
10    m.o[k.toString()] = v;
11    return m;
12  }
13  public add(k, v) : ObjectBuilder {
14    this.o[k.toString()] = v;
15    return this;
16  }
17  public build() : Object {
18    return this.o;
19  }
20}
21
22export {
23  ObjectBuilder
24}