@valentech/circular-stringify

1.0.0 • Public • Published

@valentech/circular-stringify

A utility for circular JSON stringify and parse.

Installation

npm install @valentech/circular-stringify

Usage

const Circular = require('@valentech/circular-stringify')

const circularObj = { name: 'Alice' }
circularObj.self = circularObj

const jsonString = Circular.stringify(circularObj, null, 2)
console.log('Serialized:', jsonString)

const restoredObj = Circular.parse(jsonString)
console.log('Restored:', restoredObj)
console.log(
  'Is circular (restoredObj.self === restoredObj):',
  restoredObj.self === restoredObj
)

Readme

Keywords

none

Package Sidebar

Install

npm i @valentech/circular-stringify

Weekly Downloads

5

Version

1.0.0

License

MIT

Unpacked Size

3.94 kB

Total Files

4

Last publish

Collaborators

  • valentech