Socket
Socket
Sign inDemoInstall

delete-property

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

delete-property

Deletes a deeply nested object property


Version published
Weekly downloads
2.7K
increased by15.92%
Maintainers
1
Weekly downloads
 
Created
Source

DEPRECATED: Use Lodash's unset method instead

This module will still work but I will no longer maintain it since lodash implements it.

delete-property Build Status

Deletes a deeply nested object property. Returns true if successfully deleted. Returns false if property doesn't exist or if the passed in argument is not an object.

Installing

npm install delete-property

Example usage

var deleteProperty = require('delete-property');
var obj = {
    n: {
        p: {
            m: true
        }
    }  
};

var deleteNPM = deleteProperty('n.p.m');
console.log(deleteNPM(obj)); // true
console.log(obj.n.p.hasOwnProperty('m')); // false

// Tryin to delete something that ain't exist? You rascal..

var deleteSuckIt = deleteProperty('suck.it');
console.log(deleteSuckIt(obj)) // false
console.log(deleteSuckIt(undefined)) // false
console.log(deleteSuckIt(null)) // false
console.log(deleteSuckIt(69)) // false
console.log(deleteSuckIt('god damn it')) // false

Keywords

FAQs

Package last updated on 25 May 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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