Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Very deep objects take a long time to stringify, maybe add a depth option ? #16

Open
netei opened this issue Feb 25, 2016 · 0 comments
Open

Comments

@netei
Copy link

netei commented Feb 25, 2016

I've been trying to log some objects that are very deep, but I'm actually not interested in the full object, just the parts that are not at a too big depth.

I know the current implementation relies on JSON.stringify, which has no depth option, so I'm not sure if it is possible to implement it from here.

Anyway, here's a code sample to reproduce :

  var rootFoo = [];
  var foo = rootFoo;
  for (var j = 0; j < 1000; j++) {
    foo[j] = [];
    for (var i = 0; i < 100; i++) {
      foo[j][i] = foo;
    }
    foo = foo[j]
  }

  process.stdout.write(require("json-stringify-safe")(rootFoo) + "\n");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant