Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

dotprop

dy24.1kMIT2.0.0

Get property value by dot notation

dot-prop, dot, json, property, value, notation, object, get-prop, obj, prop, path, get, access, getprop, ramda.path, dot path

readme

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

🕉