npm.io
0.2.9 • Published 6 years ago

ice-to-plain

Licence
GPL-2.0
Version
0.2.9
Deps
2
Size
47 kB
Vulns
0
Weekly
0
Stars
1

Ice to Plain npm version Build Status

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);