#!/usr/bin/env node
/// <reference path="typings/main.d.ts" />
var plugins = require("./smartenv.plugins");
exports.obs = {
add: function (paramNameArg, objectArg) {
Iif (paramNameArg === void 0) { paramNameArg = "undefined"; }
Iif (objectArg === void 0) { objectArg = "undefined"; }
Iif (paramNameArg == "undefined") {
plugins.beautylog.error("paramName is undefined");
return;
}
Iif (objectArg == "undefined") {
plugins.beautylog.error("objectArg is undefined");
}
if (typeof exports.obsItems[paramNameArg] === "undefined") {
exports.obsItems[paramNameArg] = objectArg;
}
else {
plugins.beautylog.error("object is already present, so add operation has failed.");
}
return exports.obsItems[paramNameArg];
},
replace: function (paramNameArg, objectArg) {
exports.obsItems[paramNameArg] = objectArg;
},
merge: function (paramNameArg, objectArg) {
Eif (!(typeof exports.obsItems[paramNameArg] === "undefined")) {
exports.obsItems[paramNameArg] = plugins._.assign(exports.obsItems[paramNameArg], objectArg);
}
else {
plugins.beautylog.error("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._.assign(exports.obsItems, itemsArg);
return exports.obsItems;
}
};
exports.obsItems = {};
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNtYXJ0ZW52Lm9iamVjdHN0b3JhZ2UudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsMENBQTBDO0FBQzFDLElBQU8sT0FBTyxXQUFXLG9CQUFvQixDQUFDLENBQUM7QUFFcEMsV0FBRyxHQUFPO0lBQ2pCLEdBQUcsRUFBRSxVQUFTLFlBQTBCLEVBQUMsU0FBdUI7UUFBbEQsNEJBQTBCLEdBQTFCLDBCQUEwQjtRQUFDLHlCQUF1QixHQUF2Qix1QkFBdUI7UUFDNUQsRUFBRSxDQUFDLENBQUMsWUFBWSxJQUFJLFdBQVcsQ0FBQyxDQUFBLENBQUM7WUFDN0IsT0FBTyxDQUFDLFNB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