decimal.js-extensions-serialize
v0.1.0
Published
A decimal.js extension for Decimal to ArrayBuffer serialization
Downloads
3
Readme
A decimal.js extension for
Decimal to ArrayBuffer serialization
Usage example
import Decimal from 'decimal.js';
import { serialize } from 'decimal.js-extensions-serialize';
serialize.extend(Decimal);
const x = new Decimal('1234567899.54645456456456546213253466');
const buffer = x.toArrayBuffer();
const y = Decimal.fromArrayBuffer(buffer);
console.log(x.eq(y) ? 'Success' : 'Failure');
Test
$ npm test