1
0
Fork 0
freesewing/packages/core/src/store.js

21 lines
436 B
JavaScript
Raw Normal View History

function Store() {
2018-08-05 16:32:38 +02:00
this.data = new Map();
}
/** Sets a value under index key */
Store.prototype.set = function(key, value) {
2018-08-05 16:32:38 +02:00
this.data.set(key, value);
};
/** Sets a value under index key */
Store.prototype.setIfUnset = function(key, value) {
2018-08-05 16:32:38 +02:00
if (!this.data.has(key)) this.data.set(key, value);
};
/** Gets a value under index key */
Store.prototype.get = function(key) {
2018-08-05 16:32:38 +02:00
return this.data.get(key);
};
export default Store;