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

Bug on the Series toArray method removing all the null values #156

Open
murunwas opened this issue Jan 19, 2023 · 2 comments
Open

Bug on the Series toArray method removing all the null values #156

murunwas opened this issue Jan 19, 2023 · 2 comments

Comments

@murunwas
Copy link

Bug on the Series toArray method removing all the null values

Example

const {Series} = require('data-forge');
const series = new Series([null,null,10, 20,null, 30, 40]);
console.log(series.count());
//count=7
console.log(series.toArray());
//results=[ 10, 20, 30, 40 ]
@ashleydavis
Copy link
Member

Hey @murunwas would you mind forking the repo and contributing a failing test for this problem? Then I can work towards fixing the issue and making your test pass.

@madnetter
Copy link
Contributor

It appears that filtering out null objects is an explicitly defined behavior (at least there are tests in the suite verifying it). When changing this behavior a number of tests failed.

I created a PR that may resolve this issue: #172. This involves the addition of an optional parameter object to the toArray method that allows the caller to specify that they want nulls included. The existing API is maintained and all previously existing tests pass.

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