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

Package detail

@eivifj/dot

eivindfjeldstad59.8kMIT1.0.3

Get and set object properties with dot notation

dot, notation, properties, object, path

readme

dot

Get and set object properties with dot notation

Installation

$ npm install @eivifj/dot

API

dot.set(object, path, value)

dot.set(obj, 'cool.aid', 'rocks');
assert(obj.cool.aid === 'rocks');

dot.get(object, path)

var value = dot.get(obj, 'cool.aid');
assert(value === 'rocks');

dot.delete(object, path)

var value = dot.delete(obj, 'cool.aid');
assert(!obj.cool.hasOwnProperty('aid'));

License

MIT