JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 37
  • Score
    100M100P100Q86615F
  • License MIT

Safely stringify & parse circular references to & from JSON using JSON pointers

Package Exports

  • refify

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

Readme

refify

Synopsis

var refify = require('refify');

var o = {};
o.circular = o;

refify(o)                           //=> {circular: {$ref: "#/"}}
refify.stringify(o)                 //=> '{"circular":{"$ref":"#/"}}'
refify.parse('{"o":{"$ref":"#/"}}') //=> {circular: [Circular]}

Description

This module allows you to safely JSON.stringify objects with circular references. Circular references are replaced with document-relative JSON references. This provides a clear and unambiguous encoding that is already supported by other tools. A simple example:

Install

npm install refify

License

MIT