Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

checkpoint-store

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

checkpoint-store

In-memory key-value store with history! Keys are strings, values are any type.

  • 1.0.0
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Checkpoint-Store

In-memory key-value store with history! Keys are strings, values are any type.

var store = new CheckpointStore()
store.put('xyz', 'hello world')
store.checkpoint()
store.put('xyz', 'haay wuurl')

store.get('xyz') //=> 'haay wuurl'
store.revert()
store.get('xyz') //=> 'hello world'

Uses functional-red-black-tree under the hood.

api

new CheckpointStore(initialState)

creates a new store. optionally pass in the intial state as a pojo.

store.put(key, value)

sets a value. key is a string. value is any type.

store.get(key)

returns a value. key is a string. value is any type.

store.del(key)

deletes a value. key is a string.

store.checkpoint()

adds a checkpoint. state of the store can be returned to this point.

store.revert()

returns to the state of the previous checkpoint. throws an error if there are no checkpoints.

store.commit()

keeps the state and removes the previous checkpoint. throws an error if there are no checkpoints.

store.isCheckpointed()

returns true if the store has remaining checkpoints.

FAQs

Package last updated on 06 Oct 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