UNPKG

431 BJavaScriptView Raw
1/* global Map */
2
3class ObjectMap {
4 constructor(){
5 this._obj = {};
6 }
7
8 set( key, val ){
9 this._obj[ key ] = val;
10
11 return this;
12 }
13
14 delete( key ){
15 this._obj[ key ] = undefined;
16
17 return this;
18 }
19
20 clear(){
21 this._obj = {};
22 }
23
24 has( key ){
25 return this._obj[ key ] !== undefined;
26 }
27
28 get( key ){
29 return this._obj[ key ];
30 }
31}
32
33export default typeof Map !== 'undefined' ? Map : ObjectMap;