【文件属性】:
文件名称:ref-replace:替换JSON对象中的$ ref,以便可以将它们存储在Mongo中
文件大小:33KB
文件格式:ZIP
更新时间:2021-05-04 06:09:44
mongo json ref JavaScript
参考替换
一个在JSON对象中转换$ref并将其替换为_ref的模块,以便可以将其存储在Mongo中,反之亦然。
我创建此模块是因为$ref是和的标准。
用法
import { replaceRefsJSON , replaceRefsMongo } from 'ref-replace' ;
const someJSON = {
$ref : 'test' ,
test : {
$ref : 'test' ,
test : {
$ref : 'test'
}
}
} ;
console . log ( replaceRefsJSON ( someJSON ) )
/**
Output:
{
_ref: 'test',
test: {
_ref: 'test',
test: {
_ref: 'test'
【文件预览】:
ref-replace-master
----index.js(857B)
----test.js(2KB)
----package.json(581B)
----readme.md(858B)
----.gitignore(14B)
----yarn.lock(113KB)