smartenv/index.js
Philipp Kunz 5a45aa5fbe initial
2015-11-26 06:31:31 +01:00

29 lines
1.1 KiB
JavaScript

/// <reference path="typings/tsd.d.ts" />
var beautylog = require("beautylog")("os");
var addToGlobal = function (objectArg, paramName) {
global[paramName] = objectArg;
};
var smartenv = {}; //create smartenv object
smartenv.items = {}; // create the items object to store items to.
smartenv.makeGlobal = function () {
addToGlobal(smartenv, "smartenv"); //add object smartenv as global["smartenv"]
};
smartenv.info = function () {
var pck = require("./package.json");
beautylog.log("node version is " + process.version + " and smartenv version is " + pck.version);
beautylog.log("the smartenv module currently holds the following properties:");
console.log(Object.getOwnPropertyNames(smartenv.items).sort());
};
smartenv.register = function (objectArg, paramName) {
if (paramName === void 0) { paramName = "undefined"; }
if (paramName == "undefined") {
beautylog.error("paramName is undefined");
return;
}
smartenv.items[paramName] = objectArg;
};
smartenv.get = function (keyName) {
return smartenv.items[keyName];
};
module.exports = smartenv;