@dereekb/util 12.6.21 → 13.0.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/LICENSE +1 -1
- package/fetch/LICENSE +1 -1
- package/fetch/index.cjs.js +42 -2529
- package/fetch/index.esm.js +44 -2530
- package/fetch/package.json +21 -16
- package/fetch/src/lib/fetch.page.d.ts +0 -4
- package/fetch/src/lib/fetch.url.d.ts +0 -8
- package/fetch/src/lib/provider.d.ts +0 -4
- package/index.cjs.js +36 -2354
- package/index.esm.js +39 -2344
- package/package.json +18 -7
- package/src/lib/array/array.boolean.d.ts +0 -11
- package/src/lib/array/array.value.d.ts +0 -18
- package/src/lib/boolean.d.ts +1 -1
- package/src/lib/date/date.d.ts +0 -8
- package/src/lib/date/date.unix.d.ts +6 -30
- package/src/lib/date/expires.d.ts +4 -4
- package/src/lib/date/hour.d.ts +1 -1
- package/src/lib/date/time.d.ts +0 -4
- package/src/lib/key.d.ts +4 -0
- package/src/lib/object/object.map.d.ts +0 -9
- package/src/lib/page/index.d.ts +0 -1
- package/src/lib/promise/promise.d.ts +2 -3
- package/src/lib/set/set.hashset.d.ts +4 -4
- package/src/lib/storage/storage.d.ts +2 -2
- package/src/lib/string/mimetype.d.ts +0 -8
- package/src/lib/string/replace.d.ts +11 -1
- package/src/lib/tree/tree.flatten.d.ts +0 -10
- package/src/lib/value/indexed.d.ts +1 -1
- package/src/lib/value/maybe.type.d.ts +3 -3
- package/src/lib/value/point.d.ts +2 -2
- package/test/LICENSE +21 -0
- package/test/index.cjs.js +707 -0
- package/test/index.esm.js +664 -0
- package/test/package.json +20 -6
- package/test/src/lib/index.d.ts +1 -3
- package/test/src/lib/jest/index.d.ts +4 -0
- package/test/src/lib/jest/jest.d.ts +55 -0
- package/test/src/lib/jest/jest.fail.d.ts +72 -0
- package/test/src/lib/jest/jest.function.d.ts +41 -0
- package/test/src/lib/jest/jest.wrap.d.ts +24 -0
- package/test/src/lib/shared/index.d.ts +4 -0
- package/test/src/lib/shared/shared.d.ts +154 -0
- package/test/src/lib/shared/shared.fail.d.ts +83 -0
- package/test/src/lib/shared/shared.function.d.ts +25 -0
- package/test/src/lib/{jest.wrap.d.ts → shared/shared.wrap.d.ts} +9 -9
- package/index.esm.d.ts +0 -1
- package/src/lib/page/page.calculator.d.ts +0 -29
- package/test/CHANGELOG.md +0 -1956
- package/test/src/index.js +0 -5
- package/test/src/index.js.map +0 -1
- package/test/src/lib/index.js +0 -8
- package/test/src/lib/index.js.map +0 -1
- package/test/src/lib/jest.d.ts +0 -100
- package/test/src/lib/jest.fail.d.ts +0 -104
- package/test/src/lib/jest.fail.js +0 -224
- package/test/src/lib/jest.fail.js.map +0 -1
- package/test/src/lib/jest.function.d.ts +0 -25
- package/test/src/lib/jest.function.js +0 -21
- package/test/src/lib/jest.function.js.map +0 -1
- package/test/src/lib/jest.js +0 -113
- package/test/src/lib/jest.js.map +0 -1
- package/test/src/lib/jest.wrap.js +0 -70
- package/test/src/lib/jest.wrap.js.map +0 -1
- /package/fetch/{index.cjs.d.ts → index.d.ts} +0 -0
- /package/{fetch/index.esm.d.ts → index.d.ts} +0 -0
- /package/{index.cjs.d.ts → test/index.d.ts} +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dereekb/util",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "13.0.0",
|
|
4
4
|
"exports": {
|
|
5
5
|
".": {
|
|
6
6
|
"types": "./src/index.d.ts",
|
|
@@ -16,8 +16,15 @@
|
|
|
16
16
|
},
|
|
17
17
|
"./test": {
|
|
18
18
|
"types": "./test/src/index.d.ts",
|
|
19
|
-
"
|
|
20
|
-
"
|
|
19
|
+
"module": "./test/index.esm.js",
|
|
20
|
+
"main": "./test/index.cjs.js",
|
|
21
|
+
"node": {
|
|
22
|
+
"require": "./test/index.cjs.js"
|
|
23
|
+
},
|
|
24
|
+
"browser": {
|
|
25
|
+
"require": "./test/index.cjs.js",
|
|
26
|
+
"import": "./test/index.esm.js"
|
|
27
|
+
}
|
|
21
28
|
},
|
|
22
29
|
"./fetch": {
|
|
23
30
|
"types": "./fetch/src/index.d.ts",
|
|
@@ -34,11 +41,15 @@
|
|
|
34
41
|
},
|
|
35
42
|
"peerDependencies": {
|
|
36
43
|
"make-error": "^1.3.0",
|
|
37
|
-
"ts-essentials": "^
|
|
38
|
-
"extra-set": "^3.0.0"
|
|
44
|
+
"ts-essentials": "^10.0.0",
|
|
45
|
+
"extra-set": "^3.0.0",
|
|
46
|
+
"fast-content-type-parse": "^3.0.0",
|
|
47
|
+
"core-js": "^3.0.0"
|
|
48
|
+
},
|
|
49
|
+
"devDependencies": {
|
|
50
|
+
"date-fns": "*"
|
|
39
51
|
},
|
|
40
|
-
"dependencies": {},
|
|
41
52
|
"module": "./index.esm.js",
|
|
42
53
|
"main": "./index.cjs.js",
|
|
43
|
-
"types": "./index.
|
|
54
|
+
"types": "./index.d.ts"
|
|
44
55
|
}
|
|
@@ -84,14 +84,3 @@ export declare const BooleanStringKeyArrayUtility: {
|
|
|
84
84
|
remove: (array: BooleanKeyArray<string>, value: string) => BooleanKeyArray<string>;
|
|
85
85
|
removeByKey: (array: BooleanKeyArray<string>, key: string) => BooleanKeyArray<string>;
|
|
86
86
|
};
|
|
87
|
-
/**
|
|
88
|
-
* @Deprecated use BooleanStringKeyArrayUtility instead
|
|
89
|
-
*/
|
|
90
|
-
export declare const BooleanStringKeyArrayUtilityInstance: {
|
|
91
|
-
isFalse: (value: BooleanKeyArray) => boolean;
|
|
92
|
-
isTrue: (value: BooleanKeyArray) => boolean;
|
|
93
|
-
set: (array: BooleanKeyArray<string>, value: string, enable?: boolean) => BooleanKeyArray<string>;
|
|
94
|
-
insert: (array: BooleanKeyArray<string>, value: string) => BooleanKeyArray<string>;
|
|
95
|
-
remove: (array: BooleanKeyArray<string>, value: string) => BooleanKeyArray<string>;
|
|
96
|
-
removeByKey: (array: BooleanKeyArray<string>, key: string) => BooleanKeyArray<string>;
|
|
97
|
-
};
|
|
@@ -33,21 +33,3 @@ export declare function allValuesAreMaybeNot<T>(values: Maybe<T>[]): values is M
|
|
|
33
33
|
* @returns
|
|
34
34
|
*/
|
|
35
35
|
export declare function allValuesAreNotMaybe<T>(values: Maybe<T>[]): values is T[];
|
|
36
|
-
/**
|
|
37
|
-
* Filters all maybe values from the input array. If a maybe value is input, returns an empty array.
|
|
38
|
-
*
|
|
39
|
-
* @param values
|
|
40
|
-
* @returns
|
|
41
|
-
*
|
|
42
|
-
* @deprecated use filterMaybeArrayValues instead.
|
|
43
|
-
*/
|
|
44
|
-
export declare const filterMaybeValues: UniversalFilterMaybeArrayFunction;
|
|
45
|
-
/**
|
|
46
|
-
* Filters all empty and maybe values from the input array. If a maybe value is input, returns an empty array.
|
|
47
|
-
*
|
|
48
|
-
* @param values
|
|
49
|
-
* @returns
|
|
50
|
-
*
|
|
51
|
-
* @deprecated use filterEmptyArrayValues instead.
|
|
52
|
-
*/
|
|
53
|
-
export declare const filterEmptyValues: UniversalFilterMaybeArrayFunction;
|
package/src/lib/boolean.d.ts
CHANGED
|
@@ -103,7 +103,7 @@ export declare function randomBoolean(chance?: BooleanTrueChance): boolean;
|
|
|
103
103
|
* @param defaultValue - The default value to return if the string cannot be converted to a boolean (default: undefined).
|
|
104
104
|
* @returns The boolean value corresponding to the string, or the default value if the string cannot be converted.
|
|
105
105
|
*/
|
|
106
|
-
export declare function stringToBoolean(value: Maybe<string>): Maybe<boolean>;
|
|
106
|
+
export declare function stringToBoolean(value: Maybe<string | boolean>): Maybe<boolean>;
|
|
107
107
|
export declare function stringToBoolean(value: Maybe<string>, defaultValue: boolean): boolean;
|
|
108
108
|
export declare function stringToBoolean(value: Maybe<string>, defaultValue?: Maybe<boolean>): Maybe<boolean>;
|
|
109
109
|
/**
|
package/src/lib/date/date.d.ts
CHANGED
|
@@ -386,11 +386,3 @@ export declare function isPast(input: Date): boolean;
|
|
|
386
386
|
export declare function addMilliseconds(input: Date, ms: Maybe<Milliseconds>): Date;
|
|
387
387
|
export declare function addMilliseconds(input: MaybeNot, ms: Maybe<Milliseconds>): MaybeNot;
|
|
388
388
|
export declare function addMilliseconds(input: Maybe<Date>, ms: Maybe<Milliseconds>): Maybe<Date>;
|
|
389
|
-
/**
|
|
390
|
-
* @deprecated use UnixDateTimeMillisecondsNumber instead.
|
|
391
|
-
*/
|
|
392
|
-
export type UnixDateTimeNumber = UnixDateTimeMillisecondsNumber;
|
|
393
|
-
/**
|
|
394
|
-
* @deprecated use DateOrUnixDateTimeMillisecondsNumber instead.
|
|
395
|
-
*/
|
|
396
|
-
export type DateOrUnixDateTimeNumber = DateOrUnixDateTimeMillisecondsNumber;
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import { type Maybe, type MaybeNot } from '../value/maybe.type';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* This value is in seconds since the Epoch.
|
|
4
|
+
*
|
|
5
|
+
* Use UnixDateTimeMillisecondsNumber instead if you need milliseconds.
|
|
4
6
|
*/
|
|
5
7
|
export type UnixDateTimeSecondsNumber = number;
|
|
6
8
|
/**
|
|
7
|
-
*
|
|
9
|
+
* This value is in seconds since the Epoch.
|
|
10
|
+
*
|
|
11
|
+
* Use DateOrUnixDateTimeMillisecondsNumber instead if you need milliseconds.
|
|
8
12
|
*/
|
|
9
13
|
export type DateOrUnixDateTimeSecondsNumber = Date | UnixDateTimeSecondsNumber;
|
|
10
14
|
/**
|
|
@@ -44,31 +48,3 @@ export declare function dateFromDateOrTimeSecondsNumber(input: Maybe<DateOrUnixD
|
|
|
44
48
|
* @returns Date object if timestamp is valid, null/undefined if timestamp is null/undefined
|
|
45
49
|
*/
|
|
46
50
|
export declare function unixDateTimeSecondsNumberToDate(dateTimeNumber: Maybe<UnixDateTimeSecondsNumber>): Maybe<Date>;
|
|
47
|
-
/**
|
|
48
|
-
* @deprecated use UnixDateTimeSecondsNumber instead
|
|
49
|
-
*/
|
|
50
|
-
export type UnixTimeNumber = UnixDateTimeSecondsNumber;
|
|
51
|
-
/**
|
|
52
|
-
* @deprecated use DateOrUnixDateTimeSecondsNumber instead
|
|
53
|
-
*/
|
|
54
|
-
export type DateOrUnixTimeNumber = Date | UnixTimeNumber;
|
|
55
|
-
/**
|
|
56
|
-
* @deprecated use unixDateTimeSecondsNumberFromDateOrTimeNumber instead
|
|
57
|
-
*/
|
|
58
|
-
export declare const unixTimeNumberFromDateOrTimeNumber: typeof unixDateTimeSecondsNumberFromDateOrTimeNumber;
|
|
59
|
-
/**
|
|
60
|
-
* @deprecated use unixDateTimeSecondsNumberForNow instead
|
|
61
|
-
*/
|
|
62
|
-
export declare const unixTimeNumberForNow: typeof unixDateTimeSecondsNumberForNow;
|
|
63
|
-
/**
|
|
64
|
-
* @deprecated use unixDateTimeSecondsNumberFromDate instead
|
|
65
|
-
*/
|
|
66
|
-
export declare const unixTimeNumberFromDate: typeof unixDateTimeSecondsNumberFromDate;
|
|
67
|
-
/**
|
|
68
|
-
* @deprecated use dateFromDateOrTimeSecondsNumber instead
|
|
69
|
-
*/
|
|
70
|
-
export declare const dateFromDateOrTimeNumber: typeof dateFromDateOrTimeSecondsNumber;
|
|
71
|
-
/**
|
|
72
|
-
* @deprecated use unixDateTimeSecondsNumberToDate instead
|
|
73
|
-
*/
|
|
74
|
-
export declare const unixTimeNumberToDate: typeof unixDateTimeSecondsNumberToDate;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type Maybe } from '../value/maybe.type';
|
|
2
|
-
import { type
|
|
2
|
+
import { type DateOrUnixDateTimeMillisecondsNumber, type Milliseconds } from './date';
|
|
3
3
|
/**
|
|
4
4
|
* An object that can expire.
|
|
5
5
|
*/
|
|
@@ -35,7 +35,7 @@ export interface ExpirationDetailsInput<T extends Expires = Expires> extends Exp
|
|
|
35
35
|
*
|
|
36
36
|
* If not defined, the expiresFromDate is considered to have never been run/set.
|
|
37
37
|
*/
|
|
38
|
-
expiresFromDate?: Maybe<
|
|
38
|
+
expiresFromDate?: Maybe<DateOrUnixDateTimeMillisecondsNumber>;
|
|
39
39
|
/**
|
|
40
40
|
* If true, the "expiresFromDate" will default to the calculated now time when calculating the expiration.
|
|
41
41
|
*
|
|
@@ -98,7 +98,7 @@ export declare function calculateExpirationDate(input: ExpirationDetailsInput<an
|
|
|
98
98
|
* @param now Optional override for the current time. Defaults to the current time.
|
|
99
99
|
* @returns True if the threshold has not passed since the next run time, compared to now.
|
|
100
100
|
*/
|
|
101
|
-
export declare function isUnderThreshold(threshold: Milliseconds, nextRunAt: Maybe<
|
|
101
|
+
export declare function isUnderThreshold(threshold: Milliseconds, nextRunAt: Maybe<DateOrUnixDateTimeMillisecondsNumber>, now?: Maybe<Date>): boolean;
|
|
102
102
|
/**
|
|
103
103
|
* Convenience function for quickly calculating throttling given a throttle time and last run time.
|
|
104
104
|
*
|
|
@@ -110,7 +110,7 @@ export declare function isUnderThreshold(threshold: Milliseconds, nextRunAt: May
|
|
|
110
110
|
* @param now - Optional override for the current time (defaults to the current time)
|
|
111
111
|
* @returns True if the operation should be throttled (not enough time has passed), false otherwise
|
|
112
112
|
*/
|
|
113
|
-
export declare function isThrottled(throttleTime: Maybe<Milliseconds>, lastRunAt: Maybe<
|
|
113
|
+
export declare function isThrottled(throttleTime: Maybe<Milliseconds>, lastRunAt: Maybe<DateOrUnixDateTimeMillisecondsNumber>, now?: Maybe<Date>): boolean;
|
|
114
114
|
/**
|
|
115
115
|
* Returns true if at least one of the input ExpirationDetails has not expired.
|
|
116
116
|
* Useful for checking if any items in a collection are still valid.
|
package/src/lib/date/hour.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ import { type Hours, type Minutes } from './date';
|
|
|
13
13
|
* - 15 minutes : 0.25
|
|
14
14
|
*/
|
|
15
15
|
export type FractionalHour = number;
|
|
16
|
-
export declare const FRACTIONAL_HOURS_PRECISION_FUNCTION: import("
|
|
16
|
+
export declare const FRACTIONAL_HOURS_PRECISION_FUNCTION: import("..").CutValueToPrecisionFunction;
|
|
17
17
|
/**
|
|
18
18
|
* Converts the number of minnutes to a fractional hour.
|
|
19
19
|
*
|
package/src/lib/date/time.d.ts
CHANGED
|
@@ -111,7 +111,3 @@ export declare function toggleTimerRunning(timer: Timer, toggleRun?: boolean): v
|
|
|
111
111
|
* Returns the approximate end date of the given timer. If a timer is already complete, it returns the time for now.
|
|
112
112
|
*/
|
|
113
113
|
export declare function approximateTimerEndDate(timer: Timer): Maybe<Date>;
|
|
114
|
-
/**
|
|
115
|
-
* @deprecated use makeTimer instead of timer.
|
|
116
|
-
*/
|
|
117
|
-
export declare const timer: typeof makeTimer;
|
package/src/lib/key.d.ts
CHANGED
|
@@ -17,6 +17,10 @@ export type ReadKeyFunction<T, K extends PrimativeKey = PrimativeKey> = MapFunct
|
|
|
17
17
|
* Reads a key value from the input object that is required to exist.
|
|
18
18
|
*/
|
|
19
19
|
export type ReadRequiredKeyFunction<T, K extends PrimativeKey = PrimativeKey> = MapFunction<T, K>;
|
|
20
|
+
/**
|
|
21
|
+
* Reads all keys from the input object. Can return null/undefined.
|
|
22
|
+
*/
|
|
23
|
+
export type ReadAllKeysFunction<T, K extends PrimativeKey = PrimativeKey> = MapFunction<T, Maybe<ArrayOrValue<K>>>;
|
|
20
24
|
/**
|
|
21
25
|
* Reads one or more keys from the input object.
|
|
22
26
|
*/
|
|
@@ -74,12 +74,3 @@ export type MappedKeysToLowercaseObjectMap<M extends object> = {
|
|
|
74
74
|
* @param mapFn
|
|
75
75
|
*/
|
|
76
76
|
export declare const mapObjectKeysToLowercase: <M extends object>(object: M) => MappedKeysToLowercaseObjectMap<M>;
|
|
77
|
-
/**
|
|
78
|
-
* Converts an ObjectMap into tuples.
|
|
79
|
-
*
|
|
80
|
-
* @deprecated use Object.entries instead.
|
|
81
|
-
*
|
|
82
|
-
* @param object
|
|
83
|
-
* @returns
|
|
84
|
-
*/
|
|
85
|
-
export declare const objectToTuples: <T>(object: ObjectMap<T>) => [string, T][];
|
package/src/lib/page/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type ArrayOrValue } from '../array/array';
|
|
2
2
|
import { type Milliseconds } from '../date/date';
|
|
3
|
-
import { type
|
|
3
|
+
import { type ReadAllKeysFunction, type PrimativeKey } from '../key';
|
|
4
4
|
import { type StringFactory } from '../string/factory';
|
|
5
5
|
import { type IndexNumber } from '../value';
|
|
6
6
|
import { type Maybe } from '../value/maybe.type';
|
|
@@ -95,7 +95,7 @@ export interface PerformTasksFromFactoryInParallelFunctionConfig<I, K extends Pr
|
|
|
95
95
|
*
|
|
96
96
|
* When in use the order is not guranteed.
|
|
97
97
|
*/
|
|
98
|
-
readonly nonConcurrentTaskKeyFactory?:
|
|
98
|
+
readonly nonConcurrentTaskKeyFactory?: Maybe<ReadAllKeysFunction<I, K>>;
|
|
99
99
|
/**
|
|
100
100
|
* Whether or not tasks are performed sequentially or if tasks are all done in "parellel".
|
|
101
101
|
*
|
|
@@ -136,4 +136,3 @@ export declare function performTasksFromFactoryInParallelFunction<I, K extends P
|
|
|
136
136
|
* @returns A string factory that generates unique keys for non-concurrent tasks.
|
|
137
137
|
*/
|
|
138
138
|
export declare function makeDefaultNonConcurrentTaskKeyFactory(): StringFactory<any>;
|
|
139
|
-
export type PromiseAsyncTaskFn<T, K = unknown> = PerformAsyncTaskFn<T, K>;
|
|
@@ -14,7 +14,7 @@ export declare class HashSet<K extends PrimativeKey, T> implements Set<T> {
|
|
|
14
14
|
constructor(config: HashSetConfig<K, T>, values?: T[]);
|
|
15
15
|
get config(): HashSetConfig<K, T>;
|
|
16
16
|
get size(): number;
|
|
17
|
-
[Symbol.iterator]():
|
|
17
|
+
[Symbol.iterator](): MapIterator<T>;
|
|
18
18
|
addAll(values: Maybe<T[]>): this;
|
|
19
19
|
add(value: T): this;
|
|
20
20
|
clear(): void;
|
|
@@ -25,9 +25,9 @@ export declare class HashSet<K extends PrimativeKey, T> implements Set<T> {
|
|
|
25
25
|
valueKeyEntriesForKeys(keys: Maybe<K>[]): [Maybe<K>, Maybe<T>][];
|
|
26
26
|
valuesForKeys(keys: Maybe<K>[]): T[];
|
|
27
27
|
forEach(callbackfn: (value: T, value2: T, set: Set<T>) => void, thisArg?: unknown): void;
|
|
28
|
-
entries():
|
|
29
|
-
keys():
|
|
30
|
-
values():
|
|
28
|
+
entries(): SetIterator<[T, T]>;
|
|
29
|
+
keys(): SetIterator<T>;
|
|
30
|
+
values(): SetIterator<T>;
|
|
31
31
|
valuesArray(): T[];
|
|
32
32
|
get [Symbol.toStringTag](): string;
|
|
33
33
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type UnixDateTimeMillisecondsNumber } from '../date/date';
|
|
2
2
|
/**
|
|
3
3
|
* String representation of data that is stored.
|
|
4
4
|
*/
|
|
@@ -15,7 +15,7 @@ export interface StoredData {
|
|
|
15
15
|
* The Unix timestamp (in milliseconds) when the data was stored.
|
|
16
16
|
* Undefined if the storage time is not known or not applicable.
|
|
17
17
|
*/
|
|
18
|
-
readonly storedAt:
|
|
18
|
+
readonly storedAt: UnixDateTimeMillisecondsNumber | undefined;
|
|
19
19
|
/**
|
|
20
20
|
* The actual data stored, as a string.
|
|
21
21
|
*/
|
|
@@ -110,11 +110,3 @@ export declare function fileExtensionForMimeType(mimeType: Maybe<MimeTypeWithout
|
|
|
110
110
|
* @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Content-Disposition
|
|
111
111
|
*/
|
|
112
112
|
export type ContentDispositionString = 'inline' | 'attachment' | string;
|
|
113
|
-
/**
|
|
114
|
-
* @deprecated Use ImageFileExtension instead.
|
|
115
|
-
*/
|
|
116
|
-
export type MimeTypeForImageTypeInputType = ImageFileExtension;
|
|
117
|
-
/**
|
|
118
|
-
* @deprecated Use mimeTypeForImageFileExtension instead.
|
|
119
|
-
*/
|
|
120
|
-
export declare const mimetypeForImageType: typeof mimeTypeForImageFileExtension;
|
|
@@ -75,7 +75,17 @@ export declare function findAllCharacterOccurences(set: Set<string>, input: stri
|
|
|
75
75
|
* @returns
|
|
76
76
|
*/
|
|
77
77
|
export declare function findFirstCharacterOccurence(set: Set<string>, input: string): Maybe<number>;
|
|
78
|
-
|
|
78
|
+
/**
|
|
79
|
+
* The result of splitting a string at the first character occurence.
|
|
80
|
+
*
|
|
81
|
+
* The first element is the string before the split character(s).
|
|
82
|
+
* The second element is the string after the split character(s), or is undefined if no split occured.
|
|
83
|
+
*/
|
|
84
|
+
export type SplitStringAtFirstCharacterOccurenceResult = [string, string | undefined];
|
|
85
|
+
/**
|
|
86
|
+
* Splits the input string at the configured split character(s).
|
|
87
|
+
*/
|
|
88
|
+
export type SplitStringAtFirstCharacterOccurenceFunction = (input: string) => SplitStringAtFirstCharacterOccurenceResult;
|
|
79
89
|
/**
|
|
80
90
|
* Splits the string into two parts at the first occurence of a string or any string in the set.
|
|
81
91
|
*
|
|
@@ -79,13 +79,3 @@ export declare function flattenTreeToArrayFunction<N extends TreeNode<unknown, N
|
|
|
79
79
|
* @returns A FlattenTreeFunction that collects values of type V.
|
|
80
80
|
*/
|
|
81
81
|
export declare function flattenTreeToArrayFunction<N extends TreeNode<unknown, N>, V>(mapNodeFn?: (node: N) => V, defaultAddNodeFn?: Maybe<FlattenTreeAddNodeDecisionFunction<N, V>>): FlattenTreeFunction<N, V>;
|
|
82
|
-
/**
|
|
83
|
-
* Convenience function for flattening multiple trees with a single configured flatten function.
|
|
84
|
-
*
|
|
85
|
-
* @deprecated FlattenTreeFunction now supports an array of trees.
|
|
86
|
-
*
|
|
87
|
-
* @param trees
|
|
88
|
-
* @param flattenFn
|
|
89
|
-
* @returns
|
|
90
|
-
*/
|
|
91
|
-
export declare function flattenTrees<N extends TreeNode<unknown, N>, V>(trees: ArrayOrValue<N>, flattenFn: FlattenTreeFunction<N, V>, addNodeFn?: Maybe<FlattenTreeAddNodeDecisionFunction<N, V>>): V[];
|
|
@@ -356,4 +356,4 @@ export declare function stepsFromIndexFunction(config: StepsFromIndexFunctionCon
|
|
|
356
356
|
* For instance, an index of 5 on a range of 0 to 3 will return the index 1.
|
|
357
357
|
*/
|
|
358
358
|
export declare function stepsFromIndex(range: IndexRange, startIndex: number, step?: number, wrapAround?: boolean): Maybe<number>;
|
|
359
|
-
export declare const isSelectedIndexDecisionFunction: import("
|
|
359
|
+
export declare const isSelectedIndexDecisionFunction: import("..").IsSelectedDecisionFunctionFactory<IndexRef, number>;
|
|
@@ -4,9 +4,9 @@ import { type NonNever } from 'ts-essentials';
|
|
|
4
4
|
*/
|
|
5
5
|
export type MaybeNot = null | undefined;
|
|
6
6
|
/**
|
|
7
|
-
* A non-null/undefined value.
|
|
7
|
+
* A non-null/undefined/void value.
|
|
8
8
|
*/
|
|
9
|
-
export type MaybeSo<T = unknown> = T extends MaybeNot ? never : T;
|
|
9
|
+
export type MaybeSo<T = unknown> = T extends MaybeNot | void ? never : T;
|
|
10
10
|
/**
|
|
11
11
|
* A value that might exist, or be null/undefined instead.
|
|
12
12
|
*/
|
|
@@ -14,7 +14,7 @@ export type Maybe<T> = T | MaybeNot;
|
|
|
14
14
|
/**
|
|
15
15
|
* A value that is not null/undefined.
|
|
16
16
|
*/
|
|
17
|
-
export type MaybeSoStrict<T> = T extends Maybe<infer A> ? (A extends Maybe<infer B> ? B extends Maybe<infer C> ? C extends Maybe<infer D> ? D extends Maybe<infer E> ? E : D : C : B : A) : T;
|
|
17
|
+
export type MaybeSoStrict<T> = T extends Maybe<infer A> ? (A extends Maybe<infer B> ? (B extends Maybe<infer C> ? (C extends Maybe<infer D> ? (D extends Maybe<infer E> ? E : D) : C) : B) : A) : T;
|
|
18
18
|
/**
|
|
19
19
|
* Turns all key values in an object into a Maybe value.
|
|
20
20
|
*/
|
package/src/lib/value/point.d.ts
CHANGED
|
@@ -34,8 +34,8 @@ export declare function isSameLatLngPoint(a: Maybe<LatLngPoint>, b: Maybe<LatLng
|
|
|
34
34
|
export declare function diffLatLngPoints(a: LatLngPoint, b: LatLngPoint, wrap?: boolean): LatLngPoint;
|
|
35
35
|
export declare function addLatLngPoints(a: LatLngPoint, b: LatLngPoint, wrap?: boolean): LatLngPoint;
|
|
36
36
|
export declare function wrapLatLngPoint(a: LatLngPoint): LatLngPoint;
|
|
37
|
-
export declare const capLatValue: import("
|
|
38
|
-
export declare const wrapLngValue: import("
|
|
37
|
+
export declare const capLatValue: import("..").BoundNumberFunction<number>;
|
|
38
|
+
export declare const wrapLngValue: import("..").WrapNumberFunction<number>;
|
|
39
39
|
export declare function isValidLatitude(lat: Latitude): boolean;
|
|
40
40
|
export declare function isValidLongitude(lat: Longitude): boolean;
|
|
41
41
|
export declare function defaultLatLngPoint(): LatLngPoint;
|
package/test/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Hapier Creative LLC.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|