https://github.com/choojs/object-change-callsite
Determine the callsite of an object change using Proxies
https://github.com/choojs/object-change-callsite
Last synced: 12 months ago
JSON representation
Determine the callsite of an object change using Proxies
- Host: GitHub
- URL: https://github.com/choojs/object-change-callsite
- Owner: choojs
- License: mit
- Created: 2017-09-22T17:52:59.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-05-23T17:38:34.000Z (about 8 years ago)
- Last Synced: 2025-06-28T06:24:01.483Z (12 months ago)
- Language: JavaScript
- Size: 11.7 KB
- Stars: 27
- Watchers: 1
- Forks: 11
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# object-change-callsite
[![npm version][2]][3] [![build status][4]][5]
[![downloads][8]][9] [![js-standard-style][10]][11]
Determine the callsite of an object change using Proxies.
## Usage
```js
var onChange = require('object-change-callsite')
var state = {}
state = onChange(state, function (attr, value, callsite) {
console.log(`${attr} changed to ${value} at ${callsite}`)
})
state.foo = 'hello'
state.bar = 'world'
```
## API
### `onChange(target, callback(attribute, value, callsite))`
Detect changes on the target object.
## License
[MIT](https://tldrlegal.com/license/mit-license)
[0]: https://img.shields.io/badge/stability-experimental-orange.svg?style=flat-square
[1]: https://nodejs.org/api/documentation.html#documentation_stability_index
[2]: https://img.shields.io/npm/v/object-change-callsite.svg?style=flat-square
[3]: https://npmjs.org/package/object-change-callsite
[4]: https://img.shields.io/travis/yoshuawuyts/object-change-callsite/master.svg?style=flat-square
[5]: https://travis-ci.org/yoshuawuyts/object-change-callsite
[6]: https://img.shields.io/codecov/c/github/yoshuawuyts/object-change-callsite/master.svg?style=flat-square
[7]: https://codecov.io/github/yoshuawuyts/object-change-callsite
[8]: http://img.shields.io/npm/dm/object-change-callsite.svg?style=flat-square
[9]: https://npmjs.org/package/object-change-callsite
[10]: https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square
[11]: https://github.com/feross/standard