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.2.0 to 1.2.1

36

diff.d.ts

@@ -54,2 +54,38 @@ import { Pointer } from './pointer';

export declare type Operation = AddOperation | RemoveOperation | ReplaceOperation | MoveOperation | CopyOperation | TestOperation;
/**
subtract(a, b) returns the keys in `a` that are not in `b`.
*/
export declare function subtract<A, B>(a: A, b: B): string[];
/**
intersection(objects) returns the keys that shared by all given `objects`.
*/
export declare function intersection<T>(objects: T[]): string[];
export declare function objectType(object: any): string;
/**
Array-diffing smarter (levenshtein-like) diffing here
To get from the input ABC to the output AZ we could just delete all the input
and say "insert A, insert Z" and be done with it. That's what we do if the
input is empty. But we can be smarter.
output
A Z
- -
[0] 1 2
input A | 1 [0] 1
B | 2 [1] 1
C | 3 2 [2]
1) start at 0,0 (+0)
2) keep A (+0)
3) remove B (+1)
4) replace C with Z (+1)
if input (source) is empty, they'll all be in the top row, just a bunch of
additions. If the output is empty, everything will be in the left column, as a
bunch of deletions.
*/
export declare function diffArrays<T>(input: T[], output: T[], ptr: Pointer): Operation[];
export declare function diffObjects(input: any, output: any, ptr: Pointer): Operation[];
export declare function diffValues(input: any, output: any, ptr: Pointer): Operation[];
export declare function diffAny(input: any, output: any, ptr: Pointer): Operation[];

12

diff.js

@@ -5,3 +5,3 @@ import { compare } from './equal';

*/
function subtract(a, b) {
export function subtract(a, b) {
const obj = {};

@@ -19,3 +19,3 @@ for (let add_key in a) {

*/
function intersection(objects) {
export function intersection(objects) {
// initialize like union()

@@ -37,3 +37,3 @@ const key_counts = {};

}
function objectType(object) {
export function objectType(object) {
if (object === undefined) {

@@ -83,3 +83,3 @@ return 'undefined';

*/
function diffArrays(input, output, ptr) {
export function diffArrays(input, output, ptr) {
// set up cost matrix (very simple initialization: just a map)

@@ -194,3 +194,3 @@ const memo = {

}
function diffObjects(input, output, ptr) {
export function diffObjects(input, output, ptr) {
// if a key is in input but not output -> remove it

@@ -211,3 +211,3 @@ const operations = [];

}
function diffValues(input, output, ptr) {
export function diffValues(input, output, ptr) {
if (!compare(input, output)) {

@@ -214,0 +214,0 @@ return [{ op: 'replace', path: ptr.toString(), value: output }];

{
"name": "rfc6902",
"version": "1.2.0",
"version": "1.2.1",
"description": "Complete implementation of RFC6902 (patch and diff)",

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

@@ -8,2 +8,40 @@ (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){

/**
subtract(a, b) returns the keys in `a` that are not in `b`.
*/
exports.subtract = subtract;
/**
intersection(objects) returns the keys that shared by all given `objects`.
*/
exports.intersection = intersection;
exports.objectType = objectType;
/**
Array-diffing smarter (levenshtein-like) diffing here
To get from the input ABC to the output AZ we could just delete all the input
and say "insert A, insert Z" and be done with it. That's what we do if the
input is empty. But we can be smarter.
output
A Z
- -
[0] 1 2
input A | 1 [0] 1
B | 2 [1] 1
C | 3 2 [2]
1) start at 0,0 (+0)
2) keep A (+0)
3) remove B (+1)
4) replace C with Z (+1)
if input (source) is empty, they'll all be in the top row, just a bunch of
additions. If the output is empty, everything will be in the left column, as a
bunch of deletions.
*/
exports.diffArrays = diffArrays;
exports.diffObjects = diffObjects;
exports.diffValues = diffValues;
exports.diffAny = diffAny;

@@ -16,5 +54,2 @@ Object.defineProperty(exports, "__esModule", {

/**
subtract(a, b) returns the keys in `a` that are not in `b`.
*/
function subtract(a, b) {

@@ -30,5 +65,3 @@ var obj = {};

}
/**
intersection(objects) returns the keys that shared by all given `objects`.
*/
function intersection(objects) {

@@ -51,2 +84,3 @@ // initialize like union()

}
function objectType(object) {

@@ -64,2 +98,3 @@ if (object === undefined) {

}
function isArrayAdd(array_operation) {

@@ -74,26 +109,2 @@ return array_operation.op === "add";

}
/**
Array-diffing smarter (levenshtein-like) diffing here
To get from the input ABC to the output AZ we could just delete all the input
and say "insert A, insert Z" and be done with it. That's what we do if the
input is empty. But we can be smarter.
output
A Z
- -
[0] 1 2
input A | 1 [0] 1
B | 2 [1] 1
C | 3 2 [2]
1) start at 0,0 (+0)
2) keep A (+0)
3) remove B (+1)
4) replace C with Z (+1)
if input (source) is empty, they'll all be in the top row, just a bunch of
additions. If the output is empty, everything will be in the left column, as a
bunch of deletions.
*/
function diffArrays(input, output, ptr) {

@@ -210,2 +221,3 @@ // set up cost matrix (very simple initialization: just a map)

}
function diffObjects(input, output, ptr) {

@@ -227,2 +239,3 @@ // if a key is in input but not output -> remove it

}
function diffValues(input, output, ptr) {

@@ -229,0 +242,0 @@ if (!compare(input, output)) {

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

(function(q){"object"===typeof exports&&"undefined"!==typeof module?module.exports=q():"function"===typeof define&&define.amd?define([],q):("undefined"!==typeof window?window:"undefined"!==typeof global?global:"undefined"!==typeof self?self:this).rfc6902=q()})(function(){return function m(n,d,k){function l(a,b){if(!d[a]){if(!n[a]){var c="function"==typeof require&&require;if(!b&&c)return c(a,!0);if(g)return g(a,!0);c=Error("Cannot find module '"+a+"'");throw c.code="MODULE_NOT_FOUND",c;}c=d[a]={exports:{}};
n[a][0].call(c.exports,function(c){var b=n[a][1][c];return l(b?b:c)},c,c.exports,m,n,d,k)}return d[a].exports}for(var g="function"==typeof require&&require,h=0;h<k.length;h++)l(k[h]);return l}({1:[function(m,n,d){function k(a,c){var b={},e;for(e in a)b[e]=1;for(var f in c)delete b[f];return Object.keys(b)}function l(a){var c={};a.forEach(function(a){for(var b in a)c[b]=(c[b]||0)+1});a=a.length;for(var b in c)c[b]<a&&delete c[b];return Object.keys(c)}function g(a){return void 0===a?"undefined":null===
a?"null":Array.isArray(a)?"array":typeof a}function h(a,d,h){function g(c,b){var e=k[c+","+b];if(void 0===e){if(f(a[c-1],d[b-1]))e=g(c-1,b-1);else{e=[];if(0<c){var h=g(c-1,b);e.push({operations:h.operations.concat({op:"remove",index:c-1}),cost:h.cost+1})}0<b&&(h=g(c,b-1),e.push({operations:h.operations.concat({op:"add",index:c-1,value:d[b-1]}),cost:h.cost+1}));0<c&&0<b&&(h=g(c-1,b-1),e.push({operations:h.operations.concat({op:"replace",index:c-1,original:a[c-1],value:d[b-1]}),cost:h.cost+1}));e=e.sort(function(a,
c){return a.cost-c.cost})[0]}k[c+","+b]=e}return e}var k={"0,0":{operations:[],cost:0}},l=isNaN(a.length)||0>=a.length?0:a.length,m=isNaN(d.length)||0>=d.length?0:d.length,m=g(l,m).operations.reduce(function(a,f){var d=c(a,2),g=d[0],d=d[1];if("add"===f.op){var p=f.index+1+d,p={op:f.op,path:h.add(p<l?String(p):"-").toString(),value:f.value};return[g.concat(p),d+1]}if("remove"===f.op)return p={op:f.op,path:h.add(String(f.index+d)).toString()},[g.concat(p),d-1];p=h.add(String(f.index+d));p=b(f.original,
f.value,p);return[g.concat.apply(g,e(p)),d]},[[],0]);return c(m,2)[0]}function a(a,c,f){var d=[];k(a,c).forEach(function(a){d.push({op:"remove",path:f.add(a).toString()})});k(c,a).forEach(function(a){d.push({op:"add",path:f.add(a).toString(),value:c[a]})});l([a,c]).forEach(function(h){d.push.apply(d,e(b(a[h],c[h],f.add(h))))});return d}function b(c,b,e){var d=g(c),k=g(b);if("array"==d&&"array"==k)return h(c,b,e);if("object"==d&&"object"==k)return a(c,b,e);c=f(c,b)?[]:[{op:"replace",path:e.toString(),
value:b}];return c}var c=function(a,c){if(Array.isArray(a))return a;if(Symbol.iterator in Object(a)){for(var b=[],e=a[Symbol.iterator](),f;!(f=e.next()).done&&(b.push(f.value),!c||b.length!==c););return b}throw new TypeError("Invalid attempt to destructure non-iterable instance");},e=function(a){if(Array.isArray(a)){for(var c=0,b=Array(a.length);c<a.length;c++)b[c]=a[c];return b}return Array.from(a)};d.diffAny=b;Object.defineProperty(d,"__esModule",{value:!0});var f=m("./equal").compare},{"./equal":2}],
2:[function(m,n,d){function k(a,b){for(var c=[],e=0,f=a.length;e<f;e++)c.push([a[e],b[e]]);return c}function l(a,b){return a.length!==b.length?!1:k(a,b).every(function(a){return h(a[0],a[1])})}function g(a,b){var c=Object.keys(a),e=Object.keys(b);return l(c,e)?c.every(function(c){return h(a[c],b[c])}):!1}function h(a,b){return a===b?!0:Array.isArray(a)&&Array.isArray(b)?l(a,b):Object(a)===a&&Object(b)===b?g(a,b):!1}d.compare=h;Object.defineProperty(d,"__esModule",{value:!0})},{}],3:[function(m,n,
d){var k=function a(b,c,e){var f=Object.getOwnPropertyDescriptor(b,c);if(void 0===f)return b=Object.getPrototypeOf(b),null===b?void 0:a(b,c,e);if("value"in f&&f.writable)return f.value;c=f.get;return void 0===c?void 0:c.call(e)},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)},g=function(a,
b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");};Object.defineProperty(d,"__esModule",{value:!0});d.MissingError=function(a){function b(a){g(this,b);k(Object.getPrototypeOf(b.prototype),"constructor",this).call(this,"Value required at path: "+a);this.path=a;this.name=this.constructor.name}l(b,a);return b}(Error);d.InvalidOperationError=function(a){function b(a){g(this,b);k(Object.getPrototypeOf(b.prototype),"constructor",this).call(this,"Invalid operation: "+a);this.op=
a;this.name=this.constructor.name}l(b,a);return b}(Error);d.TestError=function(a){function b(a,e){g(this,b);k(Object.getPrototypeOf(b.prototype),"constructor",this).call(this,"Test failed: "+a+" != "+e);this.actual=a;this.expected=e;this.name=this.constructor.name;this.actual=a;this.expected=e}l(b,a);return b}(Error)},{}],4:[function(m,n,d){d.applyPatch=function(a,b){return b.map(function(c){var b=g[c.op];return void 0===b?new k(c.op):b(a,c)})};d.createPatch=function(a,b){var c=new l;return h(a,b,
c)};Object.defineProperty(d,"__esModule",{value:!0});var k=m("./errors").InvalidOperationError,l=m("./pointer").Pointer,g=function(a){return a&&a.__esModule?a:{"default":a}}(m("./patch")),h=m("./diff").diffAny},{"./diff":1,"./errors":3,"./patch":5,"./pointer":6}],5:[function(m,n,d){function k(a,b,f){Array.isArray(a)?"-"==b?a.push(f):a.splice(b,0,f):a[b]=f}function l(a,b){Array.isArray(a)?a.splice(b,1):delete a[b]}d.add=function(b,e){var f=g.fromJSON(e.path).evaluate(b);if(void 0===f.parent)return new a(e.path);
k(f.parent,f.key,e.value);return null};d.remove=function(b,e){var f=g.fromJSON(e.path).evaluate(b);if(void 0===f.value)return new a(e.path);l(f.parent,f.key);return null};d.replace=function(b,e){var f=g.fromJSON(e.path).evaluate(b);if(void 0===f.value)return new a(e.path);f.parent[f.key]=e.value;return null};d.move=function(b,e){var f=g.fromJSON(e.from).evaluate(b);if(void 0===f.value)return new a(e.from);var d=g.fromJSON(e.path).evaluate(b);if(void 0===d.parent)return new a(e.path);l(f.parent,f.key);
k(d.parent,d.key,f.value);return null};d.copy=function(b,e){var f=g.fromJSON(e.from).evaluate(b);if(void 0===f.value)return new a(e.from);var d=g.fromJSON(e.path).evaluate(b);if(void 0===d.parent)return new a(e.path);l(f.parent,f.key);k(d.parent,d.key,f.value);return null};d.test=function(a,e){var d=g.fromJSON(e.path).evaluate(a);return h(d.value,e.value)?null:new b(d.value,e.value)};Object.defineProperty(d,"__esModule",{value:!0});var g=m("./pointer").Pointer,h=m("./equal").compare;m=m("./errors");
var a=m.MissingError,b=m.TestError},{"./equal":2,"./errors":3,"./pointer":6}],6:[function(m,n,d){function k(d){return d.replace(/~1/g,"/").replace(/~0/g,"~")}function l(d){return d.replace(/~/g,"~0").replace(/\//g,"~1")}var g=function(){function d(a,b){for(var c in b){var e=b[c];e.configurable=!0;e.value&&(e.writable=!0)}Object.defineProperties(a,b)}return function(a,b,c){b&&d(a.prototype,b);c&&d(a,c);return a}}();Object.defineProperty(d,"__esModule",{value:!0});d.Pointer=function(){function d(a){a=
void 0===a?[""]:a;if(!(this instanceof d))throw new TypeError("Cannot call a class as a function");this.tokens=a}g(d,{toString:{value:function(){return this.tokens.map(l).join("/")}},evaluate:{value:function(a){for(var b=null,c=null,d=1,f=this.tokens.length;d<f;d++)b=a,c=this.tokens[d],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 d(a)}}},{fromJSON:{value:function(a){var b=a.split("/").map(k);
if(""!==b[0])throw Error("Invalid JSON Pointer: "+a);return new d(b)}}});return d}()},{}]},{},[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 m(n,c,l){function g(a,b){if(!c[a]){if(!n[a]){var e="function"==typeof require&&require;if(!b&&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=c[a]={exports:{}};
n[a][0].call(e.exports,function(e){var b=n[a][1][e];return g(b?b:e)},e,e.exports,m,n,c,l)}return c[a].exports}for(var k="function"==typeof require&&require,h=0;h<l.length;h++)g(l[h]);return g}({1:[function(m,n,c){function l(a,e){var b={},d;for(d in a)b[d]=1;for(var f in e)delete b[f];return Object.keys(b)}function g(a){var e={};a.forEach(function(a){for(var b in a)e[b]=(e[b]||0)+1});a=a.length;for(var b in e)e[b]<a&&delete e[b];return Object.keys(e)}function k(a){return void 0===a?"undefined":null===
a?"null":Array.isArray(a)?"array":typeof a}function h(a,b,c){function h(e,d){var f=k[e+","+d];if(void 0===f){if(q(a[e-1],b[d-1]))f=h(e-1,d-1);else{f=[];if(0<e){var c=h(e-1,d);f.push({operations:c.operations.concat({op:"remove",index:e-1}),cost:c.cost+1})}0<d&&(c=h(e,d-1),f.push({operations:c.operations.concat({op:"add",index:e-1,value:b[d-1]}),cost:c.cost+1}));0<e&&0<d&&(c=h(e-1,d-1),f.push({operations:c.operations.concat({op:"replace",index:e-1,original:a[e-1],value:b[d-1]}),cost:c.cost+1}));f=f.sort(function(a,
e){return a.cost-e.cost})[0]}k[e+","+d]=f}return f}var k={"0,0":{operations:[],cost:0}},l=isNaN(a.length)||0>=a.length?0:a.length,g=isNaN(b.length)||0>=b.length?0:b.length,g=h(l,g).operations.reduce(function(a,b){var h=d(a,2),k=h[0],h=h[1];if("add"===b.op){var g=b.index+1+h,g={op:b.op,path:c.add(g<l?String(g):"-").toString(),value:b.value};return[k.concat(g),h+1]}if("remove"===b.op)return g={op:b.op,path:c.add(String(b.index+h)).toString()},[k.concat(g),h-1];g=c.add(String(b.index+h));g=e(b.original,
b.value,g);return[k.concat.apply(k,f(g)),h]},[[],0]);return d(g,2)[0]}function a(a,b,d){var c=[];l(a,b).forEach(function(a){c.push({op:"remove",path:d.add(a).toString()})});l(b,a).forEach(function(a){c.push({op:"add",path:d.add(a).toString(),value:b[a]})});g([a,b]).forEach(function(h){c.push.apply(c,f(e(a[h],b[h],d.add(h))))});return c}function b(a,b,e){return q(a,b)?[]:[{op:"replace",path:e.toString(),value:b}]}function e(e,d,f){var c=k(e),g=k(d);return"array"==c&&"array"==g?h(e,d,f):"object"==c&&
"object"==g?a(e,d,f):b(e,d,f)}var d=function(a,e){if(Array.isArray(a))return a;if(Symbol.iterator in Object(a)){for(var b=[],d=a[Symbol.iterator](),f;!(f=d.next()).done&&(b.push(f.value),!e||b.length!==e););return b}throw new TypeError("Invalid attempt to destructure non-iterable instance");},f=function(a){if(Array.isArray(a)){for(var b=0,e=Array(a.length);b<a.length;b++)e[b]=a[b];return e}return Array.from(a)};c.subtract=l;c.intersection=g;c.objectType=k;c.diffArrays=h;c.diffObjects=a;c.diffValues=
b;c.diffAny=e;Object.defineProperty(c,"__esModule",{value:!0});var q=m("./equal").compare},{"./equal":2}],2:[function(m,n,c){function l(a,b){for(var e=[],d=0,f=a.length;d<f;d++)e.push([a[d],b[d]]);return e}function g(a,b){return a.length!==b.length?!1:l(a,b).every(function(a){return h(a[0],a[1])})}function k(a,b){var e=Object.keys(a),d=Object.keys(b);return g(e,d)?e.every(function(e){return h(a[e],b[e])}):!1}function h(a,b){return a===b?!0:Array.isArray(a)&&Array.isArray(b)?g(a,b):Object(a)===a&&
Object(b)===b?k(a,b):!1}c.compare=h;Object.defineProperty(c,"__esModule",{value:!0})},{}],3:[function(m,n,c){var l=function a(b,e,d){var f=Object.getOwnPropertyDescriptor(b,e);if(void 0===f)return b=Object.getPrototypeOf(b),null===b?void 0:a(b,e,d);if("value"in f&&f.writable)return f.value;e=f.get;return void 0===e?void 0:e.call(d)},g=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)},k=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){k(this,b);l(Object.getPrototypeOf(b.prototype),"constructor",this).call(this,"Value required at path: "+a);this.path=a;this.name=this.constructor.name}g(b,a);return b}(Error);c.InvalidOperationError=function(a){function b(a){k(this,
b);l(Object.getPrototypeOf(b.prototype),"constructor",this).call(this,"Invalid operation: "+a);this.op=a;this.name=this.constructor.name}g(b,a);return b}(Error);c.TestError=function(a){function b(a,d){k(this,b);l(Object.getPrototypeOf(b.prototype),"constructor",this).call(this,"Test failed: "+a+" != "+d);this.actual=a;this.expected=d;this.name=this.constructor.name;this.actual=a;this.expected=d}g(b,a);return b}(Error)},{}],4:[function(m,n,c){c.applyPatch=function(a,b){return b.map(function(b){var d=
k[b.op];return void 0===d?new l(b.op):d(a,b)})};c.createPatch=function(a,b){var e=new g;return h(a,b,e)};Object.defineProperty(c,"__esModule",{value:!0});var l=m("./errors").InvalidOperationError,g=m("./pointer").Pointer,k=function(a){return a&&a.__esModule?a:{"default":a}}(m("./patch")),h=m("./diff").diffAny},{"./diff":1,"./errors":3,"./patch":5,"./pointer":6}],5:[function(m,n,c){function l(a,b,f){Array.isArray(a)?"-"==b?a.push(f):a.splice(b,0,f):a[b]=f}function g(a,b){Array.isArray(a)?a.splice(b,
1):delete a[b]}c.add=function(b,d){var f=k.fromJSON(d.path).evaluate(b);if(void 0===f.parent)return new a(d.path);l(f.parent,f.key,d.value);return null};c.remove=function(b,d){var f=k.fromJSON(d.path).evaluate(b);if(void 0===f.value)return new a(d.path);g(f.parent,f.key);return null};c.replace=function(b,d){var f=k.fromJSON(d.path).evaluate(b);if(void 0===f.value)return new a(d.path);f.parent[f.key]=d.value;return null};c.move=function(b,d){var f=k.fromJSON(d.from).evaluate(b);if(void 0===f.value)return new a(d.from);
var c=k.fromJSON(d.path).evaluate(b);if(void 0===c.parent)return new a(d.path);g(f.parent,f.key);l(c.parent,c.key,f.value);return null};c.copy=function(b,d){var c=k.fromJSON(d.from).evaluate(b);if(void 0===c.value)return new a(d.from);var h=k.fromJSON(d.path).evaluate(b);if(void 0===h.parent)return new a(d.path);g(c.parent,c.key);l(h.parent,h.key,c.value);return null};c.test=function(a,d){var c=k.fromJSON(d.path).evaluate(a);return h(c.value,d.value)?null:new b(c.value,d.value)};Object.defineProperty(c,
"__esModule",{value:!0});var k=m("./pointer").Pointer,h=m("./equal").compare;m=m("./errors");var a=m.MissingError,b=m.TestError},{"./equal":2,"./errors":3,"./pointer":6}],6:[function(m,n,c){function l(c){return c.replace(/~1/g,"/").replace(/~0/g,"~")}function g(c){return c.replace(/~/g,"~0").replace(/\//g,"~1")}var k=function(){function c(a,b){for(var e in b){var d=b[e];d.configurable=!0;d.value&&(d.writable=!0)}Object.defineProperties(a,b)}return function(a,b,e){b&&c(a.prototype,b);e&&c(a,e);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}k(c,{toString:{value:function(){return this.tokens.map(g).join("/")}},evaluate:{value:function(a){for(var b=null,c=null,d=1,f=this.tokens.length;d<f;d++)b=a,c=this.tokens[d],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(l);if(""!==b[0])throw Error("Invalid JSON Pointer: "+a);return new c(b)}}});return c}()},{}]},{},[4])(4)});

Sorry, the diff of this file is not supported yet

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