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

rfc6902

Package Overview
Dependencies
Maintainers
1
Versions
44
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 0.0.4 to 0.0.5

build.js

6

diff.js

@@ -1,5 +0,5 @@

'use strict'; /*jslint node: true, es5: true, indent: 2 */
/*globals exports, require */
var pointer = require('./pointer');
var errors = require('./errors');
var equal = require('./equal');
var equal = require('./equal').equal;

@@ -175,3 +175,3 @@ var pushAll = function(array, xs) { return Array.prototype.push.apply(array, xs); };

var diff = module.exports = function(input, output) {
var diff = exports.diff = function(input, output) {
/** Produce a 'application/json-patch+json'-type patch to get from one object to another

@@ -178,0 +178,0 @@

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

'use strict'; /*jslint node: true, es5: true, indent: 2 */
/*globals exports */
var _zip = function(a, b) {

@@ -31,3 +30,3 @@ var zipped = [];

var equal = module.exports = function(left, right) {
var equal = exports.equal = function(left, right) {
/**

@@ -34,0 +33,0 @@ > Here, "equal" means that the value at the target location and the

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

'use strict'; /*jslint node: true, es5: true, indent: 2 */
/*globals exports, require */
var MissingError = exports.MissingError = function(path) {

@@ -4,0 +3,0 @@ this.path = path;

'use strict'; /*jslint node: true, es5: true, indent: 2 */
exports.diff = require('./diff');
exports.patch = require('./patch');
exports.diff = require('./diff').diff;
exports.patch = require('./patch').patch;
{
"name": "rfc6902",
"version": "0.0.4",
"version": "0.0.5",
"description": "Complete implementation of RFC6902 (patch and diff)",

@@ -27,2 +27,4 @@ "keywords": [

"devDependencies": {
"async": "*",
"uglify-js": "*",
"tap": "*"

@@ -29,0 +31,0 @@ },

@@ -1,6 +0,5 @@

'use strict'; /*jslint node: true, es5: true, indent: 2 */
/*globals exports, require */
var pointer = require('./pointer');
var errors = require('./errors');
var equal = require('./equal');
// var optimist = require('optimist');
var equal = require('./equal').equal;

@@ -43,3 +42,3 @@ var _add = function(object, key, value) {

*/
var endpoint = pointer.at(object, operation.path);
var endpoint = pointer.Pointer.parse(operation.path).evaluate(object);
// it's not exactly a "MissingError" in the same way that `remove` is -- more like a MissingParent, or something

@@ -56,3 +55,3 @@ if (endpoint.parent === undefined) return new errors.MissingError(operation.path);

// endpoint has parent, key, and value properties
var endpoint = pointer.at(object, operation.path);
var endpoint = pointer.Pointer.parse(operation.path).evaluate(object);
if (endpoint.value === undefined) return new errors.MissingError(operation.path);

@@ -76,3 +75,3 @@

*/
var endpoint = pointer.at(object, operation.path);
var endpoint = pointer.Pointer.parse(operation.path).evaluate(object);
if (endpoint.value === undefined) return new errors.MissingError(operation.path);

@@ -98,6 +97,6 @@

*/
var from_endpoint = pointer.at(object, operation.from);
var from_endpoint = pointer.Pointer.parse(operation.from).evaluate(object);
if (from_endpoint.value === undefined) return new errors.MissingError(operation.from);
var endpoint = pointer.at(object, operation.path);
var endpoint = pointer.Pointer.parse(operation.path).evaluate(object);
if (endpoint.parent === undefined) return new errors.MissingError(operation.path);

@@ -122,5 +121,5 @@

*/
var from_endpoint = pointer.at(object, operation.from);
var from_endpoint = pointer.Pointer.parse(operation.from).evaluate(object);
if (from_endpoint.value === undefined) return new errors.MissingError(operation.from);
var endpoint = pointer.at(object, operation.path);
var endpoint = pointer.Pointer.parse(operation.path).evaluate(object);
if (endpoint.parent === undefined) return new errors.MissingError(operation.path);

@@ -141,3 +140,3 @@

*/
var endpoint = pointer.at(object, operation.path);
var endpoint = pointer.Pointer.parse(operation.path).evaluate(object);
// endpoint.value

@@ -149,3 +148,3 @@ var result = equal(endpoint.value, operation.value);

var patch = module.exports = function(object, operations) {
var patch = exports.patch = function(object, operations) {
/** Apply a 'application/json-patch+json'-type patch to an object

@@ -152,0 +151,0 @@

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

'use strict'; /*jslint node: true, es5: true, indent: 2 */
/*globals exports */
var unescape = function(token) {

@@ -89,6 +88,1 @@ /** Unescape token part of a JSON Pointer string

};
var at = exports.at = function(object, path) {
var pointer = Pointer.parse(path);
return pointer.evaluate(object);
};
# rfc6902
(Soon to be) complete implementation of [RFC6902](http://tools.ietf.org/html/rfc6902),
Complete implementation of [RFC6902](http://tools.ietf.org/html/rfc6902)
(including [RFC6901](http://tools.ietf.org/html/rfc6901)),
for creating and consuming "application/json-patch+json" documents.

@@ -5,0 +6,0 @@

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

'use strict'; /*jslint node: true, es5: true, indent: 2 */
/*jslint node: true */
var fs = require('fs');

@@ -7,3 +7,3 @@ var path = require('path');

var diff = require('../diff');
var diff = require('../diff').diff;

@@ -10,0 +10,0 @@ tap.test('spec diff', function(t) {

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

'use strict'; /*jslint node: true, es5: true, indent: 2 */
/*jslint node: true */
var tap = require('tap');

@@ -3,0 +3,0 @@

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

'use strict'; /*jslint node: true, es5: true, indent: 2 */
/*jslint node: true */
var fs = require('fs');

@@ -17,3 +17,3 @@ var path = require('path');

var patch = require('../patch');
var patch = require('../patch').patch;

@@ -20,0 +20,0 @@ tap.test('spec patch', function(t) {

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

'use strict'; /*jslint node: true, es5: true, indent: 2 */
/*jslint node: true */
var fs = require('fs');

@@ -48,3 +48,3 @@ var path = require('path');

expectations.forEach(function(expectation) {
var endpoint = pointer.at(obj, expectation.path);
var endpoint = pointer.Pointer.parse(expectation.path).evaluate(obj);
t.deepEqual(endpoint.value, expectation.value, 'resolved JSON Pointer should equal expected value');

@@ -93,3 +93,3 @@ });

expectations.forEach(function(expectation) {
var endpoint = pointer.at(obj, expectation.path);
var endpoint = pointer.Pointer.parse(expectation.path).evaluate(obj);
t.deepEqual(endpoint.value, expectation.value, 'resolved JSON Pointer should equal expected value');

@@ -96,0 +96,0 @@ });

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

'use strict'; /*jslint node: true, es5: true, indent: 2 */
/*jslint node: true */
var fs = require('fs');

@@ -15,3 +15,3 @@ var tap = require('tap');

// use sorted values and sort() to emulate set equality
var props = ['errors', 'input', 'name', 'output', 'patch'];
var props = ['diffable', 'errors', 'input', 'name', 'output', 'patch'];
var props_csv = props.join(', ');

@@ -18,0 +18,0 @@ spec.forEach(function(item) {

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