New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

object-history

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

object-history

JavaScript Object history (undo/redo)

  • 2.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
317
decreased by-17.02%
Maintainers
1
Weekly downloads
 
Created
Source

Sauce Test Status

object-history

JavaScript Object history (undo/redo)

Behind the scenes

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

Requirements

Requires some shimmable ES5 stuff. Works in IE7 and IE8 with es5-shim.

Usage


var History = require("object-history");
var origin = {foo: "foo"};
var history = History(origin);

history.get();
// {foo: "foo"}

history.get() === origin;
// false

// It was cloned with `udc`.

history.add({foo: "bar"});
// 1

history.get();
// {foo: "bar"}

history.backward();
// 0

history.get();
// {foo: "foo"}

history.length
// 2

history.position
// 0

history.back();
// false

history.get();
// {foo: "foo"}

history.forward();
// 1

history.get();
// {foo: "bar"}

history.add({yad: "yad"});
// 2

history.back(0);
// 0

history.add({fab: "fab"});
// 1

history.length;
// 2

// `.add`ing removes forward history.

history.get(1); // Not yet implemented. Care to contribute?

Changelog

v2.0.0

Now expects some ES5 things. See readme.

Keywords

FAQs

Package last updated on 04 Feb 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc