npm.io
1.0.3 • Published 6 years ago

@eivifj/dot

Licence
MIT
Version
1.0.3
Deps
0
Size
4 kB
Vulns
0
Weekly
0
Stars
2

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

Keywords