property-drill

1.0.1 • Public • Published

property-drill

Safely find deep properties in objects and arrays.

Installation

With npm:

npm install --save property-drill

Or Yarn:

yarn add property-drill

Usage

var propDrill = require('property-drill')
 
var obj = {
   a: {
      b: ['c', 'd', 'e']
   }
}
 
var prop = propDrill(obj, `a`, `b`, 0) // Returns "c"

Why?

While there are tons of modules that do the same thing, many of them do not search within arrays or throw errors if you search deeper than the object is. The ones that meet these requirements take strings as your second argument. This can lead to innaccurate results when mixing objects and arrays and can also be much slower when more powerful regex is used.

Package Sidebar

Install

npm i property-drill

Weekly Downloads

2

Version

1.0.1

License

MIT

Unpacked Size

245 kB

Total Files

10

Last publish

Collaborators

  • amadoa
  • dalewray
  • codevelopit
  • mastaaaron
  • escasports
  • tbaustin
  • ken85rose