Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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

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
```

```