47 lines
3.3 KiB
JavaScript
47 lines
3.3 KiB
JavaScript
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
const plugins = require("./smartenv.plugins");
|
|
exports.obsItems = {};
|
|
/**
|
|
* Objectstorage allows easy sharing of objects within node
|
|
*/
|
|
exports.obs = {
|
|
add: (keyNameArg, objectArg) => {
|
|
if (!keyNameArg) {
|
|
console.log('keyName is undefined');
|
|
return;
|
|
}
|
|
if (!objectArg) {
|
|
console.log('objectArg is undefined');
|
|
}
|
|
if (!(exports.obsItems[keyNameArg])) {
|
|
exports.obsItems[keyNameArg] = objectArg;
|
|
}
|
|
else {
|
|
console.log('object is already present, so add operation has failed.');
|
|
}
|
|
return exports.obsItems[keyNameArg];
|
|
},
|
|
replace: function (paramNameArg, objectArg) {
|
|
exports.obsItems[paramNameArg] = objectArg;
|
|
},
|
|
merge: function (paramNameArg, objectArg) {
|
|
if (!(typeof exports.obsItems[paramNameArg] === 'undefined')) {
|
|
exports.obsItems[paramNameArg] = plugins.lodash.assign(exports.obsItems[paramNameArg], objectArg);
|
|
}
|
|
else {
|
|
console.log('object is not present, so there is nothing to merge');
|
|
}
|
|
},
|
|
get: function (keyName) {
|
|
return exports.obsItems[keyName];
|
|
},
|
|
getAll: function () {
|
|
return exports.obsItems;
|
|
},
|
|
addComplete: function (itemsArg) {
|
|
exports.obsItems = plugins.lodash.assign(exports.obsItems, itemsArg);
|
|
return exports.obsItems;
|
|
}
|
|
};
|
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRlbnYub2JqZWN0c3RvcmFnZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL3NtYXJ0ZW52Lm9iamVjdHN0b3JhZ2UudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSw4Q0FBOEM7QUFFbkMsUUFBQSxRQUFRLEdBQVEsRUFBRSxDQUFBO0FBRTdCOztHQ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