just-is-circular
TypeScript icon, indicating that this package has built-in type declarations

2.2.0 • Public • Published

just-is-circular

Part of a library of zero-dependency npm modules that do just do one thing. Guilt-free utilities for every occasion.

🍦 Try it

npm install just-is-circular
yarn add just-is-circular

Return true if object has a circular reference NOTE: not supported in IE or microsoft edge

import isCircular from 'just-is-circular';
const a = {};
a.b = a;
isCircular(a); // true

const a = {};
a.b = {
  c: a
};
isCircular(a); // true

const a = {};
a.b = {
  c: 4
};
isCircular(a); // false

const a = [];
a.push(a);
isCircular(a); // true

isCircular({}); // false
isCircular('hi'); // false
isCircular(undefined); // false

Dependents (2)

Package Sidebar

Install

npm i just-is-circular

Weekly Downloads

214

Version

2.2.0

License

MIT

Unpacked Size

5.08 kB

Total Files

9

Last publish

Collaborators

  • angus-c