@mll-lab/js-utils 2.28.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 +9 -2
- package/dist/date.d.ts +2 -0
- package/dist/file.d.ts +1 -3
- package/dist/germanNumber.d.ts +1 -1
- package/dist/index.common.js +193 -880
- package/dist/index.common.js.map +1 -1
- package/dist/index.js +193 -880
- package/dist/index.js.map +1 -1
- package/dist/predicates.d.ts +1 -1
- package/dist/types.check.d.ts +5 -5
- package/dist/types.d.ts +9 -9
- package/package.json +15 -14
package/dist/array.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Maybe } from './types';
|
|
2
|
-
export
|
|
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.
|
|
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/date.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export declare function isToday(date: Date | string | number): boolean;
|
|
2
2
|
export declare function isFuture(date: Date | string | number): boolean;
|
|
3
|
+
export declare function isValidGermanDate(date: string): boolean;
|
|
4
|
+
export declare function isTimeWithHoursAndMinutes(time: string): boolean;
|
|
3
5
|
export declare function parseDate(value: string, formatString: string): Date | null;
|
|
4
6
|
export declare function parseGermanDateFlexible(value: string): Date | null;
|
|
5
7
|
export declare const GERMAN_DATE_FORMAT = "dd.MM.y";
|
package/dist/file.d.ts
CHANGED
package/dist/germanNumber.d.ts
CHANGED
|
@@ -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
|
-
|
|
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;
|