Comparing version 0.1.1 to 0.1.2
@@ -7,4 +7,23 @@ 'use strict'; | ||
var $C = constantly(path.resolve('example.json')); | ||
var $C = constantly(require(path.resolve('example/example.json'))); //succeeds, JSON from a file | ||
//var $C = constantly('example/example.json'); //fails, just a string which is a valid path but expects JSON | ||
//var $C = constantly([{ //succeeds, pass it json | ||
// "feature": "ACCOUNT", | ||
// "category": "TYPE", | ||
// "property": "USER", | ||
// "comment": "A regular user that can login and do normal things", | ||
// "value": "USER", | ||
// "sequence": 0 | ||
//}, | ||
//{ | ||
// "feature": "ACCOUNT", | ||
// "category": "TYPE", | ||
// "property": "ADMIN", | ||
// "comment": "User which is an administrator", | ||
// "value": "ADMIN", | ||
// "sequence": 0 | ||
//}]); | ||
for (var f in $C) { | ||
@@ -20,3 +39,3 @@ gutil.log(gutil.colors.cyan(f)); | ||
var proposedAccountType = $C.ACCOUNT.TYPE.ADMIN.value; | ||
var proposedAccountType = 'ADMIN'; | ||
@@ -31,2 +50,5 @@ switch(proposedAccountType) { | ||
break; | ||
default: | ||
gutil.log('unknown user type'); | ||
break; | ||
} |
@@ -1,2 +0,3 @@ | ||
[{ | ||
[ | ||
{ | ||
"feature": "ACCOUNT", | ||
@@ -8,4 +9,4 @@ "category": "TYPE", | ||
"sequence": 0 | ||
}, | ||
{ | ||
}, | ||
{ | ||
"feature": "ACCOUNT", | ||
@@ -17,4 +18,4 @@ "category": "TYPE", | ||
"sequence": 0 | ||
}, | ||
{ | ||
}, | ||
{ | ||
"feature": "ACCOUNT", | ||
@@ -26,4 +27,4 @@ "category": "STATUS", | ||
"sequence": 0 | ||
}, | ||
{ | ||
}, | ||
{ | ||
"feature": "ACCOUNT", | ||
@@ -35,4 +36,4 @@ "category": "STATUS", | ||
"sequence": 0 | ||
}, | ||
{ | ||
}, | ||
{ | ||
"feature": "ACCOUNT", | ||
@@ -44,4 +45,4 @@ "category": "STATUS", | ||
"sequence": 0 | ||
}, | ||
{ | ||
}, | ||
{ | ||
"feature": "ACCOUNT", | ||
@@ -53,4 +54,4 @@ "category": "STATUS", | ||
"sequence": 0 | ||
}, | ||
{ | ||
}, | ||
{ | ||
"feature": "ACCOUNT", | ||
@@ -62,4 +63,4 @@ "category": "STATUS", | ||
"sequence": 0 | ||
}, | ||
{ | ||
}, | ||
{ | ||
"feature": "ACCOUNT", | ||
@@ -71,4 +72,4 @@ "category": "STATUS", | ||
"sequence": 0 | ||
}, | ||
{ | ||
}, | ||
{ | ||
"feature": "PROPERTY", | ||
@@ -80,4 +81,4 @@ "category": "TYPE", | ||
"sequence": 0 | ||
}, | ||
{ | ||
}, | ||
{ | ||
"feature": "PROPERTY", | ||
@@ -89,2 +90,3 @@ "category": "TYPE", | ||
"sequence": 0 | ||
}] | ||
} | ||
] |
@@ -7,6 +7,5 @@ 'use strict'; | ||
var obj = {}; | ||
var raw = require(target); | ||
var raw = target; //TODO https://www.npmjs.com/package/is-my-json-valid | ||
raw.forEach(function (prop) { | ||
var strPath = [ | ||
@@ -13,0 +12,0 @@ prop.feature, |
{ | ||
"name": "constantly", | ||
"description": "Parse constant files and put them in a frozen object", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"preferGlobal": "false", | ||
"main": "index.js", | ||
"author": "Daily Raisin LLC ", | ||
"keywords": ["constant", "constants", "parsing", "JSON"], | ||
"keywords": [ | ||
"constant", | ||
"constants", | ||
"parsing", | ||
"JSON" | ||
], | ||
"dependencies": { | ||
@@ -10,0 +15,0 @@ "hoops": "^0.2.1" |
@@ -29,3 +29,4 @@ # Constantly | ||
var constantly = require('constantly'); | ||
var $C = constantly(path.resolve('example.json')); | ||
var path = require('path'); | ||
var $C = constantly(require(path.resolve('example.json'))); //pass it real JSON | ||
@@ -44,1 +45,9 @@ var admin = $C.ACCOUNT.TYPE.ADMIN.value; //200 | ||
Sequence is used for ordering properties in UI. | ||
## Example | ||
node example/demo.js | ||
## TODO | ||
- validate JSON to match this pattern upon injestion |
Sorry, the diff of this file is not supported yet
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
9001
146
52