JSON1 + Immutable.js
This module add supports for Immutable.js structures to ot-json1
.
Install
yarn add ot-json1-immutable ot-json1 immutable
Usage
Just import json from ot-json1-immutable
and use it exactly like specified by ot-json1
documentation. Use applyImmutable
to actually apply operations to any immutable structure.
;; const op = json1; let doc = a: 1 ;doc = json1type;// doc => new Map({ b: 1 })
applyImmutable
function also take a reviver, used by Immutable's fromJS
:
=> { if ! return value; } const op = json1;let doc = {}; doc = json1type; // doc.get('a') => new Block()