Skip to content
Snippets Groups Projects
Commit c88c9c4f authored by Vincenzo Chianese's avatar Vincenzo Chianese Committed by Alvaro Cabrera Durán
Browse files

Replace JSONPath dependency (#518)

* refactor: replace json path with jsonpath-plus

* add missing dependencies

* chore: update usage
parent b86fb26c
Branches
Tags
No related merge requests found
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
......@@ -64,6 +64,9 @@
"codecov": "^3.0.0",
"concat": "^1.0.3",
"cryptiles": "^4.1.3",
"eslint": "^6.0.1",
"eslint-config-airbnb-base": "^13.1.0",
"eslint-plugin-import": "^2.18.0",
"esm": "^3.0.82",
"extend": "^3.0.2",
"faker": "^4.1.0",
......@@ -82,7 +85,7 @@
},
"dependencies": {
"json-schema-ref-parser": "^6.0.2",
"jsonpath": "^1.0.1",
"jsonpath-plus": "^0.20.1",
"randexp": "^0.5.3"
}
}
import jsonpath from 'jsonpath';
import { JSONPath } from 'jsonpath-plus';
import optionAPI from '../api/option';
import traverse from './traverse';
......@@ -60,9 +60,9 @@ function resolve(obj, data, values, property) {
if (!values[key]) {
if (params.count > 1) {
values[key] = jsonpath.query(data, params.path, params.count);
values[key] = JSONPath(params.path, data).slice(0, params.count);
} else {
values[key] = jsonpath.query(data, params.path);
values[key] = JSONPath(params.path, data);
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment