shvl
Get and set dot-notated properties within an object.
Installation
npm install --save shvl
The UMD build is also available on unpkg:
<script src="//unpkg.com/shvl/dist/shvl.umd.js"></script>
This exposes the shlv object as a global.
Usage
import * as shvl from 'shvl';
let obj = {
a: {
b: {
c: 1
d: undefined
e: null
}
}
};
shvl.set(obj, 'a.b.c', 2);
shvl.get(obj, 'a.b.c') === 2;
shvl.get(obj, ['a', 'b', 'c']) === 1;
shvl.get(obj, 'a.b.c.f') === undefined;
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributors ✨
Thanks goes to these wonderful people (emoji key):
This project follows the all-contributors specification. Contributions of any kind welcome!
License
The MIT License (MIT). Please see License File for more information.