@artilleryio/int-commons
Advanced tools
Comparing version 2.11.0-e52b310 to 2.11.0-e6063d6
@@ -274,4 +274,3 @@ /* This Source Code Form is subject to the terms of the Mozilla Public | ||
value | ||
)} (${typeof value}) ; (subj type: ${ | ||
subj.length ? 'list' : 'hash' | ||
)} (${typeof value}) ; (subj type: ${subj.length ? 'list' : 'hash' | ||
}) ; newValue = ${JSON.stringify(newValue)} ; newPath = ${newPath}` | ||
@@ -576,3 +575,3 @@ ); | ||
// doc is a JSON object | ||
function extractJSONPath(doc, expr) { | ||
function extractJSONPath(doc, expr, opts) { | ||
// typeof null is 'object' hence the explicit check here | ||
@@ -586,3 +585,3 @@ if (typeof doc !== 'object' || doc === null) { | ||
try { | ||
results = jsonpath(expr, doc); | ||
results = jsonpath({ path: expr, json: doc, wrap: opts.multiple ?? true }); | ||
} catch (queryErr) { | ||
@@ -596,2 +595,6 @@ debug(queryErr); | ||
if (opts.multiple === false) { | ||
return results; | ||
} | ||
if (results.length > 1) { | ||
@@ -598,0 +601,0 @@ return results[randomInt(0, results.length - 1)]; |
{ | ||
"name": "@artilleryio/int-commons", | ||
"version": "2.11.0-e52b310", | ||
"version": "2.11.0-e6063d6", | ||
"main": "./index.js", | ||
@@ -12,6 +12,9 @@ "license": "MPL-2.0", | ||
"espree": "^9.4.1", | ||
"jsonpath-plus": "^7.2.0", | ||
"jsonpath-plus": "^10.0.0", | ||
"lodash": "^4.17.19", | ||
"ms": "^2.1.3" | ||
}, | ||
"engines": { | ||
"node": ">=18.0.0" | ||
}, | ||
"scripts": { | ||
@@ -18,0 +21,0 @@ "lint": "eslint --ext \".js,.ts,.tsx\" .", |
19469
636
+ Added@jsep-plugin/assignment@1.3.0(transitive)
+ Added@jsep-plugin/regex@1.0.4(transitive)
+ Addedjsep@1.4.0(transitive)
+ Addedjsonpath-plus@10.3.0(transitive)
- Removedjsonpath-plus@7.2.0(transitive)
Updatedjsonpath-plus@^10.0.0