New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

object-property-assigner

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

object-property-assigner - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

21

build/assign.js

@@ -22,4 +22,5 @@ "use strict";

var current = inputObj;
var parent = [];
var parent;
var parentPart = '';
var topLevelArrayDeletion = false;
// Drill down into object/array via the path sequence

@@ -81,5 +82,9 @@ propertyPathArray.forEach(function (part, index) {

if (remove) {
var currentArray = parent[parentPart];
var newArray = __spreadArray(__spreadArray([], currentArray.slice(0, part), true), currentArray.slice(part + 1), true);
parent[parentPart] = newArray;
if (parent) {
var currentArray = parent[parentPart];
var newArray = sliceArray(currentArray, part);
parent[parentPart] = newArray;
}
else
topLevelArrayDeletion = true;
}

@@ -99,3 +104,7 @@ else

});
return inputObj;
if (!topLevelArrayDeletion)
return inputObj;
// Deleting from a root-level array must be handled as a special case.
var index = propertyPathArray[0];
return sliceArray(inputObj, index);
};

@@ -133,2 +142,4 @@ // Splits a string representing a (nested) property/index on an Object or Array

};
// Returns a copy of an array with a specific index removed.
var sliceArray = function (input, index) { return __spreadArray(__spreadArray([], input.slice(0, index), true), input.slice(index + 1), true); };
exports.default = assignProperty;
{
"name": "object-property-assigner",
"version": "1.0.0",
"version": "1.0.1",
"description": "A lightweight (no dependencies) tool to assign deeply nested properties in JS Objects (incl. Arrays)",

@@ -5,0 +5,0 @@ "main": "build/assign.js",

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