undo-redo-proxy
⏳ Effortless timetravel - undo/redo proxy wrapper for arrays
Installation
npm install undo-redo-proxy
Usage
let array = 'my' 'array'// wraps your array, returns proxy which behaves like a normal arrayarray = console // ['my', 'array']array // ['my', 'array', 'foo']array2 = 'bar' // ['my', 'array', 'bar']array // ['my', 'array', 'foo']array // ['my', 'array']array // ['array']array // ['my', 'array']
Can be used in browser as well
let users =
Only keeps track of the array and its items and positions.
usersusersusersconsole // [{name: 'Lucy'}]usersconsole // [{name: 'Mike'}, {name: 'Lucy'}]
Does not track content of array items.
users // can be undoneusers0name = 'Lucy' // cannot be undoneconsole // [{name: 'Lucy'}]usersconsole // [{name: 'Lucy'}]
Licence
MIT, Mike Kovařík, Mutiny.cz