New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

gson-pointer

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gson-pointer - npm Package Compare versions

Comparing version 3.2.0 to 3.2.1

3

lib/delete.js

@@ -12,4 +12,3 @@ "use strict";

var lastProperty = properties.pop();
var toParent = properties;
var target = get(data, toParent);
var target = get(data, properties);
if (target) {

@@ -16,0 +15,0 @@ delete target[lastProperty];

@@ -8,2 +8,4 @@ "use strict";

var matchMutlipleSlashes = /\/+/g;
var matchTildes = /~/g;
var matchSlashes = /\//g;

@@ -18,3 +20,3 @@

for (var i = 0, l = list.length; i < l; i += 1) {
list[i] = list[i].replace("~", "~0").replace("/", "~1");
list[i] = list[i].replace(matchTildes, "~0").replace(matchSlashes, "~1");
if (isURI) {

@@ -21,0 +23,0 @@ list[i] = encodeURIComponent(list[i]);

@@ -25,4 +25,4 @@ "use strict";

const sanitize = pointer.indexOf("#") >= 0 ? sanitizeAndDecodeProperty : sanitizeProperty;
pointer = pointer.replace(matchMutlipleSlashes, "/"); // remove multiple slashes
pointer = pointer.replace(matchPointerPrefixes, ""); // strip pointer prefixes
pointer = pointer.replace(matchMutlipleSlashes, "/");
pointer = pointer.replace(matchPointerPrefixes, "");

@@ -29,0 +29,0 @@ var result = pointer.split("/");

{
"name": "gson-pointer",
"version": "3.2.0",
"version": "3.2.1",
"description": "json pointer - failsafe data retrieval on js and json objects",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -24,4 +24,2 @@ # gson-pointer - a json-pointer implementation

Besides the standard `get` function, this library offers additional functions to work with json-pointer
| method | description

@@ -33,3 +31,2 @@ | ------------------------------------- | -------------------------------------------------------------

| join(...pointers) -> pointer | joins multiple pointers to a single one
| join([properties], isURI) -> pointer | joins all properties in the given mode
| split(pointer) -> [array] | returns a json-pointer as an array

@@ -64,3 +61,3 @@

and may optionally pass a default value with
and may optionally return a default value with

@@ -103,3 +100,3 @@ ```js

and may used to create data structures
and may be used to build data

@@ -201,3 +198,3 @@ ```js

// passing the array directly, will treat each entry as a property, which will be escaped and resolves to:
gp.join(['/path/to/value', '../object']); // output: '/~1path/to/value/..~1object'
gp.join(['/path/to/value', '../object']); // output: '/~1path~1to~1value/..~1object'
```

@@ -204,0 +201,0 @@

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