@mll-lab/js-utils 2.39.0 → 2.40.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/array.d.ts +2 -2
- package/dist/index.common.js +6 -3
- package/dist/index.common.js.map +1 -1
- package/dist/index.js +6 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -9598,10 +9598,13 @@ function makeBooleanCompareFn(map) {
|
|
|
9598
9598
|
* Takes a function that maps the values to sort to Dates and returns a compare function
|
|
9599
9599
|
* using their timestamps, usable in `Array.toSorted` or similar APIs.
|
|
9600
9600
|
*
|
|
9601
|
-
* null and undefined are coalesced to
|
|
9601
|
+
* null and undefined are coalesced to the oldest possible date and thus not distinguished and first in sort order.
|
|
9602
9602
|
*/
|
|
9603
|
-
function makeDateCompareFn(map
|
|
9604
|
-
|
|
9603
|
+
function makeDateCompareFn(map,
|
|
9604
|
+
// See https://stackoverflow.com/a/11526569 for an explanation of this value.
|
|
9605
|
+
fallbackValue = new Date(-8640000000000000)) {
|
|
9606
|
+
const fallbackTime = fallbackValue.getTime();
|
|
9607
|
+
return makeNumberCompareFn((sortable) => { var _a, _b; return (_b = (_a = map(sortable)) === null || _a === void 0 ? void 0 : _a.getTime()) !== null && _b !== void 0 ? _b : fallbackTime; });
|
|
9605
9608
|
}
|
|
9606
9609
|
/**
|
|
9607
9610
|
* Returns a compare function for values that are string, null or undefined,
|