Socket
Socket
Sign inDemoInstall

just-diff-apply

Package Overview
Dependencies
0
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.1.0 to 2.0.0

19

index.js

@@ -73,8 +73,7 @@ module.exports = {

if (!Array.isArray(thisPath)) {
throw new Error(
'diff path must be an array, consider supplying a path converter'
);
throw new Error('diff path must be an array, consider supplying a path converter');
}
}
var lastProp = thisPath.pop();
var pathCopy = thisPath.slice();
var lastProp = pathCopy.pop();
if (!lastProp) {

@@ -84,3 +83,3 @@ return false;

var thisProp;
while ((thisProp = thisPath.shift())) {
while ((thisProp = pathCopy.shift())) {
if (!(thisProp in subObject)) {

@@ -93,13 +92,7 @@ subObject[thisProp] = {};

if (!subObject.hasOwnProperty(lastProp)) {
throw new Error(
['expected to find property', thisDiff.path, 'in object', obj].join(
' '
)
);
throw new Error(['expected to find property', thisDiff.path, 'in object', obj].join(' '));
}
}
if (thisOp === REMOVE) {
Array.isArray(subObject)
? subObject.splice(lastProp, 1)
: delete subObject[lastProp];
Array.isArray(subObject) ? subObject.splice(lastProp, 1) : delete subObject[lastProp];
}

@@ -106,0 +99,0 @@ if (thisOp === REPLACE || thisOp === ADD) {

{
"name": "just-diff-apply",
"version": "1.1.0",
"version": "2.0.0",
"description": "Apply a diff to an object. Optionally supports jsonPatch protocol",

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc