JavaScript Object history
For cloning, UltraDeepClone. For diff/apply, changeset.
Works in IE8 with es5-shim. Perhaps IE7, as well.
Gives birth to instances
Params
initial{Object}: The initial history pointoptions{Object}
-limit{Number}: Optional. Remember this many backward points
Example
var History = require('object-history')
var initial = {foo: 'bar', name: 'victoria'}
var history = new History(initial, {limit: 33})Add a history point object
Params
obj{Object}: The history point
Example
history.add({
foo: 'bar',
bar: 'foo'
})Go back one history point
Makes all backward history forgotten
Makes all forward history forgotten
Go forward one history point
returns{Object}: "Current" history point
returns{Number}: Number of history points backwards
returns{Number}: Number of history points forward
Copyright © 2015 PolicyStat LLC
Released under the BSD-3-Clause license.
