0.3.1 • Published 1 year ago
@ottomated/turbojson v0.3.1
@ottomated/turbojson
Serialize your javascript objects to binary quickly and easily.
THIS IS NOT READY FOR PRODUCTION USE
import { serialize, deserialize } from '@ottomated/turbojson';
const object = {
array: [1, null, 3],
string: 'Hello World',
date: new Date(),
numbers: [1.5, -Infinity, Infinity, NaN],
undefined: undefined,
regex: /test/ig,
set: new Set([true, false]),
bigint: 1234567890n,
symbol: Symbol('test'),
error: new Error('Error'),
};
const bytes: Uint8Array = serialize(object);
const object2 = deserialize(object);
// object deep-equals object2 (except for the Symbol of course)
Benchmarks & tests: TODO