Skip to content

kemitchell/keyarray-has.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

var has = require('keyarray-has')
var assert = require('assert')

assert.throws(function () {
  has({}, null)
}, TypeError)

assert.throws(function () {
  has(null, [0])
}, TypeError)

assert(has({a: 1}, ['a']) === true)

assert(has({a: 1}, ['b']) === false)

assert(has({a: {b: 1}}, ['a', 'b']) === true)

assert(has({a: {b: 1}}, ['a', 'c']) === false)

assert(has({a: ['string']}, ['a', 0]) === true)

About

Recursive hasOwnProperty taking a key array

Resources

License

Stars

Watchers

Forks

Packages

No packages published