File size: 431 Bytes
bc20498
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
30
31
32
33
34
/* global Map */

class ObjectMap {
  constructor(){
    this._obj = {};
  }

  set( key, val ){
    this._obj[ key ] = val;

    return this;
  }

  delete( key ){
    this._obj[ key ] = undefined;

    return this;
  }

  clear(){
    this._obj = {};
  }

  has( key ){
    return this._obj[ key ] !== undefined;
  }

  get( key ){
    return this._obj[ key ];
  }
}

export default typeof Map !== 'undefined' ? Map : ObjectMap;