refify

2018-11-08 admin

refify是什么

什么是refify,Safely stringify & parse circular references to & from JSON using JSON pointers

refify使用教程帮助文档

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.

Install

Refify uses a universal module definition, this means you can load it using whatever module system you like: CommonJS, AMD, or none at all.

If there is no module loader detected (e.g. you just have a plain <script src="refify.js"></script> in your HTML), refify will be defined globally.

License

MIT

本站文章除注明转载外,均为本站原创或编译。欢迎任何形式的转载,但请务必注明出处。

转载请注明:文章转载自 JavaScript中文网 [https://www.javascriptcn.com]

本文地址:https://www.javascriptcn.com/read-44861.html

文章标题:refify

回到顶部