Comparing version 0.5.4 to 0.6.0
@@ -19,3 +19,12 @@ 'use strict'; | ||
if (value === 'file') { | ||
(0, _utils.validateJSONPath)(params[params.length - 1]); | ||
var path = params[params.length - 1]; | ||
if (Array.isArray(path)) { | ||
params.pop(); | ||
path.forEach(function (file) { | ||
(0, _utils.validateJSONPath)(file); | ||
params.push(file); | ||
}); | ||
} else { | ||
(0, _utils.validateJSONPath)(params[params.length - 1]); | ||
} | ||
} else { | ||
@@ -22,0 +31,0 @@ params.pop(); |
{ | ||
"name": "node-jq", | ||
"version": "0.5.4", | ||
"version": "0.6.0", | ||
"description": "Run jq in node", | ||
@@ -61,8 +61,6 @@ "main": "lib/jq.js", | ||
"babel-register": "^6.9.0", | ||
"chai": "^3.5.0", | ||
"chai-as-promised": "^6.0.0", | ||
"chai": "^4.0.1", | ||
"codeclimate-test-reporter": "^0.4.1", | ||
"coveralls": "^2.11.9", | ||
"dirty-chai": "^1.2.2", | ||
"husky": "^0.13.1", | ||
"husky": "^0.14.0", | ||
"isparta": "^4.0.0", | ||
@@ -69,0 +67,0 @@ "mocha": "^3.2.0", |
@@ -108,2 +108,15 @@ <p align="center"> | ||
#### `input: 'file'` | ||
Run jq query against multiple **JSON files**. | ||
```js | ||
jq.run('.', ['/path/to/file.json','path/to/other_file.json']).then(console.log) | ||
// { | ||
// "foo": "bar" | ||
// } | ||
// { | ||
// "otherFoo": "andBar" | ||
// } | ||
``` | ||
#### `input: 'json'` | ||
@@ -110,0 +123,0 @@ |
@@ -12,3 +12,12 @@ import { validateJSONPath } from './utils' | ||
if (value === 'file') { | ||
validateJSONPath(params[params.length - 1]) | ||
let path = params[params.length - 1] | ||
if (Array.isArray(path)) { | ||
params.pop() | ||
path.forEach((file) => { | ||
validateJSONPath(file) | ||
params.push(file) | ||
}) | ||
} else { | ||
validateJSONPath(params[params.length - 1]) | ||
} | ||
} else { | ||
@@ -15,0 +24,0 @@ params.pop() |
68318
15
346
209