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

is-restorable

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

is-restorable

Checking instance's restorablity. Designed for testing.

  • 0.1.6
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
34
decreased by-12.82%
Maintainers
1
Weekly downloads
 
Created
Source

is-restorable CircleCI

Checking instance's restorablity. Designed for testing.

What is "Restorable"

Restorable is a characteristic of JavaScript classes whose instance meets the following requirement.

const jsonStr = JSON.stringify(instance)
const plain = JSON.parse(jsonStr)
const newInstance = new TheClass(plain)

assert.deepEqual(newInstance, instance)

Roughly, Restorable object is an instance which can re-created by passing its JSON object to the class constructor.

Restorable === shareable over environments

Class instances are subject to become JSON when they are passed over environments.

Class instance => JSON => Network server

Class instance => JSON => File, storage

Class instance => JSON => Redux store

Class instance => JSON => Web worker, another process

Restorable objects are easily restored from JSON in the passed environments.

Installation

npm install is-restorable

Usage

import isRestorable from 'is-restorable'

class Foo {
  constructor(params) {
    this.name = params.name
    this.age = params.age
    this.hasCar = params.hasCar || null
    this.info = params.info || {}
  }
}

const instance = new Foo({
  name: 'Shin Suzuki',
  age: 55,
  info: {
    foo: 400,
    bar: { baz: 'abcd' },
    abc: null,
  }
})
assert(isRestorable(instance))

Phenyl Family

is-restorable is one of Phenyl Family. Phenyl is a JavaScript Server/Client framework for State Synchronization over Environment(SSoE). Restorable instances are essential for state synchronization.

LICENSE

Apache License 2.0

FAQs

Package last updated on 30 May 2018

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