Package Exports
- jxo
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (jxo) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
JxO
Make almost any JavaScript Object JSON safe for use with JSON.stringify and JSON.parse. With support for circular references, Maps, Sets, Typed Arrays, Symbols and custom types.
Installation
npm install jxo
pnpm add jxo
yarn add jxoBasic Usage
Use as a replacement for JSON.stringify and JSON.parse
import { JxO } from 'jxo';
const JXO = new JxO();
const obj = {
supports: new Set([NaN, Infinity, undefined, new Date(), new Map([['and', 'more']])]),
};
const str = JXO.stringify(obj);
const res = JXO.parse(str);
Examples
See test.js for more examples.
TODO
- More examples
- Better fallback handing with customisation
- Validate the custom types
- Encoders for typed arrays
- Buffers