Skip to content

sort(A) and sort(A, d => d) are not equivalent #217

@Fil

Description

@Fil

in the way they handle non-comparable values:

const A = [1, undefined, -1];
d3.sort(A); // [-1, 1, undefined]
d3.sort(A, d => d); // [1, undefined, -1]

not sure if this should be considered a bug or not, but it can be surprising. The basic caveat is that having an undefined value (and after #210, a null), will throw a wrench into sorting—maybe it's something to add to the documentation instead.

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to docsquestionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions