Compare commits

...

4 Commits

Author SHA1 Message Date
2df7cf1467 0.0.12 2015-12-06 21:55:56 +01:00
bae4305dec update dependencies 2015-12-06 21:55:49 +01:00
1737075753 0.0.11 2015-12-06 21:50:05 +01:00
1a74ee8bb6 switched params for smartenv.obs.add() 2015-12-06 21:49:57 +01:00
7 changed files with 23 additions and 15 deletions

View File

@ -73,13 +73,17 @@ var SmartenvObjectStorage;
function init() { function init() {
var obs = {}; var obs = {};
var obsItems = {}; var obsItems = {};
obs.add = function (objectArg, paramName) { obs.add = function (paramNameArg, objectArg) {
if (paramName === void 0) { paramName = "undefined"; } if (paramNameArg === void 0) { paramNameArg = "undefined"; }
if (paramName == "undefined") { if (objectArg === void 0) { objectArg = "undefined"; }
if (paramNameArg == "undefined") {
plugins.beautylog.error("paramName is undefined"); plugins.beautylog.error("paramName is undefined");
return; return;
} }
obsItems[paramName] = objectArg; if (objectArg == "undefined") {
plugins.beautylog.error("objectArg is undefined");
}
obsItems[paramNameArg] = objectArg;
}; };
obs.get = function (keyName) { obs.get = function (keyName) {
return obsItems[keyName]; return obsItems[keyName];

View File

@ -1,13 +1,14 @@
{ {
"name": "smartenv", "name": "smartenv",
"version": "0.0.10", "version": "0.0.12",
"description": "store things about your environment and let them travel across modules", "description": "store things about your environment and let them travel across modules",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {
"test": "(cd ts/compile && node compile.js) && (node test.js)", "test": "(cd ts/compile && node compile.js) && (node test.js)",
"reinstall": "(rm -r node_modules && npm install)", "reinstall": "(rm -r node_modules && npm install)",
"release": "(git pull origin master && npm version patch && git push origin master && git checkout release && git merge master && git push origin release && git checkout master)", "release": "(git pull origin master && npm version patch && git push origin master && git checkout release && git merge master && git push origin release && git checkout master)",
"startdev": "(git checkout master && git pull origin master && npm install)" "update": "(git checkout master && git pull origin master && npm install)",
"upgrade": "(npm run update) && (ncu upgradeAll && npm install)"
}, },
"repository": { "repository": {
"type": "git", "type": "git",
@ -23,11 +24,11 @@
}, },
"homepage": "https://github.com/pushrocks/smartenv", "homepage": "https://github.com/pushrocks/smartenv",
"dependencies": { "dependencies": {
"beautylog": "^1.0.4", "beautylog": "^1.0.6",
"lodash": "^3.10.1" "lodash": "^3.10.1"
}, },
"devDependencies": { "devDependencies": {
"gulp": "^3.9.0", "gulp": "^3.9.0",
"gulp-typescript": "^2.9.2" "gulp-typescript": "^2.10.0"
} }
} }

View File

@ -4,7 +4,7 @@ var beautylog = require("beautylog")("os");
beautylog.info("Now testing the smartenv module"); beautylog.info("Now testing the smartenv module");
smartenv.printEnv(); smartenv.printEnv();
beautylog.info("Now testing the smartenv module"); beautylog.info("Now testing the smartenv module");
smartenv.obs.add({ key1: "Peter" }, "docit"); smartenv.obs.add("docit", { key1: "Peter" });
smartenv.printEnv(); smartenv.printEnv();
beautylog.log(smartenv.obs.get("docit").key1); beautylog.log(smartenv.obs.get("docit").key1);
beautylog.log(smartenv.obs.get("docit").key1); beautylog.log(smartenv.obs.get("docit").key1);

View File

@ -3,12 +3,15 @@ module SmartenvObjectStorage {
export function init() { export function init() {
var obs:any = {}; var obs:any = {};
var obsItems:any = {}; var obsItems:any = {};
obs.add = function(objectArg,paramName = "undefined") { obs.add = function(paramNameArg = "undefined",objectArg = "undefined") {
if (paramName == "undefined"){ if (paramNameArg == "undefined"){
plugins.beautylog.error("paramName is undefined"); plugins.beautylog.error("paramName is undefined");
return; return;
} }
obsItems[paramName] = objectArg; if (objectArg == "undefined"){
plugins.beautylog.error("objectArg is undefined");
}
obsItems[paramNameArg] = objectArg;
}; };
obs.get = function(keyName) { obs.get = function(keyName) {
return obsItems[keyName]; return obsItems[keyName];

View File

@ -4,7 +4,7 @@ var beautylog = require("beautylog")("os");
beautylog.info("Now testing the smartenv module"); beautylog.info("Now testing the smartenv module");
smartenv.printEnv(); smartenv.printEnv();
beautylog.info("Now testing the smartenv module"); beautylog.info("Now testing the smartenv module");
smartenv.obs.add({ key1: "Peter" }, "docit"); smartenv.obs.add("docit", { key1: "Peter" });
smartenv.printEnv(); smartenv.printEnv();
beautylog.log(smartenv.obs.get("docit").key1); beautylog.log(smartenv.obs.get("docit").key1);
beautylog.log(smartenv.obs.get("docit").key1); beautylog.log(smartenv.obs.get("docit").key1);

View File

@ -1 +1 @@
{"version":3,"file":"test.js","sourceRoot":"","sources":["test.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,IAAI,QAAQ,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;AACrC,IAAI,SAAS,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,CAAC;AAC3C,SAAS,CAAC,IAAI,CAAC,iCAAiC,CAAC,CAAC;AAClD,QAAQ,CAAC,QAAQ,EAAE,CAAC;AACpB,SAAS,CAAC,IAAI,CAAC,iCAAiC,CAAC,CAAC;AAClD,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,EAAC,IAAI,EAAC,OAAO,EAAC,EAAC,OAAO,CAAC,CAAC;AACzC,QAAQ,CAAC,QAAQ,EAAE,CAAC;AACpB,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC;AAC9C,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC;AAE9C,IAAI,IAAI,GAAG,OAAO,CAAC;AACnB,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,IAAI,GAAG,IAAI,CAAC;AACtC,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC;AAE9C,SAAS,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC"} {"version":3,"file":"test.js","sourceRoot":"","sources":["test.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,IAAI,QAAQ,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;AACrC,IAAI,SAAS,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,CAAC;AAC3C,SAAS,CAAC,IAAI,CAAC,iCAAiC,CAAC,CAAC;AAClD,QAAQ,CAAC,QAAQ,EAAE,CAAC;AACpB,SAAS,CAAC,IAAI,CAAC,iCAAiC,CAAC,CAAC;AAClD,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,OAAO,EAAC,EAAC,IAAI,EAAC,OAAO,EAAC,CAAC,CAAC;AACzC,QAAQ,CAAC,QAAQ,EAAE,CAAC;AACpB,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC;AAC9C,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC;AAE9C,IAAI,IAAI,GAAG,OAAO,CAAC;AACnB,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,IAAI,GAAG,IAAI,CAAC;AACtC,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC;AAE9C,SAAS,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC"}

View File

@ -4,7 +4,7 @@ var beautylog = require("beautylog")("os");
beautylog.info("Now testing the smartenv module"); beautylog.info("Now testing the smartenv module");
smartenv.printEnv(); smartenv.printEnv();
beautylog.info("Now testing the smartenv module"); beautylog.info("Now testing the smartenv module");
smartenv.obs.add({key1:"Peter"},"docit"); smartenv.obs.add("docit",{key1:"Peter"});
smartenv.printEnv(); smartenv.printEnv();
beautylog.log(smartenv.obs.get("docit").key1); beautylog.log(smartenv.obs.get("docit").key1);
beautylog.log(smartenv.obs.get("docit").key1); beautylog.log(smartenv.obs.get("docit").key1);