Set given (deep) object path
Switch branches/tags
Nothing to show
Clone or download
Pull request Compare This branch is 1 commit ahead, 3 commits behind azer:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.gitignore
.npmignore
README.md
index.js
package.json
test.js

README.md

del-object-path

Del given (deep) object path

See also: get-object-path, set-object-path

Install

$ npm install del-object-path

Usage

var del = require('del-object-path')
var data = {
  title: 'My Products',
  products: {
    eggs: [{ kind: 'white', amount: 300 }, { kind: 'brown', amount: 200 }]
  }
}

del(data, 'products.eggs[0].amount')
data.products.eggs[0].amount
// => undefined
del(data, 'products.eggs')
Object.keys(data.products)
// => ['title']