Socket
Socket
Sign inDemoInstall

unset-value

Package Overview
Dependencies
5
Maintainers
2
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.0.0 to 2.0.1

16

index.js

@@ -13,2 +13,12 @@ /*!

const isUnsafeKey = key => {
return key === '__proto__' || key === 'constructor' || key === 'prototype';
};
const validateKey = key => {
if (isUnsafeKey(key)) {
throw new Error(`Cannot set unsafe key: "${key}"`);
}
};
module.exports = function unset(obj, prop) {

@@ -32,3 +42,7 @@ if (!isObject(obj)) {

}
while (segs.length) obj = obj[prop = segs.shift()];
while (segs.length) {
prop = segs.shift();
validateKey(prop);
obj = obj[prop];
}
return (delete obj[last]);

@@ -35,0 +49,0 @@ }

2

package.json
{
"name": "unset-value",
"description": "Delete nested properties from an object using dot notation.",
"version": "2.0.0",
"version": "2.0.1",
"homepage": "https://github.com/jonschlinkert/unset-value",

@@ -6,0 +6,0 @@ "author": "Jon Schlinkert (https://github.com/jonschlinkert)",

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