@tutao/tutanota-utils 3.93.5 → 3.94.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/ArrayUtils.d.ts +44 -39
- package/dist/ArrayUtils.js +220 -229
- package/dist/AsyncResult.d.ts +17 -15
- package/dist/AsyncResult.js +33 -21
- package/dist/CollectionUtils.d.ts +1 -1
- package/dist/CollectionUtils.js +1 -1
- package/dist/DateUtils.d.ts +18 -18
- package/dist/DateUtils.js +40 -38
- package/dist/Encoding.d.ts +25 -25
- package/dist/Encoding.js +175 -181
- package/dist/LazyLoaded.d.ts +32 -32
- package/dist/LazyLoaded.js +65 -66
- package/dist/MapUtils.d.ts +4 -4
- package/dist/MapUtils.js +24 -25
- package/dist/MathUtils.d.ts +2 -2
- package/dist/MathUtils.js +2 -2
- package/dist/PromiseMap.d.ts +8 -4
- package/dist/PromiseMap.js +49 -50
- package/dist/PromiseUtils.d.ts +19 -16
- package/dist/PromiseUtils.js +72 -76
- package/dist/SortedArray.d.ts +11 -11
- package/dist/SortedArray.js +30 -30
- package/dist/StringUtils.d.ts +14 -14
- package/dist/StringUtils.js +31 -36
- package/dist/TypeRef.d.ts +11 -10
- package/dist/TypeRef.js +15 -12
- package/dist/Utils.d.ts +59 -53
- package/dist/Utils.js +207 -227
- package/dist/index.d.ts +145 -19
- package/dist/index.js +140 -14
- package/dist/tsbuildinfo +1 -1
- package/package.json +2 -2
package/dist/ArrayUtils.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export declare function concat(...arrays: Uint8Array[]): Uint8Array
|
|
1
|
+
export declare function concat(...arrays: Uint8Array[]): Uint8Array
|
|
2
2
|
/**
|
|
3
3
|
* Create an array filled with the numbers min..max (inclusive)
|
|
4
4
|
*/
|
|
5
|
-
export declare function numberRange(min: number, max: number): Array<number
|
|
5
|
+
export declare function numberRange(min: number, max: number): Array<number>
|
|
6
6
|
/**
|
|
7
7
|
* Compares two arrays for equality based on ===.
|
|
8
8
|
* @param {Array} a1 The first array.
|
|
@@ -11,7 +11,7 @@ export declare function numberRange(min: number, max: number): Array<number>;
|
|
|
11
11
|
*
|
|
12
12
|
* It is valid to compare Uint8Array to Array<T>, don't restrict it to be one type
|
|
13
13
|
*/
|
|
14
|
-
export declare function arrayEquals<T, A extends Uint8Array | Array<T>>(a1: A, a2: A): boolean
|
|
14
|
+
export declare function arrayEquals<T, A extends Uint8Array | Array<T>>(a1: A, a2: A): boolean
|
|
15
15
|
/**
|
|
16
16
|
* Compares two arrays for equality based on a predicate
|
|
17
17
|
* @param a1
|
|
@@ -19,51 +19,51 @@ export declare function arrayEquals<T, A extends Uint8Array | Array<T>>(a1: A, a
|
|
|
19
19
|
* @param predicate
|
|
20
20
|
* @returns {boolean}
|
|
21
21
|
*/
|
|
22
|
-
export declare function arrayEqualsWithPredicate<T>(a1: ReadonlyArray<T>, a2: ReadonlyArray<T>, predicate: (arg0: T, arg1: T) => boolean): boolean
|
|
23
|
-
export declare function arrayHash(array: Uint8Array): number
|
|
22
|
+
export declare function arrayEqualsWithPredicate<T>(a1: ReadonlyArray<T>, a2: ReadonlyArray<T>, predicate: (arg0: T, arg1: T) => boolean): boolean
|
|
23
|
+
export declare function arrayHash(array: Uint8Array): number
|
|
24
24
|
/**
|
|
25
25
|
* Remove the element from theArray if it is contained in the array.
|
|
26
26
|
* @param theArray The array to remove the element from.
|
|
27
27
|
* @param elementToRemove The element to remove from the array.
|
|
28
28
|
* @return True if the element was removed, false otherwise.
|
|
29
29
|
*/
|
|
30
|
-
export declare function remove<T>(theArray: Array<T>, elementToRemove: T): boolean
|
|
30
|
+
export declare function remove<T>(theArray: Array<T>, elementToRemove: T): boolean
|
|
31
31
|
/**
|
|
32
32
|
* Find all items in an array that pass the given predicate
|
|
33
33
|
*/
|
|
34
|
-
export declare function findAll<T>(theArray: Array<T>, finder: (arg0: T) => boolean): Array<T
|
|
34
|
+
export declare function findAll<T>(theArray: Array<T>, finder: (arg0: T) => boolean): Array<T>
|
|
35
35
|
/**
|
|
36
36
|
* @param theArray
|
|
37
37
|
* @param finder
|
|
38
38
|
* @return {boolean} if the element was found
|
|
39
39
|
*/
|
|
40
|
-
export declare function findAndRemove<T>(theArray: Array<T>, finder: (arg0: T) => boolean): boolean
|
|
41
|
-
export declare function findAllAndRemove<T>(theArray: Array<T>, finder: (arg0: T) => boolean, startIndex?: number): boolean
|
|
42
|
-
export declare function replace(theArray: Array<any>, oldElement: any, newElement: any): boolean
|
|
40
|
+
export declare function findAndRemove<T>(theArray: Array<T>, finder: (arg0: T) => boolean): boolean
|
|
41
|
+
export declare function findAllAndRemove<T>(theArray: Array<T>, finder: (arg0: T) => boolean, startIndex?: number): boolean
|
|
42
|
+
export declare function replace(theArray: Array<any>, oldElement: any, newElement: any): boolean
|
|
43
43
|
/**
|
|
44
44
|
* Same as filterMap in some languages. Apply mapper and then only include non-nullable items.
|
|
45
45
|
*/
|
|
46
|
-
export declare function mapAndFilterNull<T, R>(array: ReadonlyArray<T>, mapper: (arg0: T) => R | null | undefined): Array<R
|
|
47
|
-
export declare function filterNull<T>(array: ReadonlyArray<T | null | undefined>): Array<T
|
|
46
|
+
export declare function mapAndFilterNull<T, R>(array: ReadonlyArray<T>, mapper: (arg0: T) => R | null | undefined): Array<R>
|
|
47
|
+
export declare function filterNull<T>(array: ReadonlyArray<T | null | undefined>): Array<T>
|
|
48
48
|
/**
|
|
49
49
|
* Provides the last element of the given array.
|
|
50
50
|
* @param theArray The array.
|
|
51
51
|
* @return The last element of the array.
|
|
52
52
|
*/
|
|
53
|
-
export declare function last<T>(theArray: ReadonlyArray<T>): T | null | undefined
|
|
54
|
-
export declare function isEmpty<T>(array: ReadonlyArray<T>): boolean
|
|
55
|
-
export declare function lastThrow<T>(array: ReadonlyArray<T>): T
|
|
56
|
-
export declare function firstThrow<T>(array: ReadonlyArray<T>): T
|
|
57
|
-
export declare function first<T>(array: ReadonlyArray<T>): T | null
|
|
58
|
-
export declare function findLast<T>(array: Array<T>, predicate: (arg0: T) => boolean): T | null | undefined
|
|
59
|
-
export declare function findLastIndex<T>(array: Array<T>, predicate: (arg0: T) => boolean): number
|
|
60
|
-
export declare function contains(theArray: Array<any>, elementToCheck: any): boolean
|
|
61
|
-
export declare function addAll(array: Array<any>, elements: Array<any>): void
|
|
62
|
-
export declare function removeAll(array: Array<any>, elements: Array<any>): void
|
|
53
|
+
export declare function last<T>(theArray: ReadonlyArray<T>): T | null | undefined
|
|
54
|
+
export declare function isEmpty<T>(array: ReadonlyArray<T>): boolean
|
|
55
|
+
export declare function lastThrow<T>(array: ReadonlyArray<T>): T
|
|
56
|
+
export declare function firstThrow<T>(array: ReadonlyArray<T>): T
|
|
57
|
+
export declare function first<T>(array: ReadonlyArray<T>): T | null
|
|
58
|
+
export declare function findLast<T>(array: Array<T>, predicate: (arg0: T) => boolean): T | null | undefined
|
|
59
|
+
export declare function findLastIndex<T>(array: Array<T>, predicate: (arg0: T) => boolean): number
|
|
60
|
+
export declare function contains(theArray: Array<any>, elementToCheck: any): boolean
|
|
61
|
+
export declare function addAll(array: Array<any>, elements: Array<any>): void
|
|
62
|
+
export declare function removeAll(array: Array<any>, elements: Array<any>): void
|
|
63
63
|
/**
|
|
64
64
|
* Group an array based on the given discriminator, but each group will have only unique items
|
|
65
65
|
*/
|
|
66
|
-
export declare function groupByAndMapUniquely<T, R, E>(iterable: Iterable<T>, discriminator: (arg0: T) => R, mapper: (arg0: T) => E): Map<R, Set<E
|
|
66
|
+
export declare function groupByAndMapUniquely<T, R, E>(iterable: Iterable<T>, discriminator: (arg0: T) => R, mapper: (arg0: T) => E): Map<R, Set<E>>
|
|
67
67
|
/**
|
|
68
68
|
* convert an Array of T's into a Map of Arrays of E's by
|
|
69
69
|
* * grouping them based on a discriminator
|
|
@@ -73,14 +73,14 @@ export declare function groupByAndMapUniquely<T, R, E>(iterable: Iterable<T>, di
|
|
|
73
73
|
* @param mapper a function that maps the array elements before they get added to the group
|
|
74
74
|
* @returns {Map<R, Array<E>>}
|
|
75
75
|
*/
|
|
76
|
-
export declare function groupByAndMap<T, R, E>(iterable: Iterable<T>, discriminator: (arg0: T) => R, mapper: (arg0: T) => E): Map<R, Array<E
|
|
76
|
+
export declare function groupByAndMap<T, R, E>(iterable: Iterable<T>, discriminator: (arg0: T) => R, mapper: (arg0: T) => E): Map<R, Array<E>>
|
|
77
77
|
/**
|
|
78
78
|
* Group array elements based on keys produced by a discriminator
|
|
79
79
|
* @param iterable the array to split into groups
|
|
80
80
|
* @param discriminator a function that produces the keys to group the elements by
|
|
81
81
|
* @returns {NodeJS.Global.Map<R, Array<T>>}
|
|
82
82
|
*/
|
|
83
|
-
export declare function groupBy<T, R>(iterable: Iterable<T>, discriminator: (arg0: T) => R): Map<R, Array<T
|
|
83
|
+
export declare function groupBy<T, R>(iterable: Iterable<T>, discriminator: (arg0: T) => R): Map<R, Array<T>>
|
|
84
84
|
/**
|
|
85
85
|
* split an array into chunks of a given size.
|
|
86
86
|
* the last chunk will be smaller if there are less than chunkSize elements left.
|
|
@@ -88,15 +88,15 @@ export declare function groupBy<T, R>(iterable: Iterable<T>, discriminator: (arg
|
|
|
88
88
|
* @param array
|
|
89
89
|
* @returns {Array<Array<T>>}
|
|
90
90
|
*/
|
|
91
|
-
export declare function splitInChunks<T>(chunkSize: number, array: Array<T>): Array<Array<T
|
|
92
|
-
export declare function flat<T>(arrays: ReadonlyArray<ReadonlyArray<T>>): Array<T
|
|
91
|
+
export declare function splitInChunks<T>(chunkSize: number, array: Array<T>): Array<Array<T>>
|
|
92
|
+
export declare function flat<T>(arrays: ReadonlyArray<ReadonlyArray<T>>): Array<T>
|
|
93
93
|
/**
|
|
94
94
|
* Maps an array into a nested array and then flattens it
|
|
95
95
|
* @param array
|
|
96
96
|
* @param mapper
|
|
97
97
|
* @returns {T|*[]}
|
|
98
98
|
*/
|
|
99
|
-
export declare function flatMap<T, U>(array: ReadonlyArray<T>, mapper: (arg0: T) => Array<U>): Array<U
|
|
99
|
+
export declare function flatMap<T, U>(array: ReadonlyArray<T>, mapper: (arg0: T) => Array<U>): Array<U>
|
|
100
100
|
/**
|
|
101
101
|
* Inserts element into the sorted array. Will find <b>the last</b> matching position.
|
|
102
102
|
* Might add or replace element based on {@param replaceIf} identity check.
|
|
@@ -106,9 +106,14 @@ export declare function flatMap<T, U>(array: ReadonlyArray<T>, mapper: (arg0: T)
|
|
|
106
106
|
* @param comparator for sorting
|
|
107
107
|
* @param replaceIf identity comparison for replacement
|
|
108
108
|
*/
|
|
109
|
-
export declare function insertIntoSortedArray<T>(
|
|
110
|
-
|
|
111
|
-
|
|
109
|
+
export declare function insertIntoSortedArray<T>(
|
|
110
|
+
element: T,
|
|
111
|
+
array: Array<T>,
|
|
112
|
+
comparator: (left: T, right: T) => number,
|
|
113
|
+
replaceIf?: (newElement: T, existing: T) => boolean,
|
|
114
|
+
): void
|
|
115
|
+
export declare function zip<A, B>(arr1: Array<A>, arr2: Array<B>): Array<[A, B]>
|
|
116
|
+
export declare function deduplicate<T>(arr: Array<T>, comp?: (arg0: T, arg1: T) => boolean): Array<T>
|
|
112
117
|
/**
|
|
113
118
|
* http://jsfiddle.net/aryzhov/pkfst550/
|
|
114
119
|
* Binary search in JavaScript.
|
|
@@ -123,12 +128,12 @@ export declare function deduplicate<T>(arr: Array<T>, comp?: (arg0: T, arg1: T)
|
|
|
123
128
|
* The array may contain duplicate elements. If there are more than one equal elements in the array,
|
|
124
129
|
* the returned value can be the index of any one of the equal elements.
|
|
125
130
|
*/
|
|
126
|
-
export declare function binarySearch<T>(ar: Array<T>, el: T, compare_fn: (arg0: T, arg1: T) => number): number
|
|
127
|
-
export declare function lastIndex<T>(array: ReadonlyArray<T>): number
|
|
131
|
+
export declare function binarySearch<T>(ar: Array<T>, el: T, compare_fn: (arg0: T, arg1: T) => number): number
|
|
132
|
+
export declare function lastIndex<T>(array: ReadonlyArray<T>): number
|
|
128
133
|
/**
|
|
129
134
|
* All of the elements in all of the arguments combined, and deduplicated
|
|
130
135
|
*/
|
|
131
|
-
export declare function union<T>(...iterables: Array<Iterable<T>>): Set<T
|
|
136
|
+
export declare function union<T>(...iterables: Array<Iterable<T>>): Set<T>
|
|
132
137
|
/**
|
|
133
138
|
* return a new array containing every item from array1 that isn't in array2
|
|
134
139
|
* @param array1
|
|
@@ -136,27 +141,27 @@ export declare function union<T>(...iterables: Array<Iterable<T>>): Set<T>;
|
|
|
136
141
|
* @param compare: compare items in the array for equality
|
|
137
142
|
* @returns {Array<$NonMaybeType<T>>|Array<T>}
|
|
138
143
|
*/
|
|
139
|
-
export declare function difference<T>(array1: ReadonlyArray<T>, array2: ReadonlyArray<T>, compare?: (arg0: T, arg1: T) => boolean): Array<T
|
|
144
|
+
export declare function difference<T>(array1: ReadonlyArray<T>, array2: ReadonlyArray<T>, compare?: (arg0: T, arg1: T) => boolean): Array<T>
|
|
140
145
|
/**
|
|
141
146
|
* Returns a set with elements that are *not* in both sets.
|
|
142
147
|
*
|
|
143
148
|
* {a, b, c} △ {b, c, d} == {a, d}
|
|
144
149
|
*/
|
|
145
|
-
export declare function symmetricDifference<T>(set1: ReadonlySet<T>, set2: ReadonlySet<T>): Set<T
|
|
150
|
+
export declare function symmetricDifference<T>(set1: ReadonlySet<T>, set2: ReadonlySet<T>): Set<T>
|
|
146
151
|
/**
|
|
147
152
|
* Splits an array into two based on a predicate, where elements that match the predicate go into the left side
|
|
148
153
|
* @param array
|
|
149
154
|
* @param predicate
|
|
150
155
|
*/
|
|
151
|
-
export declare function partition<T>(array: Array<T>, predicate: (arg0: T) => boolean): [Array<T>, Array<T>]
|
|
156
|
+
export declare function partition<T>(array: Array<T>, predicate: (arg0: T) => boolean): [Array<T>, Array<T>]
|
|
152
157
|
/**
|
|
153
158
|
* like partition(), but async
|
|
154
159
|
* rejects if any of the predicates reject.
|
|
155
160
|
* @param array
|
|
156
161
|
* @param predicate
|
|
157
162
|
*/
|
|
158
|
-
export declare function partitionAsync<T>(array: Array<T>, predicate: (arg0: T) => Promise<boolean>): Promise<[Array<T>, Array<T>]
|
|
163
|
+
export declare function partitionAsync<T>(array: Array<T>, predicate: (arg0: T) => Promise<boolean>): Promise<[Array<T>, Array<T>]>
|
|
159
164
|
/**
|
|
160
165
|
* Create an array with n elements by calling the provided factory
|
|
161
166
|
*/
|
|
162
|
-
export declare function arrayOf<T>(n: number, factory: (idx: number) => T): Array<T
|
|
167
|
+
export declare function arrayOf<T>(n: number, factory: (idx: number) => T): Array<T>
|