keyarray-delete

1.0.0 • Public • Published
var del = require('keyarray-delete')
var assert = require('assert')
 
var anObject = {
  a: {
    b: 'value',
    c: 'another'
  }
}
 
assert(del(anObject, ['a', 'b']) === true)
 
assert(anObject.a.hasOwnProperty('b') === false)
 
assert(anObject.a.c === 'another')
 
assert(del(anObject, ['nonexistent']) === true)
 
assert.throws(function () {
  del(anObject, ['nonexistent', 'key'])
}, TypeError)

Package Sidebar

Install

npm i keyarray-delete

Weekly Downloads

627

Version

1.0.0

License

MIT

Last publish

Collaborators

  • kemitchell