Skip to content

Instantly share code, notes, and snippets.

@afanasy
Created July 23, 2015 08:12
Show Gist options
  • Save afanasy/75ab4f92d1ff7bd48115 to your computer and use it in GitHub Desktop.
Save afanasy/75ab4f92d1ff7bd48115 to your computer and use it in GitHub Desktop.
Javascript function to detect if variable has circular references.
function isCircular (d) {
try {JSON.stringify(d)}
catch (e) {return true}
return false
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment