3 ms·
> Very large arrays are now truncated when passed through util.inspect(), this also applies to console.log() and friends. This is a funny one, in conjunction w
by jakub_g 10y ago
> Very large arrays are now truncated when passed through util.inspect(), this also applies to console.log() and friends.
This is a funny one, in conjunction with the facts about npm that 1) npm has no public programmatic API (and zero docs on it), 2) npm devs encourage you to exec() stuff and read stdout, as all the internal methods can be changed/removed at any time, also in non-semver-major.
I used to have script doing `npm view | grep ...` which now fails under node 6. The best solution I guess is to use a hardcoded version of npm as a dependency and rely on programmatic API rather than stdout.
- JaRail 10y agoThe output of npm view is essentially a version of the package.json. That's a pretty standard structure. You can form some of the fields in different ways. But why would you want to grep through json when you can parse it?
- jakub_g 10y agoit's not a standard JSON, it's a `console.dir()`, keys are not quoted hence any JSON parser would choke on it, and due to the change in console methods, you can have "..." in long arrays. It's unparseable (not a valid JSON), and ungreppable too (not full arrays are printed).