JSPM

teleport-javascript

0.2.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 645936
  • Score
    100M100P100Q181525F
  • License ISC

A super light and fast JavaScript object (de)serialization that includes undefined, bigint, regex, etc.

Package Exports

  • teleport-javascript

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 (teleport-javascript) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

teleport-javascript

Coverage Status Build Status License: ISC

A super light and fast JavaScript object (de)serialization that includes undefined, bigint, regex, etc.

Installation

$ npm -i teleport-javascript

Usage

const {parse, stringify} = require('teleport-javascript');

const obj = {
  key: 'value',
  undefined: undefined,
  regex: /a-z/gi,
  set: new Set([-Infinity, NaN, Infinity]),
  bigint: 900719925474099123n
};
obj.circular = obj;

const stringified = stringify(obj);
// '[{"key":"1","undefined":"_0","regex":"_1","set":"_2","bigint":"_3","circular":"0"},"value",["u","R;/a-z/gi","S;[[\\"_0\\",\\"_1\\",\\"_2\\"],[\\"n;-Infinity\\",\\"n;NaN\\",\\"n;Infinity\\"]]","b;900719925474099123"]]'

const parsed = parse(stringified);
// {
//   key: 'value',
//   undefined: undefined,
//   regex: /a-z/gi,
//   set: Set { -Infinity, NaN, Infinity },
//   bigint: 900719925474099123n,
//   circular: [Circular]
// }

Supported Data Types

  • String
  • Number (including NaN, Infinity, -Infinity)
  • BigInt
  • Boolean
  • Null
  • Undefined
  • Array
    • Int8Array
    • Uint8Array
    • Uint8ClampedArray
    • Int16Array
    • Uint16Array
    • Int32Array
    • Uint32Array
    • Float32Array
    • Float64Array
  • Symbol
  • Object (including circular reference)
    • RegExp
    • Map
    • Set

Benchmarks

Benchmark Results

License

ISC