https://github.com/blakeembrey/setvalue
Set a nested value from an object by path
https://github.com/blakeembrey/setvalue
insert json mutation object
Last synced: 3 months ago
JSON representation
Set a nested value from an object by path
- Host: GitHub
- URL: https://github.com/blakeembrey/setvalue
- Owner: blakeembrey
- License: other
- Created: 2016-07-08T04:56:15.000Z (over 9 years ago)
- Default Branch: main
- Last Pushed: 2023-12-14T05:35:50.000Z (about 2 years ago)
- Last Synced: 2025-05-16T10:46:32.684Z (8 months ago)
- Topics: insert, json, mutation, object
- Language: TypeScript
- Size: 84 KB
- Stars: 5
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Security: SECURITY.md
Awesome Lists containing this project
README
# Setvalue
> Type-safe library for reading, writing, or checking, nested values of an object.
## Installation
```sh
npm install setvalue --save
```
## Usage
```js
import { set, get, has } from "setvalue";
const obj = { a: "prop" };
set("a", "b", "c")(obj, 10); //=> { a: { b: { c: 10 } } }
get("a", "b", "c")(obj); //=> 10
has("a", "b", "c")(obj); //=> true
```
## License
Apache 2.0