Skip to content
Check circular reference and print its attribute chain
JavaScript
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
.gitignore
LICENSE
README.md
example.png
index.js
package.json
test.js

README.md

Check Circular Reference · GitHub license npm version

A tool that check an object whether exist circular reference and print its attribute chain.

Installation

npm install check-circular-reference --save

Usage

Node

let check = require('check-circular-reference');

// The obj that you will check
check(obj)

ES6

import check from 'check-circular-reference';

// The obj that you will check
check(obj)

Example

let check = require('check-circular-reference');
let menu = [
    {
        label: 'Home',
        children: [
            {
                label: 'Product'
            }
        ],
    },
    {
        label: 'About',
        extend: {}
    }
];
menu[0].children[0].parent = menu[0];
menu[1].extend.home = menu[0].children[0];
check(menu);

circular reference example screenshot

Relative Links

Understanding The Error ‘Converting circular structure to JSON’

You can’t perform that action at this time.