Code coverage report for src/util/FastMap.ts

Statements: 100% (19 / 19)      Branches: 100% (4 / 4)      Functions: 100% (6 / 6)      Lines: 100% (18 / 18)      Ignored: none     

All files » src/util/ » FastMap.ts
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 302 36   1 137 137     1 112 112     1 260     1 25 25 81 66         1 1   1
export class FastMap {
  private values: Object = {};
 
  delete(key: string): boolean {
    this.values[key] = null;
    return true;
  }
 
  set(key: string, value: any): FastMap {
    this.values[key] = value;
    return this;
  }
 
  get(key: string): any {
    return this.values[key];
  }
 
  forEach(cb: (value: any, key: any) => void, thisArg?: any): void {
    const values = this.values;
    for (let key in values) {
      if (values.hasOwnProperty(key) && values[key] !== null) {
        cb.call(thisArg, values[key], key);
      }
    }
  }
 
  clear(): void {
    this.values = {};
  }
}