object-rollback
Cancel changes to JavaScript object values (add/update/delete properties, add item into Map/Set, etc.)
Install
npm install object-rollback
Usage
const ObjectState = ; const someValue = a: 1 b: 2 c: 1 2 3 ; console; // { a: 1, b: 2, c: [ 1, 2, 3 ] } const state = someValue; someValueb = 200;someValuex = 42;someValuec; console; // { a: 1, b: 200, c: [ 1, 2, 3, 9 ], x: 42 } state; console; // { a: 1, b: 2, c: [ 1, 2, 3 ] }
Tested objects
ECMAScript 2019 Objects
Standard Built-inError
- test codeError
EvalError
RangeError
ReferenceError
SyntaxError
TypeError
URIError
Date
- test codeRegExp
- test codeArray
- test codeMap
- test codeSet
- test codeTypedArray
- test codeInt8Array
Uint8Array
Uint8ClampedArray
Int16Array
Uint16Array
Int32Array
Uint32Array
BigInt64Array
BigUint64Array
Float32Array
Float64Array
DataView
- test code
Node.js Built-in Objects
Tests
To run the test suite, first install the dependencies, then run npm test
:
npm installnpm test
Contributing
see CONTRIBUTING.md