dotprop

2.0.0 • Public • Published

dotprop test

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

import getProp from '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

4,540

Version

2.0.0

License

MIT

Unpacked Size

3.53 kB

Total Files

4

Last publish

Collaborators

  • dfcreative
  • dy