Skip to content

least and greatest should ignore nulls #208

@Fil

Description

@Fil

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.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions