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.0.9 to 1.1.0

tests/arrays.js

1

errors.js

@@ -1,2 +0,1 @@

/*jslint esnext: true */
export class MissingError extends Error {

@@ -3,0 +2,0 @@ constructor(path) {

@@ -1,2 +0,1 @@

/*jslint esnext: true */
import {InvalidOperationError} from './errors';

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

}
export function patch(object, patch) {
console.error('rfc6902.patch(object, patch) has been deprecated. Use rfc6902.applyPatch(object, patch) instead.');
return applyPatch(object, patch);
}

@@ -62,5 +57,1 @@ /**

}
export function diff(input, output) {
console.error('rfc6902.diff(input, output) has been deprecated. Use rfc6902.createPatch(input, output) instead.');
return createPatch(input, output);
}
{
"name": "rfc6902",
"version": "1.0.9",
"version": "1.1.0",
"description": "Complete implementation of RFC6902 (patch and diff)",

@@ -12,12 +12,14 @@ "keywords": [

"homepage": "https://github.com/chbrown/rfc6902",
"repository": "git://github.com/chbrown/rfc6902.git",
"repository": {
"type": "git",
"url": "https://github.com/chbrown/rfc6902.git"
},
"author": "Christopher Brown <io@henrian.com> (http://henrian.com)",
"license": "MIT",
"main": "./rfc6902.js",
"dependencies": {},
"devDependencies": {
"babel": "*",
"babelify": "*",
"browserify": "*",
"derequire": "*",
"babel-core": "5.8.34",
"babelify": "5.0.5",
"browserify": "12.0.1",
"derequire": "2.0.3",
"js-yaml": "*",

@@ -24,0 +26,0 @@ "mocha": "*",

@@ -1,2 +0,1 @@

/*jslint esnext: true */
import {Pointer} from './pointer';

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

@@ -66,5 +66,3 @@ # rfc6902

* Currently only demos `createPatch(input, output)` functionality.
## Determinism

@@ -98,3 +96,3 @@

- Otherwise, the parts are read from left to right, each one selecting part of the current document, and presenting only that fragment of the document to the next part.
* The <code><i>reference-token</i></code> bits are usually Object keys, but may also be decimals, to indicate array indices.
* The <code><i>reference-token</i></code> bits are usually Object keys, but may also be numerals, to indicate array indices.

@@ -183,2 +181,2 @@ E.g., consider the NPM registry:

Copyright 2014-2015 Christopher Brown. [MIT Licensed](http://opensource.org/licenses/MIT).
Copyright 2014-2015 Christopher Brown. [MIT Licensed](http://chbrown.github.io/licenses/MIT/#2014-2015).
(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';
"use strict";
Object.defineProperty(exports, '__esModule', {
exports.diffAny = diffAny;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.diffAny = diffAny;
var _equal = _dereq_('./equal');
var compare = _dereq_("./equal").compare;

@@ -52,9 +52,9 @@ function pushAll(array, items) {

if (object === undefined) {
return 'undefined';
return "undefined";
}
if (object === null) {
return 'null';
return "null";
}
if (Array.isArray(object)) {
return 'array';
return "array";
}

@@ -90,3 +90,3 @@ return typeof object;

var memo = {
'0,0': { operations: [], cost: 0 }
"0,0": { operations: [], cost: 0 }
};

@@ -103,5 +103,5 @@ /**

// memoized
var memoized = memo[i + ',' + j];
var memoized = memo[i + "," + j];
if (memoized === undefined) {
if ((0, _equal.compare)(input[i - 1], output[j - 1])) {
if (compare(input[i - 1], output[j - 1])) {
// equal (no operations => no cost)

@@ -117,7 +117,5 @@ memoized = dist(i - 1, j - 1);

operations: remove_alternative.operations.concat({
op: 'remove',
index: i - 1
}),
cost: remove_alternative.cost + 1
});
op: "remove",
index: i - 1 }),
cost: remove_alternative.cost + 1 });
}

@@ -129,8 +127,6 @@ if (j > 0) {

operations: add_alternative.operations.concat({
op: 'add',
op: "add",
index: i - 1,
value: output[j - 1]
}),
cost: add_alternative.cost + 1
});
value: output[j - 1] }),
cost: add_alternative.cost + 1 });
}

@@ -142,8 +138,6 @@ if (i > 0 && j > 0) {

operations: replace_alternative.operations.concat({
op: 'replace',
op: "replace",
index: i - 1,
value: output[j - 1]
}),
cost: replace_alternative.cost + 1
});
value: output[j - 1] }),
cost: replace_alternative.cost + 1 });
}

@@ -159,3 +153,3 @@ // the only other case, i === 0 && j === 0, has already been memoized

}
memo[i + ',' + j] = memoized;
memo[i + "," + j] = memoized;
}

@@ -167,17 +161,15 @@ return memoized;

var operations = array_operations.map(function (array_operation) {
if (array_operation.op === 'add') {
if (array_operation.op === "add") {
var padded_index = array_operation.index + 1 + padding;
var index_token = padded_index < input.length ? String(padded_index) : '-';
var index_token = padded_index < input.length ? String(padded_index) : "-";
var operation = {
op: array_operation.op,
path: ptr.add(index_token).toString(),
value: array_operation.value
};
value: array_operation.value };
padding++; // maybe only if array_operation.index > -1 ?
return operation;
} else if (array_operation.op === 'remove') {
} else if (array_operation.op === "remove") {
var operation = {
op: array_operation.op,
path: ptr.add(String(array_operation.index + padding)).toString()
};
path: ptr.add(String(array_operation.index + padding)).toString() };
padding--;

@@ -189,4 +181,3 @@ return operation;

path: ptr.add(String(array_operation.index + padding)).toString(),
value: array_operation.value
};
value: array_operation.value };
}

@@ -200,7 +191,7 @@ });

subtract(input, output).forEach(function (key) {
operations.push({ op: 'remove', path: ptr.add(key).toString() });
operations.push({ op: "remove", path: ptr.add(key).toString() });
});
// if a key is in output but not input -> add it
subtract(output, input).forEach(function (key) {
operations.push({ op: 'add', path: ptr.add(key).toString(), value: output[key] });
operations.push({ op: "add", path: ptr.add(key).toString(), value: output[key] });
});

@@ -215,4 +206,4 @@ // if a key is in both, diff it recursively

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

@@ -225,6 +216,6 @@ return operations;

var output_type = objectType(output);
if (input_type == 'array' && output_type == 'array') {
if (input_type == "array" && output_type == "array") {
return diffArrays(input, output, ptr);
}
if (input_type == 'object' && output_type == 'object') {
if (input_type == "object" && output_type == "object") {
return diffObjects(input, output, ptr);

@@ -238,11 +229,34 @@ }

},{"./equal":2}],2:[function(_dereq_,module,exports){
/**
zip(a, b) assumes that a.length === b.length.
`compare()` returns true if `left` and `right` are materially equal
(i.e., would produce equivalent JSON), false otherwise.
> Here, "equal" means that the value at the target location and the
> value conveyed by "value" are of the same JSON type, and that they
> are considered equal by the following rules for that type:
> o strings: are considered equal if they contain the same number of
> Unicode characters and their code points are byte-by-byte equal.
> o numbers: are considered equal if their values are numerically
> equal.
> o arrays: are considered equal if they contain the same number of
> values, and if each value can be considered equal to the value at
> the corresponding position in the other array, using this list of
> type-specific rules.
> o objects: are considered equal if they contain the same number of
> members, and if each member can be considered equal to a member in
> the other object, by comparing their keys (as strings) and their
> values (using this list of type-specific rules).
> o literals (false, true, and null): are considered equal if they are
> the same.
*/
"use strict";
exports.compare = compare;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.compare = compare;
/**
zip(a, b) assumes that a.length === b.length.
*/
function zip(a, b) {

@@ -259,4 +273,5 @@ var zipped = [];

function compareArrays(left, right) {
if (left.length !== right.length) return false;
return zip(left, right).every(function (pair) {
if (left.length !== right.length) {
return false;
}return zip(left, right).every(function (pair) {
return compare(pair[0], pair[1]);

@@ -271,34 +286,13 @@ });

var right_keys = Object.keys(right);
if (!compareArrays(left_keys, right_keys)) return false;
return left_keys.every(function (key) {
if (!compareArrays(left_keys, right_keys)) {
return false;
}return left_keys.every(function (key) {
return compare(left[key], right[key]);
});
}
/**
`compare()` returns true if `left` and `right` are materially equal
(i.e., would produce equivalent JSON), false otherwise.
> Here, "equal" means that the value at the target location and the
> value conveyed by "value" are of the same JSON type, and that they
> are considered equal by the following rules for that type:
> o strings: are considered equal if they contain the same number of
> Unicode characters and their code points are byte-by-byte equal.
> o numbers: are considered equal if their values are numerically
> equal.
> o arrays: are considered equal if they contain the same number of
> values, and if each value can be considered equal to the value at
> the corresponding position in the other array, using this list of
> type-specific rules.
> o objects: are considered equal if they contain the same number of
> members, and if each member can be considered equal to a member in
> the other object, by comparing their keys (as strings) and their
> values (using this list of type-specific rules).
> o literals (false, true, and null): are considered equal if they are
> the same.
*/
function compare(left, right) {
// strict equality handles literals, numbers, and strings (a sufficient but not necessary cause)
if (left === right) return true;
// check arrays
if (left === right) {
return true;
} // check arrays
if (Array.isArray(left) && Array.isArray(right)) {

@@ -316,5 +310,10 @@ return compareArrays(left, right);

},{}],3:[function(_dereq_,module,exports){
/*jslint esnext: true */
"use strict";
var _get = function get(object, property, receiver) { var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc && desc.writable) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
var _inherits = function (subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) subClass.__proto__ = superClass; };
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
Object.defineProperty(exports, "__esModule", {

@@ -324,11 +323,3 @@ value: true

var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; desc = parent = getter = undefined; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; continue _function; } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var MissingError = (function (_Error) {
_inherits(MissingError, _Error);
var MissingError = exports.MissingError = (function (_Error) {
function MissingError(path) {

@@ -342,10 +333,8 @@ _classCallCheck(this, MissingError);

_inherits(MissingError, _Error);
return MissingError;
})(Error);
exports.MissingError = MissingError;
var InvalidOperationError = (function (_Error2) {
_inherits(InvalidOperationError, _Error2);
var InvalidOperationError = exports.InvalidOperationError = (function (_Error2) {
function InvalidOperationError(op) {

@@ -359,10 +348,8 @@ _classCallCheck(this, InvalidOperationError);

_inherits(InvalidOperationError, _Error2);
return InvalidOperationError;
})(Error);
exports.InvalidOperationError = InvalidOperationError;
var TestError = (function (_Error3) {
_inherits(TestError, _Error3);
var TestError = exports.TestError = (function (_Error3) {
function TestError(actual, expected) {

@@ -377,40 +364,14 @@ _classCallCheck(this, TestError);

_inherits(TestError, _Error3);
return TestError;
})(Error);
exports.TestError = TestError;
},{}],4:[function(_dereq_,module,exports){
/*jslint esnext: true */
'use strict';
"use strict";
Object.defineProperty(exports, '__esModule', {
value: true
});
exports.applyPatch = applyPatch;
exports.patch = patch;
exports.createPatch = createPatch;
exports.diff = diff;
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; };
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _interopRequireWildcard = function (obj) { return obj && obj.__esModule ? obj : { "default": obj }; };
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } }
var _errors = _dereq_('./errors');
var _pointer = _dereq_('./pointer');
var _patch = _dereq_('./patch');
var operationFunctions = _interopRequireWildcard(_patch);
var _diff = _dereq_('./diff');
var _package = _dereq_('./package');
var _package2 = _interopRequireDefault(_package);
var version = _package2['default'].version;
exports.version = version;
/**

@@ -433,3 +394,30 @@ Apply a 'application/json-patch+json'-type patch to an object.

*/
exports.applyPatch = applyPatch;
/**
Produce a 'application/json-patch+json'-type patch to get from one object to
another.
This does not alter `input` or `output` unless they have a property getter with
side-effects (which is not a good idea anyway).
Returns list of operations to perform on `input` to produce `output`.
*/
exports.createPatch = createPatch;
Object.defineProperty(exports, "__esModule", {
value: true
});
var InvalidOperationError = _dereq_("./errors").InvalidOperationError;
var Pointer = _dereq_("./pointer").Pointer;
var operationFunctions = _interopRequireWildcard(_dereq_("./patch"));
var diffAny = _dereq_("./diff").diffAny;
var package_json = _interopRequire(_dereq_("./package"));
var version = package_json.version;exports.version = version;
function applyPatch(object, patch) {

@@ -440,3 +428,3 @@ return patch.map(function (operation) {

if (operationFunction === undefined) {
return new _errors.InvalidOperationError(operation.op);
return new InvalidOperationError(operation.op);
}

@@ -447,21 +435,6 @@ return operationFunction(object, operation);

function patch(object, patch) {
console.error('rfc6902.patch(object, patch) has been deprecated. Use rfc6902.applyPatch(object, patch) instead.');
return applyPatch(object, patch);
}
/**
Produce a 'application/json-patch+json'-type patch to get from one object to
another.
This does not alter `input` or `output` unless they have a property getter with
side-effects (which is not a good idea anyway).
Returns list of operations to perform on `input` to produce `output`.
*/
function createPatch(input, output) {
var ptr = new _pointer.Pointer();
var ptr = new Pointer();
// a new Pointer gets a default path of [''] if not specified
var operations = (0, _diff.diffAny)(input, output, ptr);
var operations = diffAny(input, output, ptr);
operations.forEach(function (operation) {

@@ -473,11 +446,6 @@ operation.path = operation.path.toString();

function diff(input, output) {
console.error('rfc6902.diff(input, output) has been deprecated. Use rfc6902.createPatch(input, output) instead.');
return createPatch(input, output);
}
},{"./diff":1,"./errors":3,"./package":5,"./patch":6,"./pointer":7}],5:[function(_dereq_,module,exports){
module.exports={
"name": "rfc6902",
"version": "1.0.6",
"version": "1.0.9",
"description": "Complete implementation of RFC6902 (patch and diff)",

@@ -491,12 +459,14 @@ "keywords": [

"homepage": "https://github.com/chbrown/rfc6902",
"repository": "git://github.com/chbrown/rfc6902.git",
"repository": {
"type": "git",
"url": "https://github.com/chbrown/rfc6902.git"
},
"author": "Christopher Brown <io@henrian.com> (http://henrian.com)",
"license": "MIT",
"main": "./rfc6902.js",
"dependencies": {},
"devDependencies": {
"babel": "*",
"babelify": "*",
"browserify": "*",
"derequire": "*",
"babel-core": "5.8.34",
"babelify": "5.0.5",
"browserify": "12.0.1",
"derequire": "2.0.3",
"js-yaml": "*",

@@ -512,44 +482,4 @@ "mocha": "*",

},{}],6:[function(_dereq_,module,exports){
/*jslint esnext: true */
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
exports.add = add;
exports.remove = remove;
exports.replace = replace;
exports.move = move;
exports.copy = copy;
exports.test = test;
var _pointer = _dereq_('./pointer');
var _equal = _dereq_('./equal');
var _errors = _dereq_('./errors');
function _add(object, key, value) {
if (Array.isArray(object)) {
// `key` must be an index
if (key == '-') {
object.push(value);
} else {
object.splice(key, 0, value);
}
} else {
object[key] = value;
}
}
function _remove(object, key) {
if (Array.isArray(object)) {
// '-' syntax doesn't make sense when removing
object.splice(key, 1);
} else {
// not sure what the proper behavior is when path = ''
delete object[key];
}
}
/**

@@ -563,12 +493,5 @@ > o If the target location specifies an array index, a new value is

*/
"use strict";
function add(object, operation) {
var endpoint = _pointer.Pointer.fromJSON(operation.path).evaluate(object);
// it's not exactly a "MissingError" in the same way that `remove` is -- more like a MissingParent, or something
if (endpoint.parent === undefined) {
return new _errors.MissingError(operation.path);
}
_add(endpoint.parent, endpoint.key, operation.value);
return null;
}
exports.add = add;

@@ -579,14 +502,4 @@ /**

*/
exports.remove = remove;
function remove(object, operation) {
// endpoint has parent, key, and value properties
var endpoint = _pointer.Pointer.fromJSON(operation.path).evaluate(object);
if (endpoint.value === undefined) {
return new _errors.MissingError(operation.path);
}
// not sure what the proper behavior is when path = ''
_remove(endpoint.parent, endpoint.key);
return null;
}
/**

@@ -604,11 +517,4 @@ > The "replace" operation replaces the value at the target location

*/
exports.replace = replace;
function replace(object, operation) {
var endpoint = _pointer.Pointer.fromJSON(operation.path).evaluate(object);
if (endpoint.value === undefined) return new _errors.MissingError(operation.path);
endpoint.parent[endpoint.key] = operation.value;
return null;
}
/**

@@ -629,15 +535,4 @@ > The "move" operation removes the value at a specified location and

*/
exports.move = move;
function move(object, operation) {
var from_endpoint = _pointer.Pointer.fromJSON(operation.from).evaluate(object);
if (from_endpoint.value === undefined) return new _errors.MissingError(operation.from);
var endpoint = _pointer.Pointer.fromJSON(operation.path).evaluate(object);
if (endpoint.parent === undefined) return new _errors.MissingError(operation.path);
_remove(from_endpoint.parent, from_endpoint.key);
_add(endpoint.parent, endpoint.key, from_endpoint.value);
return null;
}
/**

@@ -656,14 +551,4 @@ > The "copy" operation copies the value at a specified location to the

*/
exports.copy = copy;
function copy(object, operation) {
var from_endpoint = _pointer.Pointer.fromJSON(operation.from).evaluate(object);
if (from_endpoint.value === undefined) return new _errors.MissingError(operation.from);
var endpoint = _pointer.Pointer.fromJSON(operation.path).evaluate(object);
if (endpoint.parent === undefined) return new _errors.MissingError(operation.path);
_remove(from_endpoint.parent, from_endpoint.key);
_add(endpoint.parent, endpoint.key, from_endpoint.value);
return null;
}
/**

@@ -677,11 +562,109 @@ > The "test" operation tests that a value at the target location is

*/
exports.test = test;
Object.defineProperty(exports, "__esModule", {
value: true
});
function test(object, operation) {
var endpoint = _pointer.Pointer.fromJSON(operation.path).evaluate(object);
var result = (0, _equal.compare)(endpoint.value, operation.value);
if (!result) return new _errors.TestError(endpoint.value, operation.value);
var Pointer = _dereq_("./pointer").Pointer;
var compare = _dereq_("./equal").compare;
var _errors = _dereq_("./errors");
var MissingError = _errors.MissingError;
var TestError = _errors.TestError;
function _add(object, key, value) {
if (Array.isArray(object)) {
// `key` must be an index
if (key == "-") {
object.push(value);
} else {
object.splice(key, 0, value);
}
} else {
object[key] = value;
}
}
function _remove(object, key) {
if (Array.isArray(object)) {
// '-' syntax doesn't make sense when removing
object.splice(key, 1);
} else {
// not sure what the proper behavior is when path = ''
delete object[key];
}
}
function add(object, operation) {
var endpoint = Pointer.fromJSON(operation.path).evaluate(object);
// it's not exactly a "MissingError" in the same way that `remove` is -- more like a MissingParent, or something
if (endpoint.parent === undefined) {
return new MissingError(operation.path);
}
_add(endpoint.parent, endpoint.key, operation.value);
return null;
}
function remove(object, operation) {
// endpoint has parent, key, and value properties
var endpoint = Pointer.fromJSON(operation.path).evaluate(object);
if (endpoint.value === undefined) {
return new MissingError(operation.path);
}
// not sure what the proper behavior is when path = ''
_remove(endpoint.parent, endpoint.key);
return null;
}
function replace(object, operation) {
var endpoint = Pointer.fromJSON(operation.path).evaluate(object);
if (endpoint.value === undefined) {
return new MissingError(operation.path);
}endpoint.parent[endpoint.key] = operation.value;
return null;
}
function move(object, operation) {
var from_endpoint = Pointer.fromJSON(operation.from).evaluate(object);
if (from_endpoint.value === undefined) {
return new MissingError(operation.from);
}var endpoint = Pointer.fromJSON(operation.path).evaluate(object);
if (endpoint.parent === undefined) {
return new MissingError(operation.path);
}_remove(from_endpoint.parent, from_endpoint.key);
_add(endpoint.parent, endpoint.key, from_endpoint.value);
return null;
}
function copy(object, operation) {
var from_endpoint = Pointer.fromJSON(operation.from).evaluate(object);
if (from_endpoint.value === undefined) {
return new MissingError(operation.from);
}var endpoint = Pointer.fromJSON(operation.path).evaluate(object);
if (endpoint.parent === undefined) {
return new MissingError(operation.path);
}_remove(from_endpoint.parent, from_endpoint.key);
_add(endpoint.parent, endpoint.key, from_endpoint.value);
return null;
}
function test(object, operation) {
var endpoint = Pointer.fromJSON(operation.path).evaluate(object);
var result = compare(endpoint.value, operation.value);
if (!result) {
return new TestError(endpoint.value, operation.value);
}return null;
}
},{"./equal":2,"./errors":3,"./pointer":7}],7:[function(_dereq_,module,exports){
"use strict";
var _createClass = (function () { function defineProperties(target, props) { for (var key in props) { var prop = props[key]; prop.configurable = true; if (prop.value) prop.writable = true; } Object.defineProperties(target, props); } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
Object.defineProperty(exports, "__esModule", {
value: true
});
/**

@@ -707,14 +690,4 @@ Unescape token part of a JSON Pointer string

*/
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
function unescape(token) {
return token.replace(/~1/g, '/').replace(/~0/g, '~');
return token.replace(/~1/g, "/").replace(/~0/g, "~");
}

@@ -730,3 +703,3 @@ /** Escape token part of a JSON Pointer string

function escape(token) {
return token.replace(/~/g, '~0').replace(/\//g, '~1');
return token.replace(/~/g, "~0").replace(/\//g, "~1");
}

@@ -737,5 +710,5 @@ /**

var Pointer = (function () {
var Pointer = exports.Pointer = (function () {
function Pointer() {
var tokens = arguments.length <= 0 || arguments[0] === undefined ? [''] : arguments[0];
var tokens = arguments[0] === undefined ? [""] : arguments[0];

@@ -747,59 +720,60 @@ _classCallCheck(this, Pointer);

/**
`path` *must* be a properly escaped string.
*/
_createClass(Pointer, {
toString: {
value: function toString() {
return this.tokens.map(escape).join("/");
}
},
evaluate: {
/**
Returns an object with 'parent', 'key', and 'value' properties.
In the special case that pointer = "", parent and key will be null, and `value = obj`
Otherwise, parent will be the such that `parent[key] == value`
*/
_createClass(Pointer, [{
key: 'toString',
value: function toString() {
return this.tokens.map(escape).join('/');
}
value: function evaluate(object) {
var parent = null;
var token = null;
for (var i = 1, l = this.tokens.length; i < l; i++) {
parent = object;
token = this.tokens[i];
// not sure if this the best way to handle non-existant paths...
object = (parent || {})[token];
}
return {
parent: parent,
key: token,
value: object };
}
},
push: {
value: function push(token) {
// mutable
this.tokens.push(token);
}
},
add: {
/**
`token` should be a String. It'll be coerced to one anyway.
immutable (shallowly)
*/
/**
Returns an object with 'parent', 'key', and 'value' properties.
In the special case that pointer = "", parent and key will be null, and `value = obj`
Otherwise, parent will be the such that `parent[key] == value`
*/
}, {
key: 'evaluate',
value: function evaluate(object) {
var parent = null;
var token = null;
for (var i = 1, l = this.tokens.length; i < l; i++) {
parent = object;
token = this.tokens[i];
// not sure if this the best way to handle non-existant paths...
object = (parent || {})[token];
value: function add(token) {
var tokens = this.tokens.concat(String(token));
return new Pointer(tokens);
}
return {
parent: parent,
key: token,
value: object
};
}
}, {
key: 'push',
value: function push(token) {
// mutable
this.tokens.push(token);
}
fromJSON: {
/**
`path` *must* be a properly escaped string.
*/
/**
`token` should be a String. It'll be coerced to one anyway.
immutable (shallowly)
*/
}, {
key: 'add',
value: function add(token) {
var tokens = this.tokens.concat(String(token));
return new Pointer(tokens);
value: function fromJSON(path) {
var tokens = path.split("/").map(unescape);
if (tokens[0] !== "") throw new Error("Invalid JSON Pointer: " + path);
return new Pointer(tokens);
}
}
}], [{
key: 'fromJSON',
value: function fromJSON(path) {
var tokens = path.split('/').map(unescape);
if (tokens[0] !== '') throw new Error('Invalid JSON Pointer: ' + path);
return new Pointer(tokens);
}
}]);
});

@@ -809,5 +783,3 @@ return Pointer;

exports.Pointer = Pointer;
},{}]},{},[4])(4)
});

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

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