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 = JSONconst plain = JSONconst newInstance = plain assert
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
{ thisname = paramsname thisage = paramsage thishasCar = paramshasCar || null thisinfo = paramsinfo || {} } const instance = name: 'Shin Suzuki' age: 55 info: foo: 400 bar: baz: 'abcd' abc: null
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