@util-funcs/object-set
v0.0.1
Published
Set deep property by key chaining and manipulate given object.
Downloads
7
Maintainers
Readme
object-set
Set deep property by key chaining and manipulate given object.
Getting Started
import set from '@util-funcs/object-set';
Installing
npm i @util-funcs/object-set --save
or
yarn add @util-funcs/object-set
Examples
let data = {};
data = set(data, 'a.b.c.d.e', 'test data');
// output:
{
a: {
b: {
c: {
d: {
e: 'test data'
}
}
}
}
}
Object will be manipulate and return it same reference. You do not have to assign return data to a variable.
let data = {};
set(data, 'a.b.c.d.e', true);
// data:
{
a: {
b: {
c: {
d: {
e: true
}
}
}
}
}
Run tests
npm test
Built With
Versioning
We use SemVer for versioning.
Authors
- Ahmet ATAY - Initial work
License
This project is licensed under the MIT License - see the LICENSE.md file for details