JSPM

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

Check circular reference or mutable variable. Print its reference attribute chain.

Package Exports

  • check-circular-reference

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

Readme

Check Circular Reference · GitHub license npm version

Check circular reference or mutable variable. Print its reference attribute chain.

Installation

npm install check-circular-reference --save

Usage

Node

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

// The obj that you will check
let checkResult = check(obj);
if (checkResult.length === 0) {
    // do not exist circular reference or mutable variable    
} else {
    // exist circular reference or mutable variable    
}

ES6

import check from 'check-circular-reference';

// The obj that you will check
let checkResult = check(obj);
if (checkResult.length === 0) {
    // do not exist circular reference or mutable variable    
} else {
    // exist circular reference or mutable variable    
}

Example

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

circular reference example screenshot

Contribution

# install
npm install

# test
npm run test

About Circular Error

Understanding The Error ‘Converting circular structure to JSON’