Socket
Socket
Sign inDemoInstall

rfc6902

Package Overview
Dependencies
Maintainers
1
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rfc6902 - npm Package Compare versions

Comparing version 1.1.2 to 1.1.3

2

package.json
{
"name": "rfc6902",
"version": "1.1.2",
"version": "1.1.3",
"description": "Complete implementation of RFC6902 (patch and diff)",

@@ -5,0 +5,0 @@ "keywords": [

(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.rfc6902 = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){
"use strict";
var _slicedToArray = function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { var _arr = []; for (var _iterator = arr[Symbol.iterator](), _step; !(_step = _iterator.next()).done;) { _arr.push(_step.value); if (i && _arr.length === i) break; } return _arr; } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } };
var _toConsumableArray = function (arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; return arr2; } else { return Array.from(arr); } };
exports.diffAny = diffAny;

@@ -11,5 +15,2 @@ Object.defineProperty(exports, "__esModule", {

function pushAll(array, items) {
return Array.prototype.push.apply(array, items);
}
/**

@@ -60,2 +61,11 @@ subtract(a, b) returns the keys in `a` that are not in `b`.

}
function isArrayAdd(array_operation) {
return array_operation.op === "add";
}
function isArrayRemove(array_operation) {
return array_operation.op === "remove";
}
function isArrayReplace(array_operation) {
return array_operation.op === "replace";
}
/**

@@ -129,3 +139,7 @@ Array-diffing smarter (levenshtein-like) diffing here

// TABLE MIDDLE
// supposing we replaced it, compute the rest of the costs:
var replace_alternative = dist(i - 1, j - 1);
// okay, the general plan is to replace it, but we can be smarter,
// recursing into the structure and replacing only part of it if
// possible, but to do so we'll need the original value
alternatives.push({

@@ -135,2 +149,3 @@ operations: replace_alternative.operations.concat({

index: i - 1,
original: input[i - 1],
value: output[j - 1] }),

@@ -153,5 +168,10 @@ cost: replace_alternative.cost + 1 });

var array_operations = dist(input.length, output.length).operations;
var padding = 0;
var operations = array_operations.map(function (array_operation) {
if (array_operation.op === "add") {
var _array_operations$reduce = array_operations.reduce(function (_ref, array_operation) {
var _ref2 = _slicedToArray(_ref, 2);
var operations = _ref2[0];
var padding = _ref2[1];
if (isArrayAdd(array_operation)) {
var padded_index = array_operation.index + 1 + padding;

@@ -163,17 +183,22 @@ var index_token = padded_index < input.length ? String(padded_index) : "-";

value: array_operation.value };
padding++; // maybe only if array_operation.index > -1 ?
return operation;
} else if (array_operation.op === "remove") {
// padding++; // maybe only if array_operation.index > -1 ?
return [operations.concat(operation), padding + 1];
} else if (isArrayRemove(array_operation)) {
var operation = {
op: array_operation.op,
path: ptr.add(String(array_operation.index + padding)).toString() };
padding--;
return operation;
// padding--;
return [operations.concat(operation), padding - 1];
} else {
return {
op: array_operation.op,
path: ptr.add(String(array_operation.index + padding)).toString(),
value: array_operation.value };
var replace_ptr = ptr.add(String(array_operation.index + padding));
var replace_operations = diffAny(array_operation.original, array_operation.value, replace_ptr);
return [operations.concat.apply(operations, _toConsumableArray(replace_operations)), padding];
}
});
}, [[], 0]);
var _array_operations$reduce2 = _slicedToArray(_array_operations$reduce, 2);
var operations = _array_operations$reduce2[0];
var padding = _array_operations$reduce2[1];
return operations;

@@ -193,3 +218,3 @@ }

intersection([input, output]).forEach(function (key) {
pushAll(operations, diffAny(input[key], output[key], ptr.add(key)));
operations.push.apply(operations, _toConsumableArray(diffAny(input[key], output[key], ptr.add(key))));
});

@@ -199,7 +224,6 @@ return operations;

function diffValues(input, output, ptr) {
var operations = [];
if (!compare(input, output)) {
operations.push({ op: "replace", path: ptr.toString(), value: output });
return [{ op: "replace", path: ptr.toString(), value: output }];
}
return operations;
return [];
}

@@ -431,3 +455,3 @@

"name": "rfc6902",
"version": "1.1.0",
"version": "1.1.2",
"description": "Complete implementation of RFC6902 (patch and diff)",

@@ -434,0 +458,0 @@ "keywords": [

@@ -1,16 +0,17 @@

(function(n){"object"===typeof exports&&"undefined"!==typeof module?module.exports=n():"function"===typeof define&&define.amd?define([],n):("undefined"!==typeof window?window:"undefined"!==typeof global?global:"undefined"!==typeof self?self:this).rfc6902=n()})(function(){return function d(l,b,g){function h(a,c){if(!b[a]){if(!l[a]){var e="function"==typeof require&&require;if(!c&&e)return e(a,!0);if(k)return k(a,!0);e=Error("Cannot find module '"+a+"'");throw e.code="MODULE_NOT_FOUND",e;}e=b[a]={exports:{}};
l[a][0].call(e.exports,function(m){var e=l[a][1][m];return h(e?e:m)},e,e.exports,d,l,b,g)}return b[a].exports}for(var k="function"==typeof require&&require,f=0;f<g.length;f++)h(g[f]);return h}({1:[function(d,l,b){function g(a,e){var c={},b;for(b in a)c[b]=1;for(var f in e)delete c[f];return Object.keys(c)}function h(a){var e={};a.forEach(function(a){for(var m in a)e[m]=(e[m]||0)+1});a=a.length;for(var c in e)e[c]<a&&delete e[c];return Object.keys(e)}function k(a){return void 0===a?"undefined":null===
a?"null":Array.isArray(a)?"array":typeof a}function f(a,c,b){function f(b,d){var g=k[b+","+d];if(void 0===g){if(e(a[b-1],c[d-1]))g=f(b-1,d-1);else{g=[];if(0<b){var h=f(b-1,d);g.push({operations:h.operations.concat({op:"remove",index:b-1}),cost:h.cost+1})}0<d&&(h=f(b,d-1),g.push({operations:h.operations.concat({op:"add",index:b-1,value:c[d-1]}),cost:h.cost+1}));0<b&&0<d&&(h=f(b-1,d-1),g.push({operations:h.operations.concat({op:"replace",index:b-1,value:c[d-1]}),cost:h.cost+1}));g=g.sort(function(a,
e){return a.cost-e.cost})[0]}k[b+","+d]=g}return g}var k={"0,0":{operations:[],cost:0}},d=0;return f(a.length,c.length).operations.map(function(e){if("add"===e.op){var c=e.index+1+d;e={op:e.op,path:b.add(c<a.length?String(c):"-").toString(),value:e.value};d++;return e}return"remove"===e.op?(e={op:e.op,path:b.add(String(e.index+d)).toString()},d--,e):{op:e.op,path:b.add(String(e.index+d)).toString(),value:e.value}})}function a(a,e,b){var d=[];g(a,e).forEach(function(a){d.push({op:"remove",path:b.add(a).toString()})});
g(e,a).forEach(function(a){d.push({op:"add",path:b.add(a).toString(),value:e[a]})});h([a,e]).forEach(function(f){f=c(a[f],e[f],b.add(f));Array.prototype.push.apply(d,f)});return d}function c(c,b,d){var g=k(c),h=k(b);if("array"==g&&"array"==h)return f(c,b,d);if("object"==g&&"object"==h)return a(c,b,d);g=[];e(c,b)||g.push({op:"replace",path:d.toString(),value:b});return g}b.diffAny=c;Object.defineProperty(b,"__esModule",{value:!0});var e=d("./equal").compare},{"./equal":2}],2:[function(d,l,b){function g(a,
c){for(var e=[],m=0,b=a.length;m<b;m++)e.push([a[m],c[m]]);return e}function h(a,c){return a.length!==c.length?!1:g(a,c).every(function(a){return f(a[0],a[1])})}function k(a,c){var e=Object.keys(a),b=Object.keys(c);return h(e,b)?e.every(function(e){return f(a[e],c[e])}):!1}function f(a,c){return a===c?!0:Array.isArray(a)&&Array.isArray(c)?h(a,c):Object(a)===a&&Object(c)===c?k(a,c):!1}b.compare=f;Object.defineProperty(b,"__esModule",{value:!0})},{}],3:[function(d,l,b){var g=function a(c,e,b){var d=
Object.getOwnPropertyDescriptor(c,e);if(void 0===d)return c=Object.getPrototypeOf(c),null===c?void 0:a(c,e,b);if("value"in d&&d.writable)return d.value;e=d.get;return void 0===e?void 0:e.call(b)},h=function(a,c){if("function"!==typeof c&&null!==c)throw new TypeError("Super expression must either be null or a function, not "+typeof c);a.prototype=Object.create(c&&c.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});c&&(a.__proto__=c)},k=function(a,c){if(!(a instanceof c))throw new TypeError("Cannot call a class as a function");
};Object.defineProperty(b,"__esModule",{value:!0});b.MissingError=function(a){function c(a){k(this,c);g(Object.getPrototypeOf(c.prototype),"constructor",this).call(this,"Value required at path: "+a);this.name=this.constructor.name;this.path=a}h(c,a);return c}(Error);b.InvalidOperationError=function(a){function c(a){k(this,c);g(Object.getPrototypeOf(c.prototype),"constructor",this).call(this,"Invalid operation: "+a);this.name=this.constructor.name;this.op=a}h(c,a);return c}(Error);b.TestError=function(a){function c(a,
b){k(this,c);g(Object.getPrototypeOf(c.prototype),"constructor",this).call(this,"Test failed: "+a+" != "+b);this.name=this.constructor.name;this.actual=a;this.expected=b}h(c,a);return c}(Error)},{}],4:[function(d,l,b){b.applyPatch=function(a,c){return c.map(function(e){var c=k[e.op];return void 0===c?new g(e.op):c(a,e)})};b.createPatch=function(a,c){var e=new h,e=f(a,c,e);e.forEach(function(a){a.path=a.path.toString()});return e};Object.defineProperty(b,"__esModule",{value:!0});var g=d("./errors").InvalidOperationError,
h=d("./pointer").Pointer,k=function(a){return a&&a.__esModule?a:{"default":a}}(d("./patch")),f=d("./diff").diffAny;d=function(a){return a&&a.__esModule?a["default"]:a}(d("./package")).version;b.version=d},{"./diff":1,"./errors":3,"./package":5,"./patch":6,"./pointer":7}],5:[function(d,l,b){l.exports={name:"rfc6902",version:"1.1.0",description:"Complete implementation of RFC6902 (patch and diff)",keywords:["json","patch","diff","rfc6902"],homepage:"https://github.com/chbrown/rfc6902",repository:{type:"git",
url:"https://github.com/chbrown/rfc6902.git"},author:"Christopher Brown <io@henrian.com> (http://henrian.com)",license:"MIT",main:"./rfc6902.js",devDependencies:{"babel-core":"^5.0.0",babelify:"^5.0.0",browserify:"12.0.1",coveralls:"*",derequire:"2.0.3",istanbul:"*","js-yaml":"*",mocha:"*","mocha-lcov-reporter":"*",typescript:"*"},scripts:{test:"make test"}}},{}],6:[function(d,l,b){function g(a,c,b){Array.isArray(a)?"-"==c?a.push(b):a.splice(c,0,b):a[c]=b}function h(a,c){Array.isArray(a)?a.splice(c,
1):delete a[c]}b.add=function(c,b){var d=k.fromJSON(b.path).evaluate(c);if(void 0===d.parent)return new a(b.path);g(d.parent,d.key,b.value);return null};b.remove=function(c,b){var d=k.fromJSON(b.path).evaluate(c);if(void 0===d.value)return new a(b.path);h(d.parent,d.key);return null};b.replace=function(c,b){var d=k.fromJSON(b.path).evaluate(c);if(void 0===d.value)return new a(b.path);d.parent[d.key]=b.value;return null};b.move=function(c,b){var d=k.fromJSON(b.from).evaluate(c);if(void 0===d.value)return new a(b.from);
var f=k.fromJSON(b.path).evaluate(c);if(void 0===f.parent)return new a(b.path);h(d.parent,d.key);g(f.parent,f.key,d.value);return null};b.copy=function(c,b){var d=k.fromJSON(b.from).evaluate(c);if(void 0===d.value)return new a(b.from);var f=k.fromJSON(b.path).evaluate(c);if(void 0===f.parent)return new a(b.path);h(d.parent,d.key);g(f.parent,f.key,d.value);return null};b.test=function(a,b){var d=k.fromJSON(b.path).evaluate(a);return f(d.value,b.value)?null:new c(d.value,b.value)};Object.defineProperty(b,
"__esModule",{value:!0});var k=d("./pointer").Pointer,f=d("./equal").compare;d=d("./errors");var a=d.MissingError,c=d.TestError},{"./equal":2,"./errors":3,"./pointer":7}],7:[function(d,l,b){function g(b){return b.replace(/~1/g,"/").replace(/~0/g,"~")}function h(b){return b.replace(/~/g,"~0").replace(/\//g,"~1")}var k=function(){function b(a,c){for(var d in c){var f=c[d];f.configurable=!0;f.value&&(f.writable=!0)}Object.defineProperties(a,c)}return function(a,c,d){c&&b(a.prototype,c);d&&b(a,d);return a}}();
Object.defineProperty(b,"__esModule",{value:!0});b.Pointer=function(){function b(a){a=void 0===a?[""]:a;if(!(this instanceof b))throw new TypeError("Cannot call a class as a function");this.tokens=a}k(b,{toString:{value:function(){return this.tokens.map(h).join("/")}},evaluate:{value:function(a){for(var b=null,d=null,f=1,g=this.tokens.length;f<g;f++)b=a,d=this.tokens[f],a=(b||{})[d];return{parent:b,key:d,value:a}}},push:{value:function(a){this.tokens.push(a)}},add:{value:function(a){a=this.tokens.concat(String(a));
return new b(a)}}},{fromJSON:{value:function(a){var c=a.split("/").map(g);if(""!==c[0])throw Error("Invalid JSON Pointer: "+a);return new b(c)}}});return b}()},{}]},{},[4])(4)});
(function(p){"object"===typeof exports&&"undefined"!==typeof module?module.exports=p():"function"===typeof define&&define.amd?define([],p):("undefined"!==typeof window?window:"undefined"!==typeof global?global:"undefined"!==typeof self?self:this).rfc6902=p()})(function(){return function g(m,c,h){function l(a,b){if(!c[a]){if(!m[a]){var d="function"==typeof require&&require;if(!b&&d)return d(a,!0);if(f)return f(a,!0);d=Error("Cannot find module '"+a+"'");throw d.code="MODULE_NOT_FOUND",d;}d=c[a]={exports:{}};
m[a][0].call(d.exports,function(d){var b=m[a][1][d];return l(b?b:d)},d,d.exports,g,m,c,h)}return c[a].exports}for(var f="function"==typeof require&&require,e=0;e<h.length;e++)l(h[e]);return l}({1:[function(g,m,c){function h(a,d){var b={},k;for(k in a)b[k]=1;for(var n in d)delete b[n];return Object.keys(b)}function l(a){var d={};a.forEach(function(a){for(var b in a)d[b]=(d[b]||0)+1});a=a.length;for(var b in d)d[b]<a&&delete d[b];return Object.keys(d)}function f(a){return void 0===a?"undefined":null===
a?"null":Array.isArray(a)?"array":typeof a}function e(a,c,e){function f(d,b){var k=g[d+","+b];if(void 0===k){if(n(a[d-1],c[b-1]))k=f(d-1,b-1);else{k=[];if(0<d){var e=f(d-1,b);k.push({operations:e.operations.concat({op:"remove",index:d-1}),cost:e.cost+1})}0<b&&(e=f(d,b-1),k.push({operations:e.operations.concat({op:"add",index:d-1,value:c[b-1]}),cost:e.cost+1}));0<d&&0<b&&(e=f(d-1,b-1),k.push({operations:e.operations.concat({op:"replace",index:d-1,original:a[d-1],value:c[b-1]}),cost:e.cost+1}));k=k.sort(function(a,
d){return a.cost-d.cost})[0]}g[d+","+b]=k}return k}var g={"0,0":{operations:[],cost:0}},h=f(a.length,c.length).operations.reduce(function(n,c){var f=d(n,2),g=f[0],f=f[1];if("add"===c.op){var h=c.index+1+f,h={op:c.op,path:e.add(h<a.length?String(h):"-").toString(),value:c.value};return[g.concat(h),f+1]}if("remove"===c.op)return h={op:c.op,path:e.add(String(c.index+f)).toString()},[g.concat(h),f-1];h=e.add(String(c.index+f));h=b(c.original,c.value,h);return[g.concat.apply(g,k(h)),f]},[[],0]);return d(h,
2)[0]}function a(a,d,c){var n=[];h(a,d).forEach(function(a){n.push({op:"remove",path:c.add(a).toString()})});h(d,a).forEach(function(a){n.push({op:"add",path:c.add(a).toString(),value:d[a]})});l([a,d]).forEach(function(f){n.push.apply(n,k(b(a[f],d[f],c.add(f))))});return n}function b(d,b,k){var c=f(d),h=f(b);if("array"==c&&"array"==h)return e(d,b,k);if("object"==c&&"object"==h)return a(d,b,k);d=n(d,b)?[]:[{op:"replace",path:k.toString(),value:b}];return d}var d=function(a,d){if(Array.isArray(a))return a;
if(Symbol.iterator in Object(a)){for(var b=[],k=a[Symbol.iterator](),c;!(c=k.next()).done&&(b.push(c.value),!d||b.length!==d););return b}throw new TypeError("Invalid attempt to destructure non-iterable instance");},k=function(a){if(Array.isArray(a)){for(var d=0,b=Array(a.length);d<a.length;d++)b[d]=a[d];return b}return Array.from(a)};c.diffAny=b;Object.defineProperty(c,"__esModule",{value:!0});var n=g("./equal").compare},{"./equal":2}],2:[function(g,m,c){function h(a,b){for(var d=[],k=0,c=a.length;k<
c;k++)d.push([a[k],b[k]]);return d}function l(a,b){return a.length!==b.length?!1:h(a,b).every(function(a){return e(a[0],a[1])})}function f(a,b){var d=Object.keys(a),k=Object.keys(b);return l(d,k)?d.every(function(d){return e(a[d],b[d])}):!1}function e(a,b){return a===b?!0:Array.isArray(a)&&Array.isArray(b)?l(a,b):Object(a)===a&&Object(b)===b?f(a,b):!1}c.compare=e;Object.defineProperty(c,"__esModule",{value:!0})},{}],3:[function(g,m,c){var h=function a(b,d,k){var c=Object.getOwnPropertyDescriptor(b,
d);if(void 0===c)return b=Object.getPrototypeOf(b),null===b?void 0:a(b,d,k);if("value"in c&&c.writable)return c.value;d=c.get;return void 0===d?void 0:d.call(k)},l=function(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(a.__proto__=b)},f=function(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");
};Object.defineProperty(c,"__esModule",{value:!0});c.MissingError=function(a){function b(a){f(this,b);h(Object.getPrototypeOf(b.prototype),"constructor",this).call(this,"Value required at path: "+a);this.name=this.constructor.name;this.path=a}l(b,a);return b}(Error);c.InvalidOperationError=function(a){function b(a){f(this,b);h(Object.getPrototypeOf(b.prototype),"constructor",this).call(this,"Invalid operation: "+a);this.name=this.constructor.name;this.op=a}l(b,a);return b}(Error);c.TestError=function(a){function b(a,
k){f(this,b);h(Object.getPrototypeOf(b.prototype),"constructor",this).call(this,"Test failed: "+a+" != "+k);this.name=this.constructor.name;this.actual=a;this.expected=k}l(b,a);return b}(Error)},{}],4:[function(g,m,c){c.applyPatch=function(a,b){return b.map(function(d){var b=f[d.op];return void 0===b?new h(d.op):b(a,d)})};c.createPatch=function(a,b){var d=new l,d=e(a,b,d);d.forEach(function(a){a.path=a.path.toString()});return d};Object.defineProperty(c,"__esModule",{value:!0});var h=g("./errors").InvalidOperationError,
l=g("./pointer").Pointer,f=function(a){return a&&a.__esModule?a:{"default":a}}(g("./patch")),e=g("./diff").diffAny;g=function(a){return a&&a.__esModule?a["default"]:a}(g("./package")).version;c.version=g},{"./diff":1,"./errors":3,"./package":5,"./patch":6,"./pointer":7}],5:[function(g,m,c){m.exports={name:"rfc6902",version:"1.1.2",description:"Complete implementation of RFC6902 (patch and diff)",keywords:["json","patch","diff","rfc6902"],homepage:"https://github.com/chbrown/rfc6902",repository:{type:"git",
url:"https://github.com/chbrown/rfc6902.git"},author:"Christopher Brown <io@henrian.com> (http://henrian.com)",license:"MIT",main:"./rfc6902.js",devDependencies:{"babel-core":"^5.0.0",babelify:"^5.0.0",browserify:"12.0.1",coveralls:"*",derequire:"2.0.3",istanbul:"*","js-yaml":"*",mocha:"*","mocha-lcov-reporter":"*",typescript:"*"},scripts:{test:"make test"}}},{}],6:[function(g,m,c){function h(a,b,c){Array.isArray(a)?"-"==b?a.push(c):a.splice(b,0,c):a[b]=c}function l(a,b){Array.isArray(a)?a.splice(b,
1):delete a[b]}c.add=function(b,c){var e=f.fromJSON(c.path).evaluate(b);if(void 0===e.parent)return new a(c.path);h(e.parent,e.key,c.value);return null};c.remove=function(b,c){var e=f.fromJSON(c.path).evaluate(b);if(void 0===e.value)return new a(c.path);l(e.parent,e.key);return null};c.replace=function(b,c){var e=f.fromJSON(c.path).evaluate(b);if(void 0===e.value)return new a(c.path);e.parent[e.key]=c.value;return null};c.move=function(b,c){var e=f.fromJSON(c.from).evaluate(b);if(void 0===e.value)return new a(c.from);
var g=f.fromJSON(c.path).evaluate(b);if(void 0===g.parent)return new a(c.path);l(e.parent,e.key);h(g.parent,g.key,e.value);return null};c.copy=function(b,c){var e=f.fromJSON(c.from).evaluate(b);if(void 0===e.value)return new a(c.from);var g=f.fromJSON(c.path).evaluate(b);if(void 0===g.parent)return new a(c.path);l(e.parent,e.key);h(g.parent,g.key,e.value);return null};c.test=function(a,c){var g=f.fromJSON(c.path).evaluate(a);return e(g.value,c.value)?null:new b(g.value,c.value)};Object.defineProperty(c,
"__esModule",{value:!0});var f=g("./pointer").Pointer,e=g("./equal").compare;g=g("./errors");var a=g.MissingError,b=g.TestError},{"./equal":2,"./errors":3,"./pointer":7}],7:[function(g,m,c){function h(c){return c.replace(/~1/g,"/").replace(/~0/g,"~")}function l(c){return c.replace(/~/g,"~0").replace(/\//g,"~1")}var f=function(){function c(a,b){for(var d in b){var e=b[d];e.configurable=!0;e.value&&(e.writable=!0)}Object.defineProperties(a,b)}return function(a,b,d){b&&c(a.prototype,b);d&&c(a,d);return a}}();
Object.defineProperty(c,"__esModule",{value:!0});c.Pointer=function(){function c(a){a=void 0===a?[""]:a;if(!(this instanceof c))throw new TypeError("Cannot call a class as a function");this.tokens=a}f(c,{toString:{value:function(){return this.tokens.map(l).join("/")}},evaluate:{value:function(a){for(var b=null,c=null,e=1,f=this.tokens.length;e<f;e++)b=a,c=this.tokens[e],a=(b||{})[c];return{parent:b,key:c,value:a}}},push:{value:function(a){this.tokens.push(a)}},add:{value:function(a){a=this.tokens.concat(String(a));
return new c(a)}}},{fromJSON:{value:function(a){var b=a.split("/").map(h);if(""!==b[0])throw Error("Invalid JSON Pointer: "+a);return new c(b)}}});return c}()},{}]},{},[4])(4)});
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