Socket
Socket
Sign inDemoInstall

teleport-javascript

Package Overview
Dependencies
0
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

teleport-javascript

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


Version published
Maintainers
1
Weekly downloads
419,499
decreased by-19.63%
Install size
39.3 kB

Weekly downloads

Readme

Source

teleport-javascript

Coverage Status Build Status License: ISC JavaScript Style Guide

A super light and fast JavaScript object (de)serialization that includes Date, BigInt, RegExp, 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,
  symbol: Symbol('key')
};
obj.circular = obj;

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

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

Supported Data Types

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

Benchmarks

Benchmark Results

License

ISC

Keywords

FAQs

Last updated on 13 Nov 2019

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc