🚀 DAY 5 OF LAUNCH WEEK: Introducing Socket Firewall Enterprise.Learn more →
Socket
Book a DemoInstallSign in
Socket

what-is-circular

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

what-is-circular

Like is-circular, but returns the path to the first circular reference found.

latest
Source
npmnpm
Version
1.0.1
Version published
Maintainers
1
Created
Source

what-is-circular Build Status

Like is-circular, but returns the path to the first circular reference found.

Installation

npm install what-is-circular

Usage

whatIsCircular(obj)

Returns an array that contains the path to the first circular reference found, or undefined if no circular reference is found.

Example

var whatIsCircular = require('what-is-circular')

var circularObj = {
  foo: 1,
  bar: 2
}
// qux.baz is the circular reference
circularObj.qux = {
  baz: circularObj
}

whatIsCircular(circularObj) // ['qux', 'baz']

var obj = {
  foo: 1,
  bar: 2,
  qux: 3
}

whatIsCircular(obj) // undefined

License

MIT

Thanks

Thanks to @tjmehta's is-circular for providing the tests and README for this project.

Thanks to @angus-c's just-is-circular for contributing additional tests.

FAQs

Package last updated on 14 Jun 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts