bigint-serde

1.0.0 • Public • Published

bigint-serde

JS implementation of JSON serialization of BigInt and BigUint types from Rust num-bigint crate

Build Status Coverage Status

Example

BigInt

const {
    toJSON,
    fromJSON,
} = require('bigint-serde');
 
console.log(toJSON(-123456789123456789n)); // → [-1,[2899336981,28744523]]
console.log(fromJSON([-1,[2899336981,28744523]])); // → -123456789123456789n

BigUint

const {
    toJSON,
    fromJSON,
} = require('bigint-serde/unsigned');
 
console.log(toJSON(123456789123456789n)); // → [2899336981,28744523]
console.log(fromJSON([2899336981,28744523])); // → 123456789123456789n

Install

yarn add bigint-serde

Readme

Keywords

none

Package Sidebar

Install

npm i bigint-serde

Weekly Downloads

1

Version

1.0.0

License

MIT OR GPL-3.0-or-later

Unpacked Size

6.72 kB

Total Files

13

Last publish

Collaborators

  • futpib