Comparator that orders null or undefined values before anything else.
All non-null values will be considered equal. So consider using compareWith to chain another comparator for comparing non-null values.
Note that Array.sort always sorts undefined values to the end.
undefined
nullsFirst(0, null) // -> 1nullsFirst(null, "foo") // -> -1nullsFirst(null, null) // -> 0nullsFirst(null, undefined) // -> 0 Copy
nullsFirst(0, null) // -> 1nullsFirst(null, "foo") // -> -1nullsFirst(null, null) // -> 0nullsFirst(null, undefined) // -> 0
Comparator that orders null or undefined values before anything else.
All non-null values will be considered equal. So consider using compareWith to chain another comparator for comparing non-null values.
Note that Array.sort always sorts
undefined
values to the end.