2.0.0 • Published 12 months ago

dotprop v2.0.0

Weekly downloads
6,131
License
MIT
Repository
github
Last release
12 months ago

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