https://github.com/doesdev/heedful
Observe nested changes on (almost) anything
https://github.com/doesdev/heedful
Last synced: 6 months ago
JSON representation
Observe nested changes on (almost) anything
- Host: GitHub
- URL: https://github.com/doesdev/heedful
- Owner: doesdev
- Created: 2023-05-31T19:21:38.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-05-31T19:35:21.000Z (over 2 years ago)
- Last Synced: 2025-01-20T01:25:51.885Z (about 1 year ago)
- Language: JavaScript
- Size: 862 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# heedful
> Observe nested changes on (almost) anything
## install
```sh
$ npm install --save heedful
```
## usage
```js
import { takeHeed } from 'heedful'
const onChange = (changeData) => console.log(JSON.stringify(changeData, null, 2))
const baseObject = { child: { array: [{ nested: 'deep' }] } }
const observed = takeHeed(baseObject, { onChange })
observed.child.array[0].mad = 'deep'
/* LOGGED TO CONSOLE
{
"property": "mad",
"target": {
"child": {
"array": [
{
"nested": "deep",
"mad": "deep"
}
]
}
},
"source": {
"nested": "deep",
"mad": "deep"
},
"chain": [
"child",
"array",
"0",
"mad"
]
}
*/
```
## License
MIT © [Andrew Carpenter](https://github.com/doesdev)