1
0
Fork 0
freesewing/packages/core/src/store.js
2019-08-03 15:03:33 +02:00

20 lines
428 B
JavaScript

function Store() {
this.data = new Map()
}
/** Sets a value under index key */
Store.prototype.set = function(key, value) {
this.data.set(key, value)
}
/** Sets a value under index key */
Store.prototype.setIfUnset = function(key, value) {
if (!this.data.has(key)) this.data.set(key, value)
}
/** Gets a value under index key */
Store.prototype.get = function(key) {
return this.data.get(key)
}
export default Store