Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/magicien/reset-object
Reset a JavaScript Object instance to its prototype definition
https://github.com/magicien/reset-object
Last synced: 2 days ago
JSON representation
Reset a JavaScript Object instance to its prototype definition
- Host: GitHub
- URL: https://github.com/magicien/reset-object
- Owner: magicien
- License: mit
- Created: 2017-09-03T23:01:13.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2017-09-04T15:42:45.000Z (about 7 years ago)
- Last Synced: 2024-05-02T04:00:06.426Z (7 months ago)
- Language: JavaScript
- Size: 7.81 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# reset-object
Reset a JavaScript Object instance to its prototype definition```
const resetObject = require('reset-object')class MyClass {
myFunc() {
return 'this is myFunc'
}
}const obj = new MyClass()
obj.myFunc = () => 'new myFunc'console.log(obj.myFunc()) // -> 'new myFunc'
resetObject(obj)
console.log(obj.myFunc()) // -> 'this is myFunc'
```## Install
### Node
```
npm install --save reset-object
```### Browser
``````