Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/aikoven/ice-to-plain
Convert Ice stuff to and from plain JS objects
https://github.com/aikoven/ice-to-plain
Last synced: 3 days ago
JSON representation
Convert Ice stuff to and from plain JS objects
- Host: GitHub
- URL: https://github.com/aikoven/ice-to-plain
- Owner: aikoven
- Created: 2018-01-22T09:59:29.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2022-12-07T09:21:59.000Z (about 2 years ago)
- Last Synced: 2024-12-23T23:33:14.348Z (11 days ago)
- Language: TypeScript
- Size: 459 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 14
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Ice to Plain [![npm version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url]
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
```ts
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);
```[npm-image]: https://badge.fury.io/js/ice-to-plain.svg
[npm-url]: https://badge.fury.io/js/ice-to-plain
[travis-image]: https://travis-ci.org/aikoven/ice-to-plain.svg?branch=master
[travis-url]: https://travis-ci.org/aikoven/ice-to-plain