ice-to-plain
v0.2.9
Published
Convert Ice stuff to and from plain JS objects
Downloads
1,800
Readme
Ice to Plain
Convert Ice stuff to and from plain JS objects.
Supports long
, enum
, struct
, dictionary
, exception
and class
,
as well as JS objects, arrays, Maps and Sets.
Installation
$ npm install ice-to-plain
Usage
import {iceToPlain, iceToJson, iceFromPlain} from 'ice-to-plain';
import {isEqual} from 'lodash';
const plain = iceToPlain(someIceValue);
isEqual(someIceValue, iceFromPlain(plain)); // true
// 4-5x faster than JSON.stringify for Ice objects
// but 4-5x slower on regular JS objects
const json = iceToJson(someIceValue);