Mentions légales du service

Skip to content
Snippets Groups Projects
Commit f1746de6 authored by Brett Zamir's avatar Brett Zamir
Browse files

More precision for passing nullish objects

parent fb25083c
Branches
No related tags found
No related merge requests found
...@@ -39,13 +39,14 @@ function JSONPath (opts, obj, expr) { ...@@ -39,13 +39,14 @@ function JSONPath (opts, obj, expr) {
} }
opts = opts || {}; opts = opts || {};
var len1 = arguments.length === 1;
this.resultType = (opts.resultType && opts.resultType.toLowerCase()) || 'value'; this.resultType = (opts.resultType && opts.resultType.toLowerCase()) || 'value';
this.flatten = opts.flatten || false; this.flatten = opts.flatten || false;
this.wrap = opts.hasOwnProperty('wrap') ? opts.wrap : true; this.wrap = opts.hasOwnProperty('wrap') ? opts.wrap : true;
this.sandbox = opts.sandbox || {}; this.sandbox = opts.sandbox || {};
if (opts.autostart !== false) { if (opts.autostart !== false) {
return this.evaluate(obj || opts.json, expr || opts.path); return this.evaluate((len1 ? opts.json : obj), (len1 ? opts.path : expr));
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment