@tutao/tutanota-utils 3.94.0 → 3.94.1

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.
@@ -1,16 +1,16 @@
1
- export declare type CompareFn<T> = (arg0: T, arg1: T) => number
1
+ export declare type CompareFn<T> = (arg0: T, arg1: T) => number;
2
2
  /**
3
3
  * An array that keeps itself sorted
4
4
  */
5
5
  export declare class SortedArray<T> {
6
- readonly _contents: Array<T>
7
- readonly _compareFn: CompareFn<T>
8
- constructor(compareFn?: CompareFn<T>)
9
- static from<U>(array: ReadonlyArray<U>, compareFn?: CompareFn<U>): SortedArray<U>
10
- get length(): number
11
- get array(): ReadonlyArray<T>
12
- get(index: number): T
13
- insertAll(array: ReadonlyArray<T>): void
14
- insert(item: T): void
15
- removeFirst(finder: (arg0: T) => boolean): boolean
6
+ readonly _contents: Array<T>;
7
+ readonly _compareFn: CompareFn<T>;
8
+ constructor(compareFn?: CompareFn<T>);
9
+ static from<U>(array: ReadonlyArray<U>, compareFn?: CompareFn<U>): SortedArray<U>;
10
+ get length(): number;
11
+ get array(): ReadonlyArray<T>;
12
+ get(index: number): T;
13
+ insertAll(array: ReadonlyArray<T>): void;
14
+ insert(item: T): void;
15
+ removeFirst(finder: (arg0: T) => boolean): boolean;
16
16
  }
@@ -1,4 +1,4 @@
1
- import { findAndRemove, insertIntoSortedArray } from "./ArrayUtils.js"
1
+ import { findAndRemove, insertIntoSortedArray } from "./ArrayUtils.js";
2
2
  /**
3
3
  * Compared based on the type's natural ordering
4
4
  * @param a
@@ -7,38 +7,38 @@ import { findAndRemove, insertIntoSortedArray } from "./ArrayUtils.js"
7
7
  */
8
8
  // It should be fine for 99% of use cases? worst case it just returns 0 always
9
9
  function defaultCompare(a, b) {
10
- return a < b ? -1 : a > b ? 1 : 0
10
+ return a < b ? -1 : a > b ? 1 : 0;
11
11
  }
12
12
  /**
13
13
  * An array that keeps itself sorted
14
14
  */
15
15
  export class SortedArray {
16
- constructor(compareFn = defaultCompare) {
17
- this._contents = []
18
- this._compareFn = compareFn
19
- }
20
- static from(array, compareFn) {
21
- const list = new SortedArray(compareFn)
22
- list.insertAll(array)
23
- return list
24
- }
25
- get length() {
26
- return this._contents.length
27
- }
28
- get array() {
29
- return this._contents
30
- }
31
- get(index) {
32
- return this._contents[index]
33
- }
34
- insertAll(array) {
35
- this._contents.push(...array)
36
- this._contents.sort(this._compareFn)
37
- }
38
- insert(item) {
39
- insertIntoSortedArray(item, this._contents, this._compareFn)
40
- }
41
- removeFirst(finder) {
42
- return findAndRemove(this._contents, finder)
43
- }
16
+ constructor(compareFn = defaultCompare) {
17
+ this._contents = [];
18
+ this._compareFn = compareFn;
19
+ }
20
+ static from(array, compareFn) {
21
+ const list = new SortedArray(compareFn);
22
+ list.insertAll(array);
23
+ return list;
24
+ }
25
+ get length() {
26
+ return this._contents.length;
27
+ }
28
+ get array() {
29
+ return this._contents;
30
+ }
31
+ get(index) {
32
+ return this._contents[index];
33
+ }
34
+ insertAll(array) {
35
+ this._contents.push(...array);
36
+ this._contents.sort(this._compareFn);
37
+ }
38
+ insert(item) {
39
+ insertIntoSortedArray(item, this._contents, this._compareFn);
40
+ }
41
+ removeFirst(finder) {
42
+ return findAndRemove(this._contents, finder);
43
+ }
44
44
  }
@@ -1,58 +1,58 @@
1
- import type { lazy } from "./Utils.js"
1
+ import type { lazy } from "./Utils.js";
2
2
  /**
3
3
  * Returns a string which contains the given number padded with 0s.
4
4
  * @param num The number to pad.
5
5
  * @param size The number of resulting digits.
6
6
  * @return The padded number as string.
7
7
  */
8
- export declare function pad(num: number, size: number): string
8
+ export declare function pad(num: number, size: number): string;
9
9
  /**
10
10
  * Checks if a string starts with another string.
11
11
  * @param string The string to test.
12
12
  * @param substring If the other string begins with this one, we return true.
13
13
  * @return True if string begins with substring, false otherwise.
14
14
  */
15
- export declare function startsWith(string: string, substring: string): boolean
15
+ export declare function startsWith(string: string, substring: string): boolean;
16
16
  /**
17
17
  * uppercase the first letter of a string, lowercase the rest
18
18
  * @param str string to transform
19
19
  * @returns {string} str in lowercase with first letter Capitalized
20
20
  */
21
- export declare function capitalizeFirstLetter(str: string): string
21
+ export declare function capitalizeFirstLetter(str: string): string;
22
22
  /**
23
23
  * Checks if a string ends with another string.
24
24
  * @param string The string to test.
25
25
  * @param substring If the other string ends with this one, we return true.
26
26
  * @return True if string ends with substring, false otherwise.
27
27
  */
28
- export declare function endsWith(string: string, substring: string): boolean
29
- export declare function lazyStringValue(valueOrLazy: string | lazy<string>): string
30
- export declare function repeat(value: string, length: number): string
31
- export declare function cleanMatch(s1: string, s2: string): boolean
28
+ export declare function endsWith(string: string, substring: string): boolean;
29
+ export declare function lazyStringValue(valueOrLazy: string | lazy<string>): string;
30
+ export declare function repeat(value: string, length: number): string;
31
+ export declare function cleanMatch(s1: string, s2: string): boolean;
32
32
  /**
33
33
  * Non-breaking space character
34
34
  */
35
- export declare const NBSP = "\u00A0"
35
+ export declare const NBSP = "\u00A0";
36
36
  /**
37
37
  * split a string at a given index
38
38
  * @param str
39
39
  * @param index
40
40
  */
41
- export declare function splitAt(str: string, index: number): [string, string]
41
+ export declare function splitAt(str: string, index: number): [string, string];
42
42
  /**
43
43
  * Wrapper around String.prototype.toLowerCase, nice for calls to Array.prototype.map
44
44
  * @param str
45
45
  */
46
- export declare function toLowerCase(str: string): string
46
+ export declare function toLowerCase(str: string): string;
47
47
  /**
48
48
  * Wrapper around String.prototype.localeCompare, for passing to Array.prototype.sort
49
49
  * @param a
50
50
  * @param b
51
51
  * @returns {number}
52
52
  */
53
- export declare function localeCompare(a: string, b: string): number
54
- export declare function byteLength(str: string | null | undefined): number
53
+ export declare function localeCompare(a: string, b: string): number;
54
+ export declare function byteLength(str: string | null | undefined): number;
55
55
  /**
56
56
  * replace all instances of substr in str with replacement
57
57
  */
58
- export declare function replaceAll(str: string, substr: string, replacement: string): string
58
+ export declare function replaceAll(str: string, substr: string, replacement: string): string;
@@ -5,9 +5,10 @@
5
5
  * @return The padded number as string.
6
6
  */
7
7
  export function pad(num, size) {
8
- var s = num + ""
9
- while (s.length < size) s = "0" + s
10
- return s
8
+ var s = num + "";
9
+ while (s.length < size)
10
+ s = "0" + s;
11
+ return s;
11
12
  }
12
13
  /**
13
14
  * Checks if a string starts with another string.
@@ -16,7 +17,7 @@ export function pad(num, size) {
16
17
  * @return True if string begins with substring, false otherwise.
17
18
  */
18
19
  export function startsWith(string, substring) {
19
- return string.startsWith(substring)
20
+ return string.startsWith(substring);
20
21
  }
21
22
  /**
22
23
  * uppercase the first letter of a string, lowercase the rest
@@ -24,7 +25,7 @@ export function startsWith(string, substring) {
24
25
  * @returns {string} str in lowercase with first letter Capitalized
25
26
  */
26
27
  export function capitalizeFirstLetter(str) {
27
- return str[0].toUpperCase() + str.toLowerCase().slice(1)
28
+ return str[0].toUpperCase() + str.toLowerCase().slice(1);
28
29
  }
29
30
  /**
30
31
  * Checks if a string ends with another string.
@@ -33,39 +34,39 @@ export function capitalizeFirstLetter(str) {
33
34
  * @return True if string ends with substring, false otherwise.
34
35
  */
35
36
  export function endsWith(string, substring) {
36
- return string.endsWith(substring)
37
+ return string.endsWith(substring);
37
38
  }
38
39
  export function lazyStringValue(valueOrLazy) {
39
- return typeof valueOrLazy === "function" ? valueOrLazy() : valueOrLazy
40
+ return typeof valueOrLazy === "function" ? valueOrLazy() : valueOrLazy;
40
41
  }
41
42
  export function repeat(value, length) {
42
- let result = ""
43
- for (let i = 0; i < length; i++) {
44
- result += value
45
- }
46
- return result
43
+ let result = "";
44
+ for (let i = 0; i < length; i++) {
45
+ result += value;
46
+ }
47
+ return result;
47
48
  }
48
49
  export function cleanMatch(s1, s2) {
49
- return s1.toLowerCase().trim() === s2.toLowerCase().trim()
50
+ return s1.toLowerCase().trim() === s2.toLowerCase().trim();
50
51
  }
51
52
  /**
52
53
  * Non-breaking space character
53
54
  */
54
- export const NBSP = "\u00A0"
55
+ export const NBSP = "\u00A0";
55
56
  /**
56
57
  * split a string at a given index
57
58
  * @param str
58
59
  * @param index
59
60
  */
60
61
  export function splitAt(str, index) {
61
- return [str.substring(0, index), str.substring(index)]
62
+ return [str.substring(0, index), str.substring(index)];
62
63
  }
63
64
  /**
64
65
  * Wrapper around String.prototype.toLowerCase, nice for calls to Array.prototype.map
65
66
  * @param str
66
67
  */
67
68
  export function toLowerCase(str) {
68
- return str.toLowerCase()
69
+ return str.toLowerCase();
69
70
  }
70
71
  /**
71
72
  * Wrapper around String.prototype.localeCompare, for passing to Array.prototype.sort
@@ -74,32 +75,36 @@ export function toLowerCase(str) {
74
75
  * @returns {number}
75
76
  */
76
77
  export function localeCompare(a, b) {
77
- return a.localeCompare(b)
78
+ return a.localeCompare(b);
78
79
  }
79
80
  export function byteLength(str) {
80
- if (str == null) return 0
81
- // returns the byte length of an utf8 string
82
- var s = str.length
83
- for (var i = str.length - 1; i >= 0; i--) {
84
- var code = str.charCodeAt(i)
85
- if (code > 0x7f && code <= 0x7ff) {
86
- s++
87
- } else if (code > 0x7ff && code <= 0xffff) s += 2
88
- if (code >= 0xdc00 && code <= 0xdfff) i-- //trail surrogate
89
- }
90
- return s
81
+ if (str == null)
82
+ return 0;
83
+ // returns the byte length of an utf8 string
84
+ var s = str.length;
85
+ for (var i = str.length - 1; i >= 0; i--) {
86
+ var code = str.charCodeAt(i);
87
+ if (code > 0x7f && code <= 0x7ff) {
88
+ s++;
89
+ }
90
+ else if (code > 0x7ff && code <= 0xffff)
91
+ s += 2;
92
+ if (code >= 0xdc00 && code <= 0xdfff)
93
+ i--; //trail surrogate
94
+ }
95
+ return s;
91
96
  }
92
97
  /**
93
98
  * replace all instances of substr in str with replacement
94
99
  */
95
100
  export function replaceAll(str, substr, replacement) {
96
- const regex = escapedStringRegExp(substr, "g")
97
- return str.replace(regex, replacement)
101
+ const regex = escapedStringRegExp(substr, "g");
102
+ return str.replace(regex, replacement);
98
103
  }
99
104
  /**
100
105
  * Create a regex to exactly match a given string, by escaping any special regex characters
101
106
  * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions#escaping
102
107
  * */
103
108
  function escapedStringRegExp(str, flags) {
104
- return new RegExp(str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), flags)
109
+ return new RegExp(str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), flags);
105
110
  }
package/dist/TypeRef.d.ts CHANGED
@@ -1,13 +1,13 @@
1
1
  export declare class TypeRef<T> {
2
- readonly app: string
3
- readonly type: string
4
- /**
5
- * Field that is never set. Used to make two TypeRefs incompatible (they are structurally compared otherwise).
6
- * Cannot be private.
7
- */
8
- readonly phantom: T | null
9
- constructor(app: string, type: string)
10
- toString(): string
2
+ readonly app: string;
3
+ readonly type: string;
4
+ /**
5
+ * Field that is never set. Used to make two TypeRefs incompatible (they are structurally compared otherwise).
6
+ * Cannot be private.
7
+ */
8
+ readonly phantom: T | null;
9
+ constructor(app: string, type: string);
10
+ toString(): string;
11
11
  }
12
- export declare function isSameTypeRefByAttr(typeRef: TypeRef<any>, app: string, type: string): boolean
13
- export declare function isSameTypeRef(typeRef1: TypeRef<any>, typeRef2: TypeRef<any>): boolean
12
+ export declare function isSameTypeRefByAttr(typeRef: TypeRef<any>, app: string, type: string): boolean;
13
+ export declare function isSameTypeRef(typeRef1: TypeRef<any>, typeRef2: TypeRef<any>): boolean;
package/dist/TypeRef.js CHANGED
@@ -1,22 +1,22 @@
1
1
  // T should be restricted to Entity
2
2
  export class TypeRef {
3
- constructor(app, type) {
4
- /**
5
- * Field that is never set. Used to make two TypeRefs incompatible (they are structurally compared otherwise).
6
- * Cannot be private.
7
- */
8
- this.phantom = null
9
- this.app = app
10
- this.type = type
11
- Object.freeze(this)
12
- }
13
- toString() {
14
- return `[TypeRef ${this.app} ${this.type}]`
15
- }
3
+ constructor(app, type) {
4
+ /**
5
+ * Field that is never set. Used to make two TypeRefs incompatible (they are structurally compared otherwise).
6
+ * Cannot be private.
7
+ */
8
+ this.phantom = null;
9
+ this.app = app;
10
+ this.type = type;
11
+ Object.freeze(this);
12
+ }
13
+ toString() {
14
+ return `[TypeRef ${this.app} ${this.type}]`;
15
+ }
16
16
  }
17
17
  export function isSameTypeRefByAttr(typeRef, app, type) {
18
- return typeRef.app === app && typeRef.type === type
18
+ return typeRef.app === app && typeRef.type === type;
19
19
  }
20
20
  export function isSameTypeRef(typeRef1, typeRef2) {
21
- return isSameTypeRefByAttr(typeRef1, typeRef2.app, typeRef2.type)
21
+ return isSameTypeRefByAttr(typeRef1, typeRef2.app, typeRef2.type);
22
22
  }
package/dist/Utils.d.ts CHANGED
@@ -1,63 +1,57 @@
1
- export declare type lazy<T> = () => T
2
- export declare type lazyAsync<T> = () => Promise<T>
3
- export declare type Thunk = () => unknown
1
+ export declare type lazy<T> = () => T;
2
+ export declare type lazyAsync<T> = () => Promise<T>;
3
+ export declare type Thunk = () => unknown;
4
4
  export declare type DeferredObject<T> = {
5
- resolve: (arg0: T) => void
6
- reject: (arg0: Error) => void
7
- promise: Promise<T>
8
- }
5
+ resolve: (arg0: T) => void;
6
+ reject: (arg0: Error) => void;
7
+ promise: Promise<T>;
8
+ };
9
9
  export declare type DeferredObjectWithHandler<T, U> = {
10
- resolve: (arg0: T) => void
11
- reject: (arg0: Error) => void
12
- promise: Promise<U>
13
- }
14
- export declare function defer<T>(): DeferredObject<T>
15
- export declare function deferWithHandler<T, U>(handler: (arg0: T) => U): DeferredObjectWithHandler<T, U>
16
- export declare function asyncFind<T>(
17
- array: ReadonlyArray<T>,
18
- finder: (item: T, index: number, arrayLength: number) => Promise<boolean>,
19
- ): Promise<T | null | undefined>
20
- export declare function asyncFindAndMap<T, R>(
21
- array: ReadonlyArray<T>,
22
- finder: (item: T, index: number, arrayLength: number) => Promise<R | null>,
23
- ): Promise<R | null | undefined>
10
+ resolve: (arg0: T) => void;
11
+ reject: (arg0: Error) => void;
12
+ promise: Promise<U>;
13
+ };
14
+ export declare function defer<T>(): DeferredObject<T>;
15
+ export declare function deferWithHandler<T, U>(handler: (arg0: T) => U): DeferredObjectWithHandler<T, U>;
16
+ export declare function asyncFind<T>(array: ReadonlyArray<T>, finder: (item: T, index: number, arrayLength: number) => Promise<boolean>): Promise<T | null | undefined>;
17
+ export declare function asyncFindAndMap<T, R>(array: ReadonlyArray<T>, finder: (item: T, index: number, arrayLength: number) => Promise<R | null>): Promise<R | null | undefined>;
24
18
  /**
25
19
  * Calls an executor function for slices of nbrOfElementsInGroup items of the given array until the executor function returns false.
26
20
  */
27
- export declare function executeInGroups<T>(array: T[], nbrOfElementsInGroup: number, executor: (items: T[]) => Promise<boolean>): Promise<void>
28
- export declare function neverNull<T>(object: T): NonNullable<T>
29
- export declare function assertNotNull<T>(object: T | null | undefined, message?: string): T
30
- export declare function isNotNull<T>(t: T | null | undefined): t is T
31
- export declare function assert(assertion: MaybeLazy<boolean>, message: string): void
32
- export declare function downcast<R = any>(object: any): R
33
- export declare function clone<T>(instance: T): T
21
+ export declare function executeInGroups<T>(array: T[], nbrOfElementsInGroup: number, executor: (items: T[]) => Promise<boolean>): Promise<void>;
22
+ export declare function neverNull<T>(object: T): NonNullable<T>;
23
+ export declare function assertNotNull<T>(object: T | null | undefined, message?: string): T;
24
+ export declare function isNotNull<T>(t: T | null | undefined): t is T;
25
+ export declare function assert(assertion: MaybeLazy<boolean>, message: string): void;
26
+ export declare function downcast<R = any>(object: any): R;
27
+ export declare function clone<T>(instance: T): T;
34
28
  /**
35
29
  * Function which accepts another function. On first invocation
36
30
  * of this resulting function result will be remembered and returned
37
31
  * on consequent invocations.
38
32
  */
39
- export declare function lazyMemoized<T>(source: () => T): () => T
33
+ export declare function lazyMemoized<T>(source: () => T): () => T;
40
34
  /**
41
35
  * Returns a cached version of {@param fn}.
42
36
  * Cached function checks that argument is the same (with ===) and if it is then it returns the cached result.
43
37
  * If the cached argument has changed then {@param fn} will be called with new argument and result will be cached again.
44
38
  * Only remembers the last argument.
45
39
  */
46
- export declare function memoized<T, R>(fn: (arg0: T) => R): (arg0: T) => R
40
+ export declare function memoized<T, R>(fn: (arg0: T) => R): (arg0: T) => R;
47
41
  /**
48
42
  * Function which returns what was passed into it
49
43
  */
50
- export declare function identity<T>(t: T): T
44
+ export declare function identity<T>(t: T): T;
51
45
  /**
52
46
  * Function which does nothing.
53
47
  */
54
- export declare function noOp(): void
48
+ export declare function noOp(): void;
55
49
  /**
56
50
  * Return a function, which executed {@param toThrottle} only after it is not invoked for {@param timeout} ms.
57
51
  * Executes function with the last passed arguments
58
52
  * @return {Function}
59
53
  */
60
- export declare function debounce<F extends (...args: any) => void>(timeout: number, toThrottle: F): F
54
+ export declare function debounce<F extends (...args: any) => void>(timeout: number, toThrottle: F): F;
61
55
  /**
62
56
  * Returns a debounced function. When invoked for the first time, will just invoke
63
57
  * {@param toThrottle}. On subsequent invocations it will either invoke it right away
@@ -65,67 +59,67 @@ export declare function debounce<F extends (...args: any) => void>(timeout: numb
65
59
  * So the first and the last invocations in a series of invocations always take place
66
60
  * but ones in the middle (which happen too often) are discarded.}
67
61
  */
68
- export declare function debounceStart<F extends (...args: any) => void>(timeout: number, toThrottle: F): F
69
- export declare function randomIntFromInterval(min: number, max: number): number
70
- export declare function errorToString(error: Error): string
62
+ export declare function debounceStart<F extends (...args: any) => void>(timeout: number, toThrottle: F): F;
63
+ export declare function randomIntFromInterval(min: number, max: number): number;
64
+ export declare function errorToString(error: Error): string;
71
65
  /**
72
66
  * Like {@link Object.entries} but preserves the type of the key and value
73
67
  */
74
- export declare function objectEntries<A extends string | symbol, B>(object: Record<A, B>): Array<[A, B]>
68
+ export declare function objectEntries<A extends string | symbol, B>(object: Record<A, B>): Array<[A, B]>;
75
69
  /**
76
70
  * modified deepEquals from ospec is only needed as long as we use custom classes (TypeRef) and Date is not properly handled
77
71
  */
78
- export declare function deepEqual(a: any, b: any): boolean
72
+ export declare function deepEqual(a: any, b: any): boolean;
79
73
  /**
80
74
  * returns an array of top-level properties that are in both objA and objB, but differ in value
81
75
  * does not handle functions or circular references
82
76
  * treats undefined and null as equal
83
77
  */
84
- export declare function getChangedProps(objA: any, objB: any): Array<string>
78
+ export declare function getChangedProps(objA: any, objB: any): Array<string>;
85
79
  /**
86
80
  * Disallow set, delete and clear on Map.
87
81
  * Important: It is *not* a deep freeze.
88
82
  * @param myMap
89
83
  * @return {unknown}
90
84
  */
91
- export declare function freezeMap<K, V>(myMap: Map<K, V>): Map<K, V>
92
- export declare function addressDomain(senderAddress: string): string
85
+ export declare function freezeMap<K, V>(myMap: Map<K, V>): Map<K, V>;
86
+ export declare function addressDomain(senderAddress: string): string;
93
87
  /**
94
88
  * Ignores the fact that Object.keys returns also not owned properties.
95
89
  */
96
- export declare function typedKeys<K extends string, V>(obj: Record<K, V>): Array<K>
90
+ export declare function typedKeys<K extends string, V>(obj: Record<K, V>): Array<K>;
97
91
  /**
98
92
  * Ignores the fact that Object.keys returns also not owned properties.
99
93
  */
100
- export declare function typedEntries<K extends string, V>(obj: Record<K, V>): Array<[K, V]>
94
+ export declare function typedEntries<K extends string, V>(obj: Record<K, V>): Array<[K, V]>;
101
95
  /**
102
96
  * Ignores the fact that Object.keys returns also not owned properties.
103
97
  */
104
- export declare function typedValues<K extends string, V>(obj: Record<K, V>): Array<V>
105
- export declare type MaybeLazy<T> = T | lazy<T>
106
- export declare function resolveMaybeLazy<T>(maybe: MaybeLazy<T>): T
107
- export declare function getAsLazy<T>(maybe: MaybeLazy<T>): lazy<T>
108
- export declare function mapLazily<T, U>(maybe: MaybeLazy<T>, mapping: (arg0: T) => U): lazy<U>
98
+ export declare function typedValues<K extends string, V>(obj: Record<K, V>): Array<V>;
99
+ export declare type MaybeLazy<T> = T | lazy<T>;
100
+ export declare function resolveMaybeLazy<T>(maybe: MaybeLazy<T>): T;
101
+ export declare function getAsLazy<T>(maybe: MaybeLazy<T>): lazy<T>;
102
+ export declare function mapLazily<T, U>(maybe: MaybeLazy<T>, mapping: (arg0: T) => U): lazy<U>;
109
103
  /**
110
104
  * Stricter version of parseInt() from MDN. parseInt() allows some arbitrary characters at the end of the string.
111
105
  * Returns NaN in case there's anything non-number in the string.
112
106
  */
113
- export declare function filterInt(value: string): number
107
+ export declare function filterInt(value: string): number;
114
108
  interface Positioned {
115
- x: number
116
- y: number
109
+ x: number;
110
+ y: number;
117
111
  }
118
112
  interface Sized {
119
- top: number
120
- left: number
121
- bottom: number
122
- right: number
113
+ top: number;
114
+ left: number;
115
+ bottom: number;
116
+ right: number;
123
117
  }
124
- export declare function insideRect(point: Positioned, rect: Sized): boolean
118
+ export declare function insideRect(point: Positioned, rect: Sized): boolean;
125
119
  /**
126
120
  * If val is non null, returns the result of val passed to action, else null
127
121
  */
128
- export declare function mapNullable<T, U>(val: T | null | undefined, action: (arg0: T) => U | null | undefined): U | null
122
+ export declare function mapNullable<T, U>(val: T | null | undefined, action: (arg0: T) => U | null | undefined): U | null;
129
123
  /** Helper to take instead of `typeof setTimeout` which is hellish to reproduce */
130
- export declare type TimeoutSetter = (fn: () => unknown, arg1: number) => ReturnType<typeof setTimeout>
131
- export {}
124
+ export declare type TimeoutSetter = (fn: () => unknown, arg1: number) => ReturnType<typeof setTimeout>;
125
+ export {};