Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including object-history with all npm packages installed. Try it out:

var objectHistory = require("object-history")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

object-history v3.1.0

Object History

object-history NPM version Build Status js-standard-style

JavaScript Object history

Behind the scenes

For cloning, UltraDeepClone. For diff/apply, changeset.

Old browsers

Works in IE8 with es5-shim. Perhaps IE7, as well.



Gives birth to instances

  • initial {Object}: The initial history point
  • options {Object}: limit: {Number} Remember this many backward points
var History = require('object-history')
var initial = {foo: 'bar', name: 'victoria'}
var history = new History(initial, {limit: 33})


Add a history point object

  • obj {Object}: The history point
  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.

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free