json-transformer-cli
Advanced tools
Comparing version
@@ -6,19 +6,4 @@ /*jshint evil:true*/ | ||
'use strict'; | ||
// AMD | ||
if (typeof define === 'function' && define.amd) { | ||
define('jsonpathObjectTransform', ['JSONPath'], function(jsonPath) { | ||
return (root.jsonpathObjectTransform = factory(jsonPath)); | ||
}); | ||
} | ||
// Node | ||
else if (typeof exports === 'object') { | ||
module.exports = factory(require('JSONPath')); | ||
} | ||
// Browser global | ||
else { | ||
root.jsonpathObjectTransform = factory(root.jsonPath); | ||
} | ||
const {JSONPath} = require('jsonpath-plus'); | ||
module.exports = factory(JSONPath); | ||
}(this, function(jsonPath) { | ||
@@ -81,3 +66,3 @@ 'use strict'; | ||
pathStr = pathStr.substring(1, pathStr.length); // remove the extra dollar sign from the path | ||
var seek = jsonPath.eval(data, pathStr) || []; | ||
var seek = jsonPath({path: pathStr, json: data}) || []; | ||
result[key] = seek.length ? seek[0] : undefined; | ||
@@ -91,3 +76,3 @@ } | ||
pathStr = pathStr.substring(1, pathStr.length); // remove the extra dollar sign from the path | ||
var seek = jsonPath.eval(data, pathStr) || []; | ||
var seek = jsonPath({path: pathStr, json: data}) || []; | ||
result = seek.length ? seek[0] : undefined; | ||
@@ -94,0 +79,0 @@ } |
@@ -6,8 +6,5 @@ { | ||
"dependencies": { | ||
"JSONPath": "~0.11.2", | ||
"jsonpath-plus": "~3.0.0", | ||
"cli": "^1.0.1" | ||
}, | ||
"bundledDependencies": [ | ||
"JSONPath" | ||
], | ||
"description": "A CLI tool to transform an object literal using JSONPath.", | ||
@@ -34,5 +31,6 @@ "keywords": [ | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
"test": "echo \"Error: no test specified\" && exit 1", | ||
"json-transform": "node cli.js" | ||
}, | ||
"version": "1.0.3" | ||
"version": "1.0.4" | ||
} |
10861
-28.84%11
-8.33%229
-4.98%+ Added
+ Added
- Removed
- Removed