@mll-lab/js-utils 2.29.0 → 2.30.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 CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Maybe } from './types';
2
- export declare type NonEmptyArray<T> = Array<T> & {
2
+ export type NonEmptyArray<T> = Array<T> & {
3
3
  0: T;
4
4
  };
5
5
  export declare function isNonEmptyArray<T>(value: Array<T>): value is NonEmptyArray<T>;
@@ -44,8 +44,15 @@ export declare function toggleElement<T>(array: Array<T>, element: T): Array<T>;
44
44
  export declare function sortByArray<T extends string | number>(subject: Array<T>, recipe: Array<T>): Array<T>;
45
45
  /**
46
46
  * Takes a function that maps the values to sort and returns a compare function
47
- * using `String.prototype.localeCompare`, usable in `Array.sort` or similar APIs.
47
+ * using `String.prototype.localeCompare`, usable in `Array.toSorted` or similar APIs.
48
48
  *
49
49
  * null, undefined and the empty string are not distinguished and first in sort order.
50
50
  */
51
51
  export declare function makeStringCompareFn<TSortable>(map: (sortable: TSortable) => Maybe<string>): (a: TSortable, b: TSortable) => number;
52
+ /**
53
+ * Returns a compare function for values that are string, null or undefined,
54
+ * using `String.prototype.localeCompare`, usable in `Array.toSorted` or similar APIs.
55
+ *
56
+ * The empty string is first in sort order.
57
+ */
58
+ export declare function localeCompareStrings(a: string, b: string): number;
package/dist/file.d.ts CHANGED
@@ -1,4 +1,2 @@
1
- /**
2
- * Triggers a file download in the browser.
3
- */
1
+ /** Triggers a file download in the browser. */
4
2
  export declare function downloadBlob(blob: Blob, filename: string): void;
@@ -2,7 +2,7 @@ export declare const GERMAN_THOUSAND_SEPARATOR = ".";
2
2
  export declare const GERMAN_DECIMAL_SEPARATOR = ",";
3
3
  export declare const ENGLISH_THOUSAND_SEPARATOR = ",";
4
4
  export declare const ENGLISH_DECIMAL_SEPARATOR = ".";
5
- declare type FormatNumberOptions = Intl.NumberFormatOptions & {
5
+ type FormatNumberOptions = Intl.NumberFormatOptions & {
6
6
  defaultValue?: string;
7
7
  };
8
8
  export declare function formatGermanNumber(value: number | string | null | undefined, { defaultValue, ...localeOptions }?: FormatNumberOptions): string;