Skip to content

Instantly share code, notes, and snippets.

@rquast
Last active July 5, 2016 00:19
Show Gist options
  • Save rquast/e5ddf9f0ab7d2f189892c92c309c04b8 to your computer and use it in GitHub Desktop.
Save rquast/e5ddf9f0ab7d2f189892c92c309c04b8 to your computer and use it in GitHub Desktop.
    var cache = [];
    console.log(JSON.parse(JSON.stringify(this, function(key, value) {
      if (typeof value === 'object' && value !== null) {
        if (cache.indexOf(value) !== -1) {
          return;
        }
        cache.push(value);
      }
      return value;
    })));
    cache = null;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment