Skip to content

Commit

Permalink
Replaced eval with JSON5.parse
Browse files Browse the repository at this point in the history
  • Loading branch information
AntonyGarand committed Jan 21, 2021
1 parent 472fe56 commit cdba5d3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "config-shield",
"version": "0.2.1",
"version": "0.2.2",
"description": "Store and retrieve data sensative in nature",
"main": "./lib/index.js",
"scripts": {
Expand Down Expand Up @@ -29,5 +29,8 @@
"name": "asilvas",
"email": "asilvas@godaddy.com"
}
]
],
"dependencies": {
"json5": "^2.1.3"
}
}
3 changes: 2 additions & 1 deletion scripts/cli.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
var readline = require('readline');
var JSON5 = require('json5');

var rl = readline.createInterface({
input: process.stdin,
Expand Down Expand Up @@ -77,7 +78,7 @@ function cmdSet(key, val) {
try {
var strTest = /^[\'\"](.*?)[\'\"]$/.exec(val);
if (!strTest || strTest.length !== 2) { // do not parse if explicitly a string
objVal = eval('(' + val + ')'); // attempt to parse
objVal = JSON5.parse(val); // attempt to parse
} else {
objVal = strTest[1];
}
Expand Down

0 comments on commit cdba5d3

Please # to comment.