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

least and greatest should ignore nulls #208

Closed
Fil opened this issue Jun 3, 2021 · 0 comments
Closed

least and greatest should ignore nulls #208

Fil opened this issue Jun 3, 2021 · 0 comments
Assignees

Comments

@Fil
Copy link
Member

Fil commented Jun 3, 2021

d3.least([1, null]) returns null, and d3.greatest([-1, null]) returns null, contrary to the other reducers (such as min, max, median…) which are all skipping nulls.

Interestingly, d3.leastIndex and d3.greatestIndex do not return the same result when using the default and identity accessors (because it follows two different code paths):

d3.leastIndex([1, null]); // 1 [bug]
d3.leastIndex([1, null], d => d); // 0 [correct answer]

This issue is similar to #203.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

1 participant