2016-04-04 16:24:22 +00:00
|
|
|
"use strict";
|
2016-11-21 10:58:37 +00:00
|
|
|
const plugins = require("./smartenv.plugins");
|
2016-02-17 20:44:40 +00:00
|
|
|
exports.obs = {
|
2016-11-21 10:58:37 +00:00
|
|
|
add: function (paramNameArg = 'undefined', objectArg = 'undefined') {
|
|
|
|
if (paramNameArg === 'undefined') {
|
|
|
|
console.log('paramName is undefined');
|
2016-02-17 20:44:40 +00:00
|
|
|
return;
|
|
|
|
}
|
2016-11-21 10:58:37 +00:00
|
|
|
if (objectArg === 'undefined') {
|
|
|
|
console.log('objectArg is undefined');
|
2016-02-17 20:44:40 +00:00
|
|
|
}
|
2016-11-21 10:58:37 +00:00
|
|
|
if (typeof exports.obsItems[paramNameArg] === 'undefined') {
|
2016-02-17 20:44:40 +00:00
|
|
|
exports.obsItems[paramNameArg] = objectArg;
|
|
|
|
}
|
|
|
|
else {
|
2016-11-21 10:58:37 +00:00
|
|
|
console.log('object is already present, so add operation has failed.');
|
2016-02-17 20:44:40 +00:00
|
|
|
}
|
|
|
|
return exports.obsItems[paramNameArg];
|
|
|
|
},
|
|
|
|
replace: function (paramNameArg, objectArg) {
|
|
|
|
exports.obsItems[paramNameArg] = objectArg;
|
|
|
|
},
|
|
|
|
merge: function (paramNameArg, objectArg) {
|
2016-11-21 10:58:37 +00:00
|
|
|
if (!(typeof exports.obsItems[paramNameArg] === 'undefined')) {
|
2016-02-17 20:44:40 +00:00
|
|
|
exports.obsItems[paramNameArg] = plugins._.assign(exports.obsItems[paramNameArg], objectArg);
|
|
|
|
}
|
|
|
|
else {
|
2016-11-21 10:58:37 +00:00
|
|
|
console.log('object is not present, so there is nothing to merge');
|
2016-02-17 20:44:40 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
get: function (keyName) {
|
|
|
|
return exports.obsItems[keyName];
|
|
|
|
},
|
|
|
|
getAll: function () {
|
|
|
|
return exports.obsItems;
|
|
|
|
},
|
|
|
|
addComplete: function (itemsArg) {
|
|
|
|
exports.obsItems = plugins._.assign(exports.obsItems, itemsArg);
|
|
|
|
return exports.obsItems;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
exports.obsItems = {};
|
2016-11-21 10:58:37 +00:00
|
|
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRlbnYub2JqZWN0c3RvcmFnZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL3NtYXJ0ZW52Lm9iamVjdHN0b3JhZ2UudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLDhDQUE4QztBQUNuQyxRQUFBLEdBQUcsR0FBUTtJQUNsQixHQUFHLEVBQUUsVUFBUyxZQUFZLEdBQUcsV0FBVyxFQUFDLFNBQVMsR0FBRyxXQUFXO1FBQzVELEVBQUUsQ0FBQyxDQUFDLFlBQVksS0FBSyxXQUFXLENBQUMsQ0FBQyxDQUFDO1lBQy9CLE9BQU8sQ0FBQyxHQUFHLENBQUMsd0JBQXdCLENBQUMsQ0FBQTtZQUNyQyxNQUFNLENBQUE7UUFDVixDQUFDO1FBQ0QsRUFBRSxDQUFDLENBQUMsU0FBUyxLQUFLLFdBQVcsQ0FBQyxDQUFDLENBQUM7WUFDNUIsT0FBTyxDQUFDLEdBQUcsQ0FBQyx3QkFBd0IsQ0FBQyxDQUFBO1FBQ3pDLENBQUM7UUFDRCxFQUFFLENBQUMsQ0FBQyxPQUFPLGdCQUFRLENBQUMsWUFBWSxDQUFDLEtBQUssV0FBVyxDQUFDLENBQUMsQ0FBQztZQUNoRCxnQkFBUSxDQUFDLFlBQVksQ0FBQyxHQUFHLFNBQVMsQ0FBQTtRQUN0QyxDQUFDO1FBQUMsSUFBSSxDQUFDLENBQUM7WUFDSixPQUFPLENBQUMsR0FBRyxDQUFDLHlEQUF5RCxDQUFDLENBQUE7UUFDMUUsQ0FBQztRQUNELE1BQU0sQ0FBQyxnQkFBUSxDQUFDLFlBQVksQ0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