New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

unreson

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

unreson

Class for providing deep undo/redo state for dynamic JSON objects

latest
npmnpm
Version
0.15.0
Version published
Maintainers
1
Created
Source

unreson -- undo/redo-able object wrapper

unreson provides the StateObject class that manages the state for a provided JSON-safe object. Changes to the object, no matter how deep, may be undone or redone. The state of the object can also be made temporarily immutable if the need arises.

Usage

let unreson = require('unreson')

let myObject = new unreson.StateObject({ a: 0, b: 1, c: {}, d: [0,1,2,3,4] })

console.log(myObject.state) // { a: 0, b: 1, c: {}, d: [ 0, 1, 2, 3, 4 ] }
myObject.state.c = 2
console.log(myObject.state) // { a: 0, b: 1, c: 2, d: [ 0, 1, 2, 3, 4 ] }
myObject.undo()
console.log(myObject.state) // { a: 0, b: 1, c: {}, d: [ 0, 1, 2, 3, 4 ] }
myObject.redo()
console.log(myObject.state) // { a: 0, b: 1, c: 2, d: [ 0, 1, 2, 3, 4 ] }
myObject.freeze()
console.log(myObject.frozen) // true
myObject.state.c = 3
myObject.thaw()
console.log(myObject.frozen) // false
console.log(myObject.state) // { a: 0, b: 1, c: 2, d: [ 0, 1, 2, 3, 4 ] }

Keywords

json

FAQs

Package last updated on 16 Nov 2021

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