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

Logging/printing of nj.array (and others) does not match example output #97

Open
TidbitSoftware opened this issue Jun 4, 2021 · 2 comments

Comments

@TidbitSoftware
Copy link

Following the examples, when logging printing an array,

var myArr = nj.array([2,3,4]);
console.log(myArr);

I get,

Object { selection: {…}, … }

in Firefox (and something similar in Safari). I can get the intended output with,

console.log(myArr.selection.data);

but this is a bit more long-handed. I would really like to use your package for a JavaScript API translation from Python, but this point is currently a hang up.

Is this behavior reproducible? Am I otherwise missing something here? Thanks!

Using: tagged release 0.16.0, including dist/numjs.min.js (I have also tried with the unminified copy and with the CDN copy of version 0.15.1, just to be sure).

@awillats
Copy link

console.log( myArray.toString() )
to get a string representation, possibly condensed
or
console.log ( myArray.tolist() )
to print the entire array as a js array both work for me.

I would be very careful about using .selection.data as when I tried slicing an array, tolist() produce an array of the correct size, but .selection.data was the size of the original array

@grimmer0125
Copy link
Collaborator

Originally, numjs supports to use console.log(myArray) to achieve toString's effect in Node.js. But Node.js has changed its API for the inspect part so it will not work anymore. I've published a forked package to use the new inspect API in Node.js, https://www.npmjs.com/package/@d4c/numjs.

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

3 participants