dotprop

1.2.1 • Public • Published

dotprop Build Status

Get property by dot notation. A short and dependable implementation.

var getProp = require('dotprop');

getProp({a: { b: { c: 1}} }, 'a.b.c') // 1
getProp([1,2,3], 2) // 3
getProp({}, 'a.b') // undefined

// recognizes arrays too
getProp({a: { b: { c: 1}} }, ['a', 'b', 'c']) // 1
getProp({a: { 'b.c': 1 }}, ['a', 'b.c']) // 1

Similar

NPM

Package Sidebar

Install

npm i dotprop

Weekly Downloads

10,847

Version

1.2.1

License

MIT

Unpacked Size

3.42 kB

Total Files

4

Last publish

Collaborators

  • dfcreative
  • dy