Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

JSONPath

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

JSONPath - npm Package Compare versions

Comparing version 0.8.3 to 0.8.4

test/test.arr.js

20

lib/jsonpath.js

@@ -14,3 +14,3 @@ /* JSONPath 0.8.0 - XPath for JSON

flatten: arg && arg.flatten || false,
result: [],
wrap: (arg && arg.hasOwnProperty('wrap')) ? arg.wrap : true,
normalize: function(expr) {

@@ -43,6 +43,18 @@ if(cache[expr]) {

if(_.isArray(v) && P.flatten) {
if(!P.result) P.result = [];
P.result = P.result.concat(v);
}
else {
P.result[P.result.length] = v;
if(P.result) {
if(!_.isArray(P.result)) P.result = [P.result];
if(_.isArray(v) && P.flatten) {
P.result = P.result.concat(v);
}
else {
P.result[P.result.length] = v;
}
}
else {
P.result = v;
}
}

@@ -106,2 +118,3 @@ }

};
P.result = P.wrap === true ? [] : undefined;

@@ -111,4 +124,5 @@ var $ = obj;

P.trace(P.normalize(expr).replace(/^\$;/,""), obj, "$");
return P.result.length ? P.result : false;
if(!_.isArray(P.result) && P.wrap) P.result = [P.result];
return P.result ? P.result : false;
}
}

2

package.json

@@ -19,3 +19,3 @@ {

],
"version": "0.8.3",
"version": "0.8.4",
"repository": {

@@ -22,0 +22,0 @@ "type": "git",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc