@oscarpalmer/atoms 0.184.1 → 0.185.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/index.d.mts +2 -2
- package/dist/array/index.mjs +2 -2
- package/dist/array/{position.d.mts → match.d.mts} +9 -6
- package/dist/array/{position.mjs → match.mjs} +16 -16
- package/dist/array/move.mjs +1 -1
- package/dist/array/single.mjs +2 -2
- package/dist/array/sort.d.mts +9 -4
- package/dist/array/sort.mjs +6 -6
- package/dist/array/swap.mjs +1 -1
- package/dist/beacon.d.mts +12 -0
- package/dist/beacon.mjs +9 -0
- package/dist/color/instance.d.mts +8 -0
- package/dist/color/instance.mjs +5 -2
- package/dist/color/misc/get.mjs +8 -8
- package/dist/color/misc/state.d.mts +2 -2
- package/dist/color/misc/state.mjs +2 -2
- package/dist/color/models.d.mts +30 -0
- package/dist/function/assert.d.mts +29 -8
- package/dist/function/assert.mjs +29 -8
- package/dist/function/memoize.d.mts +3 -0
- package/dist/function/memoize.mjs +3 -0
- package/dist/function/once.mjs +9 -9
- package/dist/function/retry.d.mts +3 -0
- package/dist/function/retry.mjs +11 -8
- package/dist/function/work.mjs +1 -1
- package/dist/index.d.mts +272 -160
- package/dist/index.mjs +279 -216
- package/dist/internal/number.d.mts +2 -1
- package/dist/internal/number.mjs +4 -1
- package/dist/internal/value/compare.d.mts +2 -1
- package/dist/internal/value/equal.d.mts +5 -0
- package/dist/internal/value/equal.mjs +5 -5
- package/dist/internal/value/get.d.mts +2 -2
- package/dist/internal/value/has.d.mts +3 -3
- package/dist/internal/value/has.mjs +1 -1
- package/dist/internal/value/misc.d.mts +2 -2
- package/dist/internal/value/misc.mjs +10 -4
- package/dist/logger.d.mts +11 -0
- package/dist/logger.mjs +11 -0
- package/dist/models.d.mts +1 -1
- package/dist/promise/helpers.mjs +3 -5
- package/dist/promise/index.d.mts +0 -6
- package/dist/promise/models.d.mts +36 -0
- package/dist/promise/models.mjs +6 -0
- package/dist/queue.d.mts +13 -1
- package/dist/queue.mjs +14 -7
- package/dist/result/index.d.mts +0 -8
- package/dist/result/index.mjs +0 -8
- package/dist/result/match.d.mts +4 -4
- package/dist/result/work/flow.d.mts +12 -36
- package/dist/result/work/pipe.d.mts +11 -33
- package/dist/sized/set.d.mts +3 -2
- package/dist/sized/set.mjs +3 -2
- package/dist/string/fuzzy.mjs +2 -2
- package/dist/value/handle.mjs +1 -1
- package/dist/value/merge.d.mts +0 -1
- package/dist/value/merge.mjs +0 -1
- package/dist/value/shake.d.mts +3 -0
- package/dist/value/smush.d.mts +3 -0
- package/dist/value/transform.d.mts +9 -0
- package/dist/value/unsmush.d.mts +3 -0
- package/package.json +3 -3
- package/src/array/difference.ts +4 -0
- package/src/array/from.ts +4 -0
- package/src/array/index.ts +1 -1
- package/src/array/intersection.ts +4 -0
- package/src/array/{position.ts → match.ts} +28 -25
- package/src/array/move.ts +5 -1
- package/src/array/reverse.ts +4 -0
- package/src/array/select.ts +2 -0
- package/src/array/single.ts +2 -2
- package/src/array/sort.ts +14 -9
- package/src/array/swap.ts +5 -1
- package/src/array/toggle.ts +4 -0
- package/src/array/union.ts +4 -0
- package/src/beacon.ts +12 -0
- package/src/color/index.ts +0 -3
- package/src/color/instance.ts +11 -3
- package/src/color/misc/get.ts +8 -8
- package/src/color/misc/state.ts +1 -1
- package/src/color/models.ts +30 -0
- package/src/function/assert.ts +66 -7
- package/src/function/memoize.ts +3 -0
- package/src/function/once.ts +13 -9
- package/src/function/retry.ts +11 -8
- package/src/internal/number.ts +6 -0
- package/src/internal/value/compare.ts +2 -1
- package/src/internal/value/equal.ts +10 -5
- package/src/internal/value/get.ts +2 -2
- package/src/internal/value/has.ts +6 -6
- package/src/internal/value/misc.ts +24 -13
- package/src/logger.ts +11 -0
- package/src/models.ts +1 -1
- package/src/promise/helpers.ts +3 -6
- package/src/promise/index.ts +0 -6
- package/src/promise/models.ts +36 -0
- package/src/queue.ts +23 -11
- package/src/result/index.ts +0 -8
- package/src/result/match.ts +4 -4
- package/src/result/work/flow.ts +12 -36
- package/src/result/work/pipe.ts +11 -33
- package/src/sized/set.ts +4 -3
- package/src/string/fuzzy.ts +2 -2
- package/src/value/merge.ts +0 -1
- package/src/value/shake.ts +3 -0
- package/src/value/smush.ts +3 -0
- package/src/value/transform.ts +9 -0
- package/src/value/unsmush.ts +3 -0
package/dist/index.d.mts
CHANGED
|
@@ -13,7 +13,7 @@ type AsyncCancelableCallback<Callback extends GenericAsyncCallback | GenericCall
|
|
|
13
13
|
cancel: () => void;
|
|
14
14
|
};
|
|
15
15
|
/**
|
|
16
|
-
* For
|
|
16
|
+
* For matching any `void`, `Date`, primitive, or `RegExp` values
|
|
17
17
|
*
|
|
18
18
|
* (Thanks, type-fest!)
|
|
19
19
|
*/
|
|
@@ -812,8 +812,11 @@ declare function partition<Item>(array: Item[], filter: (item: Item, index: numb
|
|
|
812
812
|
*/
|
|
813
813
|
declare function partition<Item>(array: Item[], item: Item): Item[][];
|
|
814
814
|
//#endregion
|
|
815
|
-
//#region src/array/
|
|
816
|
-
|
|
815
|
+
//#region src/array/match.d.ts
|
|
816
|
+
/**
|
|
817
|
+
* Comparison of an array within another array
|
|
818
|
+
*/
|
|
819
|
+
type ArrayComparison = 'end' | 'inside' | 'invalid' | 'outside' | 'same' | 'start';
|
|
817
820
|
/**
|
|
818
821
|
* Does the needle array end the haystack array?
|
|
819
822
|
* @param haystack Haystack array
|
|
@@ -844,7 +847,7 @@ declare function endsWithArray<Item>(haystack: Item[], needle: Item[]): boolean;
|
|
|
844
847
|
* @param key Key to get an item's value for matching
|
|
845
848
|
* @returns Position of the needle within the haystack
|
|
846
849
|
*/
|
|
847
|
-
declare function
|
|
850
|
+
declare function getArrayComparison<Item extends PlainObject>(haystack: Item[], needle: Item[], key: keyof Item): ArrayComparison;
|
|
848
851
|
/**
|
|
849
852
|
* Get the position of an array within another array
|
|
850
853
|
* @param haystack Haystack array
|
|
@@ -852,14 +855,14 @@ declare function getArrayPosition<Item extends PlainObject>(haystack: Item[], ne
|
|
|
852
855
|
* @param callback Callback to get an item's value for matching
|
|
853
856
|
* @returns Position of the needle within the haystack
|
|
854
857
|
*/
|
|
855
|
-
declare function
|
|
858
|
+
declare function getArrayComparison<Item>(haystack: Item[], needle: Item[], callback: (item: Item, index: number, array: Item[]) => unknown): ArrayComparison;
|
|
856
859
|
/**
|
|
857
860
|
* Get the position of an array within another array
|
|
858
861
|
* @param haystack Haystack array
|
|
859
862
|
* @param needle Needle array
|
|
860
863
|
* @returns Position of the needle within the haystack
|
|
861
864
|
*/
|
|
862
|
-
declare function
|
|
865
|
+
declare function getArrayComparison<Item>(haystack: Item[], needle: Item[]): ArrayComparison;
|
|
863
866
|
/**
|
|
864
867
|
* Does the needle array exist within the haystack array?
|
|
865
868
|
* @param haystack Haystack array
|
|
@@ -1535,6 +1538,11 @@ type ComparisonSorter<Item> = (first: Item, second: Item) => number;
|
|
|
1535
1538
|
* Direction to sort by
|
|
1536
1539
|
*/
|
|
1537
1540
|
type SortDirection = 'ascending' | 'descending';
|
|
1541
|
+
/**
|
|
1542
|
+
* Sorter for an array with predefined sorters
|
|
1543
|
+
*
|
|
1544
|
+
* Can be used to sort an array, get the predicted index for an item, and check if an array is sorted
|
|
1545
|
+
*/
|
|
1538
1546
|
type Sorter<Item> = {
|
|
1539
1547
|
/**
|
|
1540
1548
|
* Sort an array of items
|
|
@@ -1563,7 +1571,7 @@ type Sorter<Item> = {
|
|
|
1563
1571
|
*
|
|
1564
1572
|
* _(If the array is not sorted, it will be treated as sorted, and the result may be inaccurate)_
|
|
1565
1573
|
*
|
|
1566
|
-
* Available as `getSortedIndex` and `sort.
|
|
1574
|
+
* Available as `getSortedIndex` and `sort.getIndex`
|
|
1567
1575
|
* @param array Array to get the index from
|
|
1568
1576
|
* @param item Item to get the index for
|
|
1569
1577
|
* @param sorters Sorters to use to determine sorting
|
|
@@ -1576,7 +1584,7 @@ declare function getSortedIndex<Item>(array: Item[], item: Item, sorters: Array<
|
|
|
1576
1584
|
*
|
|
1577
1585
|
* _(If the array is not sorted, it will be treated as sorted, and the result may be inaccurate)_
|
|
1578
1586
|
*
|
|
1579
|
-
* Available as `getSortedIndex` and `sort.
|
|
1587
|
+
* Available as `getSortedIndex` and `sort.getIndex`
|
|
1580
1588
|
* @param array Array to get the index from
|
|
1581
1589
|
* @param item Item to get the index for
|
|
1582
1590
|
* @param sorter Sorter to use to determine sorting
|
|
@@ -1589,7 +1597,7 @@ declare function getSortedIndex<Item>(array: Item[], item: Item, sorter: ArraySo
|
|
|
1589
1597
|
*
|
|
1590
1598
|
* _(If the array is not sorted, it will be treated as sorted, and the result may be inaccurate)_
|
|
1591
1599
|
*
|
|
1592
|
-
* Available as `getSortedIndex` and `sort.
|
|
1600
|
+
* Available as `getSortedIndex` and `sort.getIndex`
|
|
1593
1601
|
* @param array Array to get the index from
|
|
1594
1602
|
* @param item Item to get the index for
|
|
1595
1603
|
* @param descending Sorted in descending order? _(defaults to `false`)_
|
|
@@ -1679,7 +1687,7 @@ declare function sort<Item>(array: Item[], sorter: ArraySorter<Item>, descending
|
|
|
1679
1687
|
*/
|
|
1680
1688
|
declare function sort<Item>(array: Item[], descending?: boolean): Item[];
|
|
1681
1689
|
declare namespace sort {
|
|
1682
|
-
var
|
|
1690
|
+
var getIndex: typeof getSortedIndex;
|
|
1683
1691
|
var initialize: typeof initializeSorter;
|
|
1684
1692
|
var is: typeof isSorted;
|
|
1685
1693
|
}
|
|
@@ -2020,12 +2028,20 @@ declare function toRecordArrays<Item, Callback extends (item: Item, index: numbe
|
|
|
2020
2028
|
declare function toRecordArrays<Item extends PlainObject, ItemKey extends keyof Item>(array: Item[], key: ItemKey): Simplify<Record<KeyedValue<Item, ItemKey>, Item[]>>;
|
|
2021
2029
|
//#endregion
|
|
2022
2030
|
//#region src/function/assert.d.ts
|
|
2031
|
+
/**
|
|
2032
|
+
* Asserter for a nested property of a value
|
|
2033
|
+
*/
|
|
2034
|
+
type AssertProperty<Value extends PlainObject, Path extends NestedKeys<Value>, Asserted extends NestedPick<Value, Path> = NestedPick<Value, Path>> = Asserter<Asserted>;
|
|
2035
|
+
/**
|
|
2036
|
+
* A function that asserts a value is of a specific type, throwing an error if it is not
|
|
2037
|
+
*/
|
|
2023
2038
|
type Asserter<Value> = (value: unknown) => asserts value is Value;
|
|
2039
|
+
type NestedPick<Value, Path extends string> = Value extends PlainObject ? Path extends `${infer Head}.${infer Rest}` ? Head extends keyof Value ? { [Key in Head]: NestedPick<Value[Key], Rest> } : never : Path extends keyof Value ? { [Key in Path]: Value[Key] } : never : never;
|
|
2024
2040
|
/**
|
|
2025
2041
|
* Asserts that a condition is true, throwing an error if it is not
|
|
2026
2042
|
* @param condition Condition to assert
|
|
2027
2043
|
* @param message Error message
|
|
2028
|
-
* @param error Error constructor
|
|
2044
|
+
* @param error Error constructor _(defaults to `Error`)_
|
|
2029
2045
|
*/
|
|
2030
2046
|
declare function assert<Condition extends () => boolean>(condition: Condition, message: string, error?: ErrorConstructor): asserts condition;
|
|
2031
2047
|
declare namespace assert {
|
|
@@ -2033,6 +2049,7 @@ declare namespace assert {
|
|
|
2033
2049
|
var defined: typeof assertDefined;
|
|
2034
2050
|
var instanceOf: typeof assertInstanceOf;
|
|
2035
2051
|
var is: typeof assertIs;
|
|
2052
|
+
var property: typeof assertProperty;
|
|
2036
2053
|
}
|
|
2037
2054
|
/**
|
|
2038
2055
|
* Creates an asserter that asserts a condition is true, throwing an error if it is not
|
|
@@ -2040,25 +2057,26 @@ declare namespace assert {
|
|
|
2040
2057
|
* Available as `assertCondition` and `assert.condition`
|
|
2041
2058
|
* @param condition Condition to assert
|
|
2042
2059
|
* @param message Error message
|
|
2043
|
-
* @param error Error constructor
|
|
2060
|
+
* @param error Error constructor _(defaults to `Error`)_
|
|
2044
2061
|
* @returns Asserter
|
|
2045
2062
|
*/
|
|
2046
2063
|
declare function assertCondition<Value>(condition: (value: unknown) => boolean, message: string, error?: ErrorConstructor): Asserter<Value>;
|
|
2047
2064
|
/**
|
|
2048
|
-
* Asserts that a value is defined throwing an error if it is not
|
|
2065
|
+
* Asserts that a value is defined, throwing an error if it is not
|
|
2049
2066
|
*
|
|
2050
2067
|
* Available as `assertDefined` and `assert.defined`
|
|
2051
2068
|
* @param value Value to assert
|
|
2052
2069
|
* @param message Error message
|
|
2070
|
+
* @param error Error constructor _(defaults to `Error`)_
|
|
2053
2071
|
*/
|
|
2054
|
-
declare function assertDefined<Value>(value: unknown, message?: string): asserts value is Exclude<Value, null | undefined>;
|
|
2072
|
+
declare function assertDefined<Value>(value: unknown, message?: string, error?: ErrorConstructor): asserts value is Exclude<Value, null | undefined>;
|
|
2055
2073
|
/**
|
|
2056
2074
|
* Creates an asserter that asserts a value is an instance of a constructor, throwing an error if it is not
|
|
2057
2075
|
*
|
|
2058
2076
|
* Available as `assertInstanceOf` and `assert.instanceOf`
|
|
2059
2077
|
* @param constructor Constructor to check against
|
|
2060
2078
|
* @param message Error message
|
|
2061
|
-
* @param error Error constructor
|
|
2079
|
+
* @param error Error constructor _(defaults to `Error`)_
|
|
2062
2080
|
* @returns Asserter
|
|
2063
2081
|
*/
|
|
2064
2082
|
declare function assertInstanceOf<Value>(constructor: Constructor<Value>, message: string, error?: ErrorConstructor): Asserter<Value>;
|
|
@@ -2068,10 +2086,21 @@ declare function assertInstanceOf<Value>(constructor: Constructor<Value>, messag
|
|
|
2068
2086
|
* Available as `assertIs` and `assert.is`
|
|
2069
2087
|
* @param condition Type guard function to check the value
|
|
2070
2088
|
* @param message Error message
|
|
2071
|
-
* @param error Error constructor
|
|
2089
|
+
* @param error Error constructor _(defaults to `Error`)_
|
|
2072
2090
|
* @returns Asserter
|
|
2073
2091
|
*/
|
|
2074
2092
|
declare function assertIs<Value>(condition: (value: unknown) => value is Value, message: string, error?: ErrorConstructor): Asserter<Value>;
|
|
2093
|
+
/**
|
|
2094
|
+
* Creates an asserter that asserts a property of a value exists and satisfies a condition, throwing an error if it does not
|
|
2095
|
+
*
|
|
2096
|
+
* Available as `assertProperty` and `assert.property`
|
|
2097
|
+
* @param path Path to the property to check, e.g., `foo.bar.baz` for a nested property
|
|
2098
|
+
* @param condition Condition to assert for the property
|
|
2099
|
+
* @param message Error message
|
|
2100
|
+
* @param error Error constructor _(defaults to `Error`)_
|
|
2101
|
+
* @returns Asserter
|
|
2102
|
+
*/
|
|
2103
|
+
declare function assertProperty<Value extends PlainObject, Path extends NestedKeys<Value>, Asserted = NestedPick<Value, Path>>(path: Path, condition: (value: NestedValue<Value, Path>) => boolean, message: string, error?: ErrorConstructor): Asserter<Asserted>;
|
|
2075
2104
|
//#endregion
|
|
2076
2105
|
//#region src/internal/function/misc.d.ts
|
|
2077
2106
|
/**
|
|
@@ -2080,6 +2109,9 @@ declare function assertIs<Value>(condition: (value: unknown) => value is Value,
|
|
|
2080
2109
|
declare function noop(): void;
|
|
2081
2110
|
//#endregion
|
|
2082
2111
|
//#region src/function/memoize.d.ts
|
|
2112
|
+
/**
|
|
2113
|
+
* A memoized function, caching and retrieving results based on the its parameters _(or a custom cache key)_
|
|
2114
|
+
*/
|
|
2083
2115
|
declare class Memoized<Callback extends GenericCallback> {
|
|
2084
2116
|
#private;
|
|
2085
2117
|
/**
|
|
@@ -2219,6 +2251,9 @@ declare namespace once {
|
|
|
2219
2251
|
}
|
|
2220
2252
|
//#endregion
|
|
2221
2253
|
//#region src/function/retry.d.ts
|
|
2254
|
+
/**
|
|
2255
|
+
* An error thrown when a retry fails
|
|
2256
|
+
*/
|
|
2222
2257
|
declare class RetryError extends Error {
|
|
2223
2258
|
readonly original: unknown;
|
|
2224
2259
|
constructor(message: string, original: unknown);
|
|
@@ -2672,6 +2707,7 @@ declare function tryEncode(value: boolean | number | string): unknown;
|
|
|
2672
2707
|
declare function words(value: string): string[];
|
|
2673
2708
|
//#endregion
|
|
2674
2709
|
//#region src/internal/value/compare.d.ts
|
|
2710
|
+
type Comparator<Value = any> = (first: Value, second: Value) => number;
|
|
2675
2711
|
/**
|
|
2676
2712
|
* Compare two values _(for sorting purposes)_
|
|
2677
2713
|
* @param first First value
|
|
@@ -2702,7 +2738,7 @@ declare function deregisterComparator<Instance>(constructor: Constructor<Instanc
|
|
|
2702
2738
|
* @param constructor Class constructor
|
|
2703
2739
|
* @param handler Method name or comparison function _(defaults to `compare`)_
|
|
2704
2740
|
*/
|
|
2705
|
-
declare function registerComparator<Instance>(constructor: Constructor<Instance>, handler?: string |
|
|
2741
|
+
declare function registerComparator<Instance>(constructor: Constructor<Instance>, handler?: string | Comparator<Instance>): void;
|
|
2706
2742
|
//#endregion
|
|
2707
2743
|
//#region src/internal/value/equal.d.ts
|
|
2708
2744
|
/**
|
|
@@ -2722,6 +2758,11 @@ type EqualOptions = {
|
|
|
2722
2758
|
*/
|
|
2723
2759
|
relaxedNullish?: boolean;
|
|
2724
2760
|
};
|
|
2761
|
+
/**
|
|
2762
|
+
* An equalizer function for comparing values for equality, with predefined options
|
|
2763
|
+
*
|
|
2764
|
+
* Can be used to compare values, and register or deregister equality comparison handlers for specific classes
|
|
2765
|
+
*/
|
|
2725
2766
|
type Equalizer = {
|
|
2726
2767
|
/**
|
|
2727
2768
|
* Are two strings equal?
|
|
@@ -2807,7 +2848,7 @@ declare function registerEqualizer<Instance>(constructor: Constructor<Instance>,
|
|
|
2807
2848
|
* @param path Path for value, e.g., `foo.bar.baz`
|
|
2808
2849
|
* @returns Found value, or `undefined`
|
|
2809
2850
|
*/
|
|
2810
|
-
declare function getValue<Data extends PlainObject, Path extends NestedKeys<Data>>(data: Data, path: Path): NestedValue<Data,
|
|
2851
|
+
declare function getValue<Data extends PlainObject, Path extends NestedKeys<Data>>(data: Data, path: Path): NestedValue<Data, Path>;
|
|
2811
2852
|
/**
|
|
2812
2853
|
* Get the value from an object using an unknown path
|
|
2813
2854
|
* @param data Object to get value from
|
|
@@ -2845,7 +2886,7 @@ declare namespace hasValue {
|
|
|
2845
2886
|
* @param ignoreCase If `true`, the path matching is case-insensitive
|
|
2846
2887
|
* @return Result object
|
|
2847
2888
|
*/
|
|
2848
|
-
declare function hasValueResult<Data extends PlainObject, Path extends NestedKeys<Data>>(data: Data, path: Path, ignoreCase?: boolean): Result<NestedValue<Data, ToString<Path>>,
|
|
2889
|
+
declare function hasValueResult<Data extends PlainObject, Path extends NestedKeys<Data>>(data: Data, path: Path, ignoreCase?: boolean): Result<NestedValue<Data, ToString<Path>>, string>;
|
|
2849
2890
|
/**
|
|
2850
2891
|
* Check if a nested property is defined in an object, and get its value if it is
|
|
2851
2892
|
*
|
|
@@ -2855,7 +2896,7 @@ declare function hasValueResult<Data extends PlainObject, Path extends NestedKey
|
|
|
2855
2896
|
* @param ignoreCase If `true`, the path matching is case-insensitive
|
|
2856
2897
|
* @return Result object
|
|
2857
2898
|
*/
|
|
2858
|
-
declare function hasValueResult<Data extends PlainObject>(data: Data, path: string, ignoreCase?: boolean): Result<unknown,
|
|
2899
|
+
declare function hasValueResult<Data extends PlainObject>(data: Data, path: string, ignoreCase?: boolean): Result<unknown, string>;
|
|
2859
2900
|
//#endregion
|
|
2860
2901
|
//#region src/internal/value/set.d.ts
|
|
2861
2902
|
/**
|
|
@@ -3431,6 +3472,9 @@ declare function omit<Value extends PlainObject, ValueKey extends keyof Value>(v
|
|
|
3431
3472
|
declare function pick<Value extends PlainObject, ValueKey extends keyof Value>(value: Value, keys: ValueKey[]): Pick<Value, ValueKey>;
|
|
3432
3473
|
//#endregion
|
|
3433
3474
|
//#region src/value/shake.d.ts
|
|
3475
|
+
/**
|
|
3476
|
+
* A shaken object, without any `undefined` values
|
|
3477
|
+
*/
|
|
3434
3478
|
type Shaken<Value extends PlainObject> = { [Key in keyof Value]: Value[Key] extends undefined ? never : Value[Key] };
|
|
3435
3479
|
/**
|
|
3436
3480
|
* Shake an object, removing all keys with `undefined` values
|
|
@@ -3440,6 +3484,9 @@ type Shaken<Value extends PlainObject> = { [Key in keyof Value]: Value[Key] exte
|
|
|
3440
3484
|
declare function shake<Value extends PlainObject>(value: Value): Shaken<Value>;
|
|
3441
3485
|
//#endregion
|
|
3442
3486
|
//#region src/value/smush.d.ts
|
|
3487
|
+
/**
|
|
3488
|
+
* A smushed object, with all nested objects flattened into a single level, using dot notation keys
|
|
3489
|
+
*/
|
|
3443
3490
|
type Smushed<Value extends PlainObject> = Simplify<{ [NestedKey in NestedKeys<Value>]: NestedValue<Value, ToString<NestedKey>> }>;
|
|
3444
3491
|
/**
|
|
3445
3492
|
* Smush an object into a flat object that uses dot notation keys
|
|
@@ -3457,6 +3504,9 @@ type KeysOfUnion<ObjectType> = keyof UnionToIntersection<ObjectType extends unkn
|
|
|
3457
3504
|
* Thanks, type-fest!
|
|
3458
3505
|
*/
|
|
3459
3506
|
type UnionToIntersection<Union> = (Union extends unknown ? (distributedUnion: Union) => void : never) extends ((mergedIntersection: infer Intersection) => void) ? Intersection & Union : never;
|
|
3507
|
+
/**
|
|
3508
|
+
* An unsmushed object, with all dot notation keys turned into nested keys
|
|
3509
|
+
*/
|
|
3460
3510
|
type Unsmushed<Value extends PlainObject> = Simplify<Omit<{ [UnionKey in KeysOfUnion<Value>]: Value[UnionKey] }, `${string}.${string}`>>;
|
|
3461
3511
|
/**
|
|
3462
3512
|
* Unsmush a smushed object _(turning dot notation keys into nested keys)_
|
|
@@ -3558,13 +3608,21 @@ declare function merge<Model extends ArrayOrPlainObject>(values: NestedPartial<M
|
|
|
3558
3608
|
*/
|
|
3559
3609
|
declare function merge(values: NestedPartial<ArrayOrPlainObject>[], options?: MergeOptions): ArrayOrPlainObject;
|
|
3560
3610
|
declare namespace merge {
|
|
3561
|
-
var assign: typeof assign;
|
|
3562
3611
|
var initialize: typeof initializeMerger;
|
|
3563
3612
|
}
|
|
3564
3613
|
//#endregion
|
|
3565
3614
|
//#region src/value/transform.d.ts
|
|
3615
|
+
/**
|
|
3616
|
+
* A callback transform an object's properties
|
|
3617
|
+
*/
|
|
3566
3618
|
type TransformCallback<Value extends PlainObject, Key extends keyof Value> = (key: Key, value: Value[Key]) => Value[Key];
|
|
3619
|
+
/**
|
|
3620
|
+
* A collection of keyed callbacks to transform an object's properties
|
|
3621
|
+
*/
|
|
3567
3622
|
type TransformCallbacks<Value extends PlainObject> = Partial<{ [Key in keyof Value]: (value: Value[Key]) => Value[Key] }>;
|
|
3623
|
+
/**
|
|
3624
|
+
* A transformer function for an object, with predefined callbacks for transforming its properties
|
|
3625
|
+
*/
|
|
3568
3626
|
type Transformer<Value extends PlainObject> = {
|
|
3569
3627
|
(value: Value): Value;
|
|
3570
3628
|
};
|
|
@@ -3603,6 +3661,9 @@ declare namespace transform {
|
|
|
3603
3661
|
}
|
|
3604
3662
|
//#endregion
|
|
3605
3663
|
//#region src/beacon.d.ts
|
|
3664
|
+
/**
|
|
3665
|
+
* A beacon is a lighthouse, holding an observable value that can be subscribed to and emitted from
|
|
3666
|
+
*/
|
|
3606
3667
|
declare class Beacon<Value> {
|
|
3607
3668
|
#private;
|
|
3608
3669
|
/**
|
|
@@ -3652,6 +3713,9 @@ type BeaconOptions<Value> = {
|
|
|
3652
3713
|
*/
|
|
3653
3714
|
equal?: (first: Value, second: Value) => boolean;
|
|
3654
3715
|
};
|
|
3716
|
+
/**
|
|
3717
|
+
* An observable holds a value and allows observers to subscribe to changes in that value
|
|
3718
|
+
*/
|
|
3655
3719
|
declare class Observable<Value> {
|
|
3656
3720
|
#private;
|
|
3657
3721
|
constructor(instance: Beacon<Value>, observers: Map<Subscription<Value>, Observer<Value>>);
|
|
@@ -3679,6 +3743,9 @@ type ObservableState<Value> = {
|
|
|
3679
3743
|
closed: boolean;
|
|
3680
3744
|
observers: Map<Subscription<Value>, Observer<Value>>;
|
|
3681
3745
|
};
|
|
3746
|
+
/**
|
|
3747
|
+
* An observer receives notifications from an observable
|
|
3748
|
+
*/
|
|
3682
3749
|
type Observer<Value> = {
|
|
3683
3750
|
/**
|
|
3684
3751
|
* Callback for when the observable is completed
|
|
@@ -3693,6 +3760,9 @@ type Observer<Value> = {
|
|
|
3693
3760
|
*/
|
|
3694
3761
|
next?: (value: Value) => void;
|
|
3695
3762
|
};
|
|
3763
|
+
/**
|
|
3764
|
+
* A subscription represents an active subscription to an observable, holding its state and allowing it to be destroyed or unsubscribed from
|
|
3765
|
+
*/
|
|
3696
3766
|
declare class Subscription<Value> {
|
|
3697
3767
|
#private;
|
|
3698
3768
|
constructor(state: ObservableState<Value>);
|
|
@@ -3721,22 +3791,60 @@ declare function beacon<Value>(value: Value, options?: BeaconOptions<Value>): Be
|
|
|
3721
3791
|
type ColorWithAlpha = {
|
|
3722
3792
|
alpha: number;
|
|
3723
3793
|
};
|
|
3794
|
+
/**
|
|
3795
|
+
* An _HSL_-color with an alpha channel
|
|
3796
|
+
*/
|
|
3724
3797
|
type HSLAColor = HSLColor & ColorWithAlpha;
|
|
3798
|
+
/**
|
|
3799
|
+
* An _HSL_-color
|
|
3800
|
+
*/
|
|
3725
3801
|
type HSLColor = {
|
|
3802
|
+
/**
|
|
3803
|
+
* Hue of the color _(in degrees; 0-360)_
|
|
3804
|
+
*/
|
|
3726
3805
|
hue: number;
|
|
3806
|
+
/**
|
|
3807
|
+
* Lightness of the color _(in percentage; 0-100)_
|
|
3808
|
+
*/
|
|
3727
3809
|
lightness: number;
|
|
3810
|
+
/**
|
|
3811
|
+
* Saturation of the color _(in percentage; 0-100)_
|
|
3812
|
+
*/
|
|
3728
3813
|
saturation: number;
|
|
3729
3814
|
};
|
|
3815
|
+
/**
|
|
3816
|
+
* An _RGB_-color with an alpha channel
|
|
3817
|
+
*/
|
|
3730
3818
|
type RGBAColor = RGBColor & ColorWithAlpha;
|
|
3819
|
+
/**
|
|
3820
|
+
* An _RGB_-color
|
|
3821
|
+
*/
|
|
3731
3822
|
type RGBColor = {
|
|
3823
|
+
/**
|
|
3824
|
+
* Blue channel of the color _(in hexadecimal; 0-255)_
|
|
3825
|
+
*/
|
|
3732
3826
|
blue: number;
|
|
3827
|
+
/**
|
|
3828
|
+
* Green channel of the color _(in hexadecimal; 0-255)_
|
|
3829
|
+
*/
|
|
3733
3830
|
green: number;
|
|
3831
|
+
/**
|
|
3832
|
+
* Red channel of the color _(in hexadecimal; 0-255)_
|
|
3833
|
+
*/
|
|
3734
3834
|
red: number;
|
|
3735
3835
|
};
|
|
3736
3836
|
//#endregion
|
|
3737
3837
|
//#region src/color/instance.d.ts
|
|
3838
|
+
/**
|
|
3839
|
+
* A color that is represented in multiple color formats
|
|
3840
|
+
*/
|
|
3738
3841
|
declare class Color {
|
|
3739
3842
|
#private;
|
|
3843
|
+
/**
|
|
3844
|
+
* A property to identify this as a Color instance, used for type checking
|
|
3845
|
+
*
|
|
3846
|
+
* @internal
|
|
3847
|
+
*/
|
|
3740
3848
|
private readonly $color;
|
|
3741
3849
|
/**
|
|
3742
3850
|
* Get the alpha channel
|
|
@@ -4136,6 +4244,11 @@ declare function isNumerical(value: unknown): value is number | `${number}`;
|
|
|
4136
4244
|
declare function isObject(value: unknown): value is object;
|
|
4137
4245
|
//#endregion
|
|
4138
4246
|
//#region src/logger.d.ts
|
|
4247
|
+
/**
|
|
4248
|
+
* A logger that can be used to log messages to the console
|
|
4249
|
+
*
|
|
4250
|
+
* _(Logging can be enabled or disabled by setting the `enabled` property)_
|
|
4251
|
+
*/
|
|
4139
4252
|
declare class Logger {
|
|
4140
4253
|
/**
|
|
4141
4254
|
* Log any number of values at the "debug" log level
|
|
@@ -4184,8 +4297,14 @@ declare class Logger {
|
|
|
4184
4297
|
*/
|
|
4185
4298
|
time(label: string): Time;
|
|
4186
4299
|
}
|
|
4300
|
+
/**
|
|
4301
|
+
* A named timer that can be used to log durations to the console
|
|
4302
|
+
*/
|
|
4187
4303
|
declare class Time {
|
|
4188
4304
|
#private;
|
|
4305
|
+
/**
|
|
4306
|
+
* Is the timer active? _(i.e. has it been started and not stopped, and is logging enabled?)_
|
|
4307
|
+
*/
|
|
4189
4308
|
get active(): boolean;
|
|
4190
4309
|
/**
|
|
4191
4310
|
* Log the current duration of the timer _(ignored if logging is disabled)_
|
|
@@ -4374,6 +4493,9 @@ declare function clamp(value: number, minimum: number, maximum: number, loop?: b
|
|
|
4374
4493
|
declare function getNumber(value: unknown): number;
|
|
4375
4494
|
//#endregion
|
|
4376
4495
|
//#region src/promise/models.d.ts
|
|
4496
|
+
/**
|
|
4497
|
+
* A promise that can be canceled
|
|
4498
|
+
*/
|
|
4377
4499
|
declare class CancelablePromise<Value = void> extends Promise<Value> {
|
|
4378
4500
|
#private;
|
|
4379
4501
|
constructor(executor: (resolve: (value: Value) => void, reject: (reason: unknown) => void) => void);
|
|
@@ -4383,8 +4505,17 @@ declare class CancelablePromise<Value = void> extends Promise<Value> {
|
|
|
4383
4505
|
*/
|
|
4384
4506
|
cancel(reason?: unknown): void;
|
|
4385
4507
|
}
|
|
4508
|
+
/**
|
|
4509
|
+
* A promise that was fulfilled
|
|
4510
|
+
*/
|
|
4386
4511
|
type FulfilledPromise<Value> = {
|
|
4512
|
+
/**
|
|
4513
|
+
* Status of the promise
|
|
4514
|
+
*/
|
|
4387
4515
|
status: typeof PROMISE_TYPE_FULFILLED;
|
|
4516
|
+
/**
|
|
4517
|
+
* Value of the promise
|
|
4518
|
+
*/
|
|
4388
4519
|
value: Awaited<Value>;
|
|
4389
4520
|
};
|
|
4390
4521
|
type PromiseData = {
|
|
@@ -4395,6 +4526,9 @@ type PromiseHandlers = {
|
|
|
4395
4526
|
resolve: (value: unknown[]) => void;
|
|
4396
4527
|
reject: (reason: unknown) => void;
|
|
4397
4528
|
};
|
|
4529
|
+
/**
|
|
4530
|
+
* Options for a promise-handling function
|
|
4531
|
+
*/
|
|
4398
4532
|
type PromiseOptions = {
|
|
4399
4533
|
/**
|
|
4400
4534
|
* AbortSignal for aborting the promise; when aborted, the promise will reject with the reason of the signal
|
|
@@ -4423,20 +4557,41 @@ type PromiseParameters = {
|
|
|
4423
4557
|
* - Returns an array of values
|
|
4424
4558
|
*/
|
|
4425
4559
|
type PromiseStrategy = 'complete' | 'first';
|
|
4560
|
+
/**
|
|
4561
|
+
* An error thrown when a promise times out
|
|
4562
|
+
*/
|
|
4426
4563
|
declare class PromiseTimeoutError extends Error {
|
|
4427
4564
|
constructor();
|
|
4428
4565
|
}
|
|
4429
4566
|
type PromisesItems<Items extends unknown[]> = { [ItemsKey in keyof Items]: Items[ItemsKey] extends GenericCallback ? ReturnType<Items[ItemsKey]> extends Promise<infer Value> ? Promise<Value> : never : Items[ItemsKey] extends Promise<infer Value> ? Promise<Value> : Promise<Items[ItemsKey]> };
|
|
4567
|
+
/**
|
|
4568
|
+
* Options for handling multiple promises
|
|
4569
|
+
*/
|
|
4430
4570
|
type PromisesOptions = {
|
|
4571
|
+
/**
|
|
4572
|
+
* AbortSignal for aborting the promises; when aborted, the promises will reject with the reason of the signal
|
|
4573
|
+
*/
|
|
4431
4574
|
signal?: AbortSignal;
|
|
4575
|
+
/**
|
|
4576
|
+
* Strategy for handling the promises; defaults to `complete`
|
|
4577
|
+
*/
|
|
4432
4578
|
strategy?: PromiseStrategy;
|
|
4433
4579
|
};
|
|
4434
4580
|
type PromisesResult<Items extends unknown[]> = { [ItemsKey in keyof Items]: Items[ItemsKey] extends Promise<infer Value> ? Result<Awaited<Value>> : never };
|
|
4435
4581
|
type PromisesUnwrapped<Items extends unknown[]> = { [ItemsKey in keyof Items]: Items[ItemsKey] extends GenericCallback ? ReturnType<Items[ItemsKey]> extends Promise<infer Value> ? Awaited<Value> : never : Items[ItemsKey] extends Promise<infer Value> ? Awaited<Value> : never };
|
|
4436
4582
|
type PromisesValue<Value> = FulfilledPromise<Value> | RejectedPromise;
|
|
4437
4583
|
type PromisesValues<Items extends unknown[]> = { [ItemsKey in keyof Items]: Items[ItemsKey] extends GenericCallback ? ReturnType<Items[ItemsKey]> extends Promise<infer Value> ? PromisesValue<Awaited<Value>> : never : Items[ItemsKey] extends Promise<infer Value> ? PromisesValue<Awaited<Value>> : never };
|
|
4584
|
+
/**
|
|
4585
|
+
* A promise that was rejected
|
|
4586
|
+
*/
|
|
4438
4587
|
type RejectedPromise = {
|
|
4588
|
+
/**
|
|
4589
|
+
* Status of the promise
|
|
4590
|
+
*/
|
|
4439
4591
|
status: typeof PROMISE_TYPE_REJECTED;
|
|
4592
|
+
/**
|
|
4593
|
+
* Reason for the rejection
|
|
4594
|
+
*/
|
|
4440
4595
|
reason: unknown;
|
|
4441
4596
|
};
|
|
4442
4597
|
declare const PROMISE_ABORT_EVENT = "abort";
|
|
@@ -4470,8 +4625,6 @@ declare function delay(time?: number): Promise<void>;
|
|
|
4470
4625
|
//#region src/promise/index.d.ts
|
|
4471
4626
|
/**
|
|
4472
4627
|
* Wrap a promise with safety handlers, with optional abort capabilities and timeout
|
|
4473
|
-
*
|
|
4474
|
-
* Available as `attemptPromise` and `attempt.promise`
|
|
4475
4628
|
* @param promise Promise to wrap
|
|
4476
4629
|
* @param options Options for the promise
|
|
4477
4630
|
* @returns Wrapped promise
|
|
@@ -4479,8 +4632,6 @@ declare function delay(time?: number): Promise<void>;
|
|
|
4479
4632
|
declare function attemptPromise<Value>(promise: Promise<Value>, options?: PromiseOptions | AbortSignal | number): Promise<Value>;
|
|
4480
4633
|
/**
|
|
4481
4634
|
* Wrap a promise-returning callback with safety handlers, with optional abort capabilities and timeout
|
|
4482
|
-
*
|
|
4483
|
-
* Available as `attemptPromise` and `attempt.promise`
|
|
4484
4635
|
* @param callback Callback to wrap
|
|
4485
4636
|
* @param options Options for the promise
|
|
4486
4637
|
* @returns Promise-wrapped callback
|
|
@@ -4488,8 +4639,6 @@ declare function attemptPromise<Value>(promise: Promise<Value>, options?: Promis
|
|
|
4488
4639
|
declare function attemptPromise<Value>(callback: () => Promise<Value>, options?: PromiseOptions | AbortSignal | number): Promise<Value>;
|
|
4489
4640
|
/**
|
|
4490
4641
|
* Wrap a callback with a promise and safety handlers, with optional abort capabilities and timeout
|
|
4491
|
-
*
|
|
4492
|
-
* Available as `attemptPromise` and `attempt.promise`
|
|
4493
4642
|
* @param callback Callback to wrap
|
|
4494
4643
|
* @param options Options for the promise
|
|
4495
4644
|
* @returns Promise-wrapped callback
|
|
@@ -4729,6 +4878,9 @@ declare function fromQuery(query: string): PlainObject;
|
|
|
4729
4878
|
declare function toQuery(parameters: PlainObject): string;
|
|
4730
4879
|
//#endregion
|
|
4731
4880
|
//#region src/queue.d.ts
|
|
4881
|
+
/**
|
|
4882
|
+
* A queue that can be used to manage (a)synchronous tasks with a specific key
|
|
4883
|
+
*/
|
|
4732
4884
|
declare class KeyedQueue<CallbackParameters extends Parameters<GenericAsyncCallback>, CallbackResult> {
|
|
4733
4885
|
#private;
|
|
4734
4886
|
/**
|
|
@@ -4819,6 +4971,9 @@ declare class KeyedQueue<CallbackParameters extends Parameters<GenericAsyncCallb
|
|
|
4819
4971
|
*/
|
|
4820
4972
|
resume(key?: string): void;
|
|
4821
4973
|
}
|
|
4974
|
+
/**
|
|
4975
|
+
* A queue that can be used to manage (a)synchronous tasks
|
|
4976
|
+
*/
|
|
4822
4977
|
declare class Queue<CallbackParameters extends Parameters<GenericAsyncCallback>, CallbackResult> {
|
|
4823
4978
|
#private;
|
|
4824
4979
|
/**
|
|
@@ -4882,6 +5037,9 @@ declare class Queue<CallbackParameters extends Parameters<GenericAsyncCallback>,
|
|
|
4882
5037
|
*/
|
|
4883
5038
|
resume(): void;
|
|
4884
5039
|
}
|
|
5040
|
+
/**
|
|
5041
|
+
* An error thrown by the Queue when an operation fails
|
|
5042
|
+
*/
|
|
4885
5043
|
declare class QueueError extends Error {
|
|
4886
5044
|
constructor(message: string);
|
|
4887
5045
|
}
|
|
@@ -4899,9 +5057,12 @@ type QueueOptions = {
|
|
|
4899
5057
|
*/
|
|
4900
5058
|
maximum?: number;
|
|
4901
5059
|
};
|
|
5060
|
+
/**
|
|
5061
|
+
* A queued item
|
|
5062
|
+
*/
|
|
4902
5063
|
type Queued<Value> = {
|
|
4903
5064
|
/**
|
|
4904
|
-
* ID of the queued
|
|
5065
|
+
* ID of the queued item _(can be used to remove it from the queue)_
|
|
4905
5066
|
*/
|
|
4906
5067
|
readonly id: number;
|
|
4907
5068
|
/**
|
|
@@ -4999,15 +5160,71 @@ declare function getRandomItems<Value>(array: Value[], amount: number): Value[];
|
|
|
4999
5160
|
*/
|
|
5000
5161
|
declare function getRandomItems<Value>(array: Value[]): Value[];
|
|
5001
5162
|
//#endregion
|
|
5163
|
+
//#region src/result/index.d.ts
|
|
5164
|
+
/**
|
|
5165
|
+
* Executes a promise, catching any errors, and returns a result
|
|
5166
|
+
*
|
|
5167
|
+
* Available as `asyncAttempt` and `attempt.async`
|
|
5168
|
+
* @param promise Promise to execute
|
|
5169
|
+
* @param error Error value
|
|
5170
|
+
* @returns Callback result
|
|
5171
|
+
*/
|
|
5172
|
+
declare function asyncAttempt<Value, E>(promise: Promise<Value>, error: E): Promise<ExtendedResult<Awaited<Value>, E>>;
|
|
5173
|
+
/**
|
|
5174
|
+
* Executes a callback asynchronously, catching any errors, and returns a result
|
|
5175
|
+
*
|
|
5176
|
+
* Available as `asyncAttempt` and `attempt.async`
|
|
5177
|
+
* @param callback Callback to execute
|
|
5178
|
+
* @param error Error value
|
|
5179
|
+
* @returns Callback result
|
|
5180
|
+
*/
|
|
5181
|
+
declare function asyncAttempt<Value, E>(callback: () => Promise<Value>, error: E): Promise<ExtendedResult<Awaited<Value>, E>>;
|
|
5182
|
+
/**
|
|
5183
|
+
* Executes a promise, catching any errors, and returns a result
|
|
5184
|
+
*
|
|
5185
|
+
* Available as `asyncAttempt` and `attempt.async`
|
|
5186
|
+
* @param promise Promise to execute
|
|
5187
|
+
* @returns Callback result
|
|
5188
|
+
*/
|
|
5189
|
+
declare function asyncAttempt<Value>(promise: Promise<Value>): Promise<Result<Awaited<Value>>>;
|
|
5190
|
+
/**
|
|
5191
|
+
* Executes a callback asynchronously, catching any errors, and returns a result
|
|
5192
|
+
*
|
|
5193
|
+
* Available as `asyncAttempt` and `attempt.async`
|
|
5194
|
+
* @param callback Callback to execute
|
|
5195
|
+
* @returns Callback result
|
|
5196
|
+
*/
|
|
5197
|
+
declare function asyncAttempt<Value>(callback: () => Promise<Value>): Promise<Result<Awaited<Value>>>;
|
|
5198
|
+
/**
|
|
5199
|
+
* Executes a callback, catching any errors, and returns a result
|
|
5200
|
+
* @param callback Callback to execute
|
|
5201
|
+
* @param error Error value
|
|
5202
|
+
* @returns Callback result
|
|
5203
|
+
*/
|
|
5204
|
+
declare function attempt<Value, E>(callback: () => Value, error: E): ExtendedResult<Value, E>;
|
|
5205
|
+
/**
|
|
5206
|
+
* Executes a callback, catching any errors, and returns a result
|
|
5207
|
+
* @param callback Callback to execute
|
|
5208
|
+
* @returns Callback result
|
|
5209
|
+
*/
|
|
5210
|
+
declare function attempt<Value>(callback: () => Value): Result<Value, Error>;
|
|
5211
|
+
declare namespace attempt {
|
|
5212
|
+
var async: typeof asyncAttempt;
|
|
5213
|
+
}
|
|
5214
|
+
//#endregion
|
|
5002
5215
|
//#region src/result/match.d.ts
|
|
5003
5216
|
/**
|
|
5004
5217
|
* Handles a result with match callbacks
|
|
5218
|
+
*
|
|
5219
|
+
* Available as `asyncMatchResult` and `matchResult.async`
|
|
5005
5220
|
* @param result Result to handle
|
|
5006
5221
|
* @param handler Match callbacks
|
|
5007
5222
|
*/
|
|
5008
5223
|
declare function asyncMatchResult<Value, Returned, E = Error>(result: AnyResult<Value, E> | Promise<AnyResult<Value, E>> | (() => Promise<AnyResult<Value, E>>), handler: ResultMatch<Value, Returned, E>): Promise<Returned>;
|
|
5009
5224
|
/**
|
|
5010
5225
|
* Handles a result with match callbacks
|
|
5226
|
+
*
|
|
5227
|
+
* Available as `asyncMatchResult` and `matchResult.async`
|
|
5011
5228
|
* @param result Result to handle
|
|
5012
5229
|
* @param ok Ok callback
|
|
5013
5230
|
* @param error Error callback
|
|
@@ -5015,16 +5232,12 @@ declare function asyncMatchResult<Value, Returned, E = Error>(result: AnyResult<
|
|
|
5015
5232
|
declare function asyncMatchResult<Value, Returned, E = Error>(result: AnyResult<Value, E> | Promise<AnyResult<Value, E>> | (() => Promise<AnyResult<Value, E>>), ok: ResultMatch<Value, Returned, E>['ok'], error: ResultMatch<Value, Returned, E>['error']): Promise<Returned>;
|
|
5016
5233
|
/**
|
|
5017
5234
|
* Handles a result with match callbacks
|
|
5018
|
-
*
|
|
5019
|
-
* Available as `matchResult` and `attempt.match`
|
|
5020
5235
|
* @param result Result to handle
|
|
5021
5236
|
* @param handler Match callbacks
|
|
5022
5237
|
*/
|
|
5023
5238
|
declare function matchResult<Value, Returned, E = Error>(result: AnyResult<Value, E> | (() => AnyResult<Value, E>), handler: ResultMatch<Value, Returned, E>): Returned;
|
|
5024
5239
|
/**
|
|
5025
5240
|
* Handles a result with match callbacks
|
|
5026
|
-
*
|
|
5027
|
-
* Available as `matchResult` and `attempt.match`
|
|
5028
5241
|
* @param result Result to handle
|
|
5029
5242
|
* @param ok Ok callback
|
|
5030
5243
|
* @param error Error callback
|
|
@@ -5046,168 +5259,144 @@ type AttemptFlowPromise<Callback extends GenericCallback, Value> = (...args: Par
|
|
|
5046
5259
|
/**
|
|
5047
5260
|
* Create an asynchronous Flow, a function that attempts to pipe a value through a series of functions
|
|
5048
5261
|
*
|
|
5049
|
-
* Available as `attemptAsyncFlow` and `
|
|
5262
|
+
* Available as `attemptAsyncFlow` and `attemptFlow.async`
|
|
5050
5263
|
* @returns Flow function
|
|
5051
5264
|
*/
|
|
5052
5265
|
declare function attemptAsyncFlow<Fn extends GenericCallback>(fn: Fn): AttemptFlowPromise<Fn, ReturnType<Fn>>;
|
|
5053
5266
|
/**
|
|
5054
5267
|
* Create an asynchronous Flow, a function that pipes values through a series of functions
|
|
5055
5268
|
*
|
|
5056
|
-
* Available as `attemptAsyncFlow` and `
|
|
5269
|
+
* Available as `attemptAsyncFlow` and `attemptFlow.async`
|
|
5057
5270
|
* @returns Flow function
|
|
5058
5271
|
*/
|
|
5059
5272
|
declare function attemptAsyncFlow<First extends GenericCallback, Second>(first: First, second: (value: Awaited<UnwrapValue<ReturnType<First>>>) => Second): AttemptFlowPromise<First, Second>;
|
|
5060
5273
|
/**
|
|
5061
5274
|
* Create an asynchronous Flow, a function that pipes values through a series of functions
|
|
5062
5275
|
*
|
|
5063
|
-
* Available as `attemptAsyncFlow` and `
|
|
5276
|
+
* Available as `attemptAsyncFlow` and `attemptFlow.async`
|
|
5064
5277
|
* @returns Flow function
|
|
5065
5278
|
*/
|
|
5066
5279
|
declare function attemptAsyncFlow<First extends GenericCallback, Second, Third>(first: First, second: (value: Awaited<UnwrapValue<ReturnType<First>>>) => Second, third: (value: Awaited<UnwrapValue<Second>>) => Third): AttemptFlowPromise<First, Third>;
|
|
5067
5280
|
/**
|
|
5068
5281
|
* Create an asynchronous Flow, a function that pipes values through a series of functions
|
|
5069
5282
|
*
|
|
5070
|
-
* Available as `attemptAsyncFlow` and `
|
|
5283
|
+
* Available as `attemptAsyncFlow` and `attemptFlow.async`
|
|
5071
5284
|
* @returns Flow function
|
|
5072
5285
|
*/
|
|
5073
5286
|
declare function attemptAsyncFlow<First extends GenericCallback, Second, Third, Fourth>(first: First, second: (value: Awaited<UnwrapValue<ReturnType<First>>>) => Second, third: (value: Awaited<UnwrapValue<Second>>) => Third, fourth: (value: Awaited<UnwrapValue<Third>>) => Fourth): AttemptFlowPromise<First, Fourth>;
|
|
5074
5287
|
/**
|
|
5075
5288
|
* Create an asynchronous Flow, a function that pipes values through a series of functions
|
|
5076
5289
|
*
|
|
5077
|
-
* Available as `attemptAsyncFlow` and `
|
|
5290
|
+
* Available as `attemptAsyncFlow` and `attemptFlow.async`
|
|
5078
5291
|
* @returns Flow function
|
|
5079
5292
|
*/
|
|
5080
5293
|
declare function attemptAsyncFlow<First extends GenericCallback, Second, Third, Fourth, Fifth>(first: First, second: (value: Awaited<UnwrapValue<ReturnType<First>>>) => Second, third: (value: Awaited<UnwrapValue<Second>>) => Third, fourth: (value: Awaited<UnwrapValue<Third>>) => Fourth, fifth: (value: Awaited<UnwrapValue<Fourth>>) => Fifth): AttemptFlowPromise<First, Fifth>;
|
|
5081
5294
|
/**
|
|
5082
5295
|
* Create an asynchronous Flow, a function that pipes values through a series of functions
|
|
5083
5296
|
*
|
|
5084
|
-
* Available as `attemptAsyncFlow` and `
|
|
5297
|
+
* Available as `attemptAsyncFlow` and `attemptFlow.async`
|
|
5085
5298
|
* @returns Flow function
|
|
5086
5299
|
*/
|
|
5087
5300
|
declare function attemptAsyncFlow<First extends GenericCallback, Second, Third, Fourth, Fifth, Sixth>(first: First, second: (value: Awaited<UnwrapValue<ReturnType<First>>>) => Second, third: (value: Awaited<UnwrapValue<Second>>) => Third, fourth: (value: Awaited<UnwrapValue<Third>>) => Fourth, fifth: (value: Awaited<UnwrapValue<Fourth>>) => Fifth, sixth: (value: Awaited<UnwrapValue<Fifth>>) => Sixth): AttemptFlowPromise<First, Sixth>;
|
|
5088
5301
|
/**
|
|
5089
5302
|
* Create an asynchronous Flow, a function that pipes values through a series of functions
|
|
5090
5303
|
*
|
|
5091
|
-
* Available as `attemptAsyncFlow` and `
|
|
5304
|
+
* Available as `attemptAsyncFlow` and `attemptFlow.async`
|
|
5092
5305
|
* @returns Flow function
|
|
5093
5306
|
*/
|
|
5094
5307
|
declare function attemptAsyncFlow<First extends GenericCallback, Second, Third, Fourth, Fifth, Sixth, Seventh>(first: First, second: (value: Awaited<UnwrapValue<ReturnType<First>>>) => Second, third: (value: Awaited<UnwrapValue<Second>>) => Third, fourth: (value: Awaited<UnwrapValue<Third>>) => Fourth, fifth: (value: Awaited<UnwrapValue<Fourth>>) => Fifth, sixth: (value: Awaited<UnwrapValue<Fifth>>) => Sixth, seventh: (value: Awaited<UnwrapValue<Sixth>>) => Seventh): AttemptFlowPromise<First, Seventh>;
|
|
5095
5308
|
/**
|
|
5096
5309
|
* Create an asynchronous Flow, a function that pipes values through a series of functions
|
|
5097
5310
|
*
|
|
5098
|
-
* Available as `attemptAsyncFlow` and `
|
|
5311
|
+
* Available as `attemptAsyncFlow` and `attemptFlow.async`
|
|
5099
5312
|
* @returns Flow function
|
|
5100
5313
|
*/
|
|
5101
5314
|
declare function attemptAsyncFlow<First extends GenericCallback, Second, Third, Fourth, Fifth, Sixth, Seventh, Eighth>(first: First, second: (value: Awaited<UnwrapValue<ReturnType<First>>>) => Second, third: (value: Awaited<UnwrapValue<Second>>) => Third, fourth: (value: Awaited<UnwrapValue<Third>>) => Fourth, fifth: (value: Awaited<UnwrapValue<Fourth>>) => Fifth, sixth: (value: Awaited<UnwrapValue<Fifth>>) => Sixth, seventh: (value: Awaited<UnwrapValue<Sixth>>) => Seventh, eighth: (value: Awaited<UnwrapValue<Seventh>>) => Eighth): AttemptFlowPromise<First, Eighth>;
|
|
5102
5315
|
/**
|
|
5103
5316
|
* Create an asynchronous Flow, a function that pipes values through a series of functions
|
|
5104
5317
|
*
|
|
5105
|
-
* Available as `attemptAsyncFlow` and `
|
|
5318
|
+
* Available as `attemptAsyncFlow` and `attemptFlow.async`
|
|
5106
5319
|
* @returns Flow function
|
|
5107
5320
|
*/
|
|
5108
5321
|
declare function attemptAsyncFlow<First extends GenericCallback, Second, Third, Fourth, Fifth, Sixth, Seventh, Eighth, Ninth>(first: First, second: (value: Awaited<UnwrapValue<ReturnType<First>>>) => Second, third: (value: Awaited<UnwrapValue<Second>>) => Third, fourth: (value: Awaited<UnwrapValue<Third>>) => Fourth, fifth: (value: Awaited<UnwrapValue<Fourth>>) => Fifth, sixth: (value: Awaited<UnwrapValue<Fifth>>) => Sixth, seventh: (value: Awaited<UnwrapValue<Sixth>>) => Seventh, eighth: (value: Awaited<UnwrapValue<Seventh>>) => Eighth, ninth: (value: Awaited<UnwrapValue<Eighth>>) => Ninth): AttemptFlowPromise<First, Ninth>;
|
|
5109
5322
|
/**
|
|
5110
5323
|
* Create an asynchronous Flow, a function that pipes values through a series of functions
|
|
5111
5324
|
*
|
|
5112
|
-
* Available as `attemptAsyncFlow` and `
|
|
5325
|
+
* Available as `attemptAsyncFlow` and `attemptFlow.async`
|
|
5113
5326
|
* @returns Flow function
|
|
5114
5327
|
*/
|
|
5115
5328
|
declare function attemptAsyncFlow<First extends GenericCallback, Second, Third, Fourth, Fifth, Sixth, Seventh, Eighth, Ninth, Tenth>(first: First, second: (value: Awaited<UnwrapValue<ReturnType<First>>>) => Second, third: (value: Awaited<UnwrapValue<Second>>) => Third, fourth: (value: Awaited<UnwrapValue<Third>>) => Fourth, fifth: (value: Awaited<UnwrapValue<Fourth>>) => Fifth, sixth: (value: Awaited<UnwrapValue<Fifth>>) => Sixth, seventh: (value: Awaited<UnwrapValue<Sixth>>) => Seventh, eighth: (value: Awaited<UnwrapValue<Seventh>>) => Eighth, ninth: (value: Awaited<UnwrapValue<Eighth>>) => Ninth, tenth: (value: Awaited<UnwrapValue<Ninth>>) => Tenth): AttemptFlowPromise<First, Tenth>;
|
|
5116
5329
|
/**
|
|
5117
5330
|
* Create an asynchronous Flow, a function that pipes values through a series of functions
|
|
5118
5331
|
*
|
|
5119
|
-
* Available as `attemptAsyncFlow` and `
|
|
5332
|
+
* Available as `attemptAsyncFlow` and `attemptFlow.async`
|
|
5120
5333
|
* @returns Flow function
|
|
5121
5334
|
*/
|
|
5122
5335
|
declare function attemptAsyncFlow<Fn extends GenericCallback>(fn: Fn, ...fns: Array<(value: Awaited<UnwrapValue<ReturnType<Fn>>>) => unknown>): AttemptFlowPromise<Fn, ReturnType<Fn>>;
|
|
5123
5336
|
/**
|
|
5124
5337
|
* Create an asynchronous Flow, a function that pipes values through a series of functions
|
|
5125
5338
|
*
|
|
5126
|
-
* Available as `attemptAsyncFlow` and `
|
|
5339
|
+
* Available as `attemptAsyncFlow` and `attemptFlow.async`
|
|
5127
5340
|
* @returns Flow function
|
|
5128
5341
|
*/
|
|
5129
5342
|
declare function attemptAsyncFlow(...fns: GenericCallback[]): (...args: unknown[]) => Promise<Result<unknown>>;
|
|
5130
5343
|
/**
|
|
5131
5344
|
* Create a Flow, a function that attempts to pipe values through a function
|
|
5132
|
-
*
|
|
5133
|
-
* Available as `attemptFlow` and `attempt.flow`
|
|
5134
5345
|
* @returns Flow function
|
|
5135
5346
|
*/
|
|
5136
5347
|
declare function attemptFlow<Fn extends GenericCallback>(fn: Fn): AttemptFlow<Fn, ReturnType<Fn>>;
|
|
5137
5348
|
/**
|
|
5138
5349
|
* Create a Flow, a function that attempts to pipe values through a series of functions
|
|
5139
|
-
*
|
|
5140
|
-
* Available as `attemptFlow` and `attempt.flow`
|
|
5141
5350
|
* @returns Flow function
|
|
5142
5351
|
*/
|
|
5143
5352
|
declare function attemptFlow<First extends GenericCallback, Second>(first: First, second: (value: UnwrapValue<ReturnType<First>>) => Second): AttemptFlow<First, Second>;
|
|
5144
5353
|
/**
|
|
5145
5354
|
* Create a Flow, a function that attempts to pipe values through a series of functions
|
|
5146
|
-
*
|
|
5147
|
-
* Available as `attemptFlow` and `attempt.flow`
|
|
5148
5355
|
* @returns Flow function
|
|
5149
5356
|
*/
|
|
5150
5357
|
declare function attemptFlow<First extends GenericCallback, Second, Third>(first: First, second: (value: UnwrapValue<ReturnType<First>>) => Second, third: (value: UnwrapValue<Second>) => Third): AttemptFlow<First, Third>;
|
|
5151
5358
|
/**
|
|
5152
5359
|
* Create a Flow, a function that attempts to pipe values through a series of functions
|
|
5153
|
-
*
|
|
5154
|
-
* Available as `attemptFlow` and `attempt.flow`
|
|
5155
5360
|
* @returns Flow function
|
|
5156
5361
|
*/
|
|
5157
5362
|
declare function attemptFlow<First extends GenericCallback, Second, Third, Fourth>(first: First, second: (value: UnwrapValue<ReturnType<First>>) => Second, third: (value: UnwrapValue<Second>) => Third, fourth: (value: UnwrapValue<Third>) => Fourth): AttemptFlow<First, Fourth>;
|
|
5158
5363
|
/**
|
|
5159
5364
|
* Create a Flow, a function that attempts to pipe values through a series of functions
|
|
5160
|
-
*
|
|
5161
|
-
* Available as `attemptFlow` and `attempt.flow`
|
|
5162
5365
|
* @returns Flow function
|
|
5163
5366
|
*/
|
|
5164
5367
|
declare function attemptFlow<First extends GenericCallback, Second, Third, Fourth, Fifth>(first: First, second: (value: UnwrapValue<ReturnType<First>>) => Second, third: (value: UnwrapValue<Second>) => Third, fourth: (value: UnwrapValue<Third>) => Fourth, fifth: (value: UnwrapValue<Fourth>) => Fifth): AttemptFlow<First, Fifth>;
|
|
5165
5368
|
/**
|
|
5166
5369
|
* Create a Flow, a function that attempts to pipe values through a series of functions
|
|
5167
|
-
*
|
|
5168
|
-
* Available as `attemptFlow` and `attempt.flow`
|
|
5169
5370
|
* @returns Flow function
|
|
5170
5371
|
*/
|
|
5171
5372
|
declare function attemptFlow<First extends GenericCallback, Second, Third, Fourth, Fifth, Sixth>(first: First, second: (value: UnwrapValue<ReturnType<First>>) => Second, third: (value: UnwrapValue<Second>) => Third, fourth: (value: UnwrapValue<Third>) => Fourth, fifth: (value: UnwrapValue<Fourth>) => Fifth, sixth: (value: UnwrapValue<Fifth>) => Sixth): AttemptFlow<First, Sixth>;
|
|
5172
5373
|
/**
|
|
5173
5374
|
* Create a Flow, a function that attempts to pipe values through a series of functions
|
|
5174
|
-
*
|
|
5175
|
-
* Available as `attemptFlow` and `attempt.flow`
|
|
5176
5375
|
* @returns Flow function
|
|
5177
5376
|
*/
|
|
5178
5377
|
declare function attemptFlow<First extends GenericCallback, Second, Third, Fourth, Fifth, Sixth, Seventh>(first: First, second: (value: UnwrapValue<ReturnType<First>>) => Second, third: (value: UnwrapValue<Second>) => Third, fourth: (value: UnwrapValue<Third>) => Fourth, fifth: (value: UnwrapValue<Fourth>) => Fifth, sixth: (value: UnwrapValue<Fifth>) => Sixth, seventh: (value: UnwrapValue<Sixth>) => Seventh): AttemptFlow<First, Seventh>;
|
|
5179
5378
|
/**
|
|
5180
5379
|
* Create a Flow, a function that attempts to pipe values through a series of functions
|
|
5181
|
-
*
|
|
5182
|
-
* Available as `attemptFlow` and `attempt.flow`
|
|
5183
5380
|
* @returns Flow function
|
|
5184
5381
|
*/
|
|
5185
5382
|
declare function attemptFlow<First extends GenericCallback, Second, Third, Fourth, Fifth, Sixth, Seventh, Eighth>(first: First, second: (value: UnwrapValue<ReturnType<First>>) => Second, third: (value: UnwrapValue<Second>) => Third, fourth: (value: UnwrapValue<Third>) => Fourth, fifth: (value: UnwrapValue<Fourth>) => Fifth, sixth: (value: UnwrapValue<Fifth>) => Sixth, seventh: (value: UnwrapValue<Sixth>) => Seventh, eighth: (value: UnwrapValue<Seventh>) => Eighth): AttemptFlow<First, Eighth>;
|
|
5186
5383
|
/**
|
|
5187
5384
|
* Create a Flow, a function that attempts to pipe values through a series of functions
|
|
5188
|
-
*
|
|
5189
|
-
* Available as `attemptFlow` and `attempt.flow`
|
|
5190
5385
|
* @returns Flow function
|
|
5191
5386
|
*/
|
|
5192
5387
|
declare function attemptFlow<First extends GenericCallback, Second, Third, Fourth, Fifth, Sixth, Seventh, Eighth, Ninth>(first: First, second: (value: UnwrapValue<ReturnType<First>>) => Second, third: (value: UnwrapValue<Second>) => Third, fourth: (value: UnwrapValue<Third>) => Fourth, fifth: (value: UnwrapValue<Fourth>) => Fifth, sixth: (value: UnwrapValue<Fifth>) => Sixth, seventh: (value: UnwrapValue<Sixth>) => Seventh, eighth: (value: UnwrapValue<Seventh>) => Eighth, ninth: (value: UnwrapValue<Eighth>) => Ninth): AttemptFlow<First, Ninth>;
|
|
5193
5388
|
/**
|
|
5194
5389
|
* Create a Flow, a function that attempts to pipe values through a series of functions
|
|
5195
|
-
*
|
|
5196
|
-
* Available as `attemptFlow` and `attempt.flow`
|
|
5197
5390
|
* @returns Flow function
|
|
5198
5391
|
*/
|
|
5199
5392
|
declare function attemptFlow<First extends GenericCallback, Second, Third, Fourth, Fifth, Sixth, Seventh, Eighth, Ninth, Tenth>(first: First, second: (value: UnwrapValue<ReturnType<First>>) => Second, third: (value: UnwrapValue<Second>) => Third, fourth: (value: UnwrapValue<Third>) => Fourth, fifth: (value: UnwrapValue<Fourth>) => Fifth, sixth: (value: UnwrapValue<Fifth>) => Sixth, seventh: (value: UnwrapValue<Sixth>) => Seventh, eighth: (value: UnwrapValue<Seventh>) => Eighth, ninth: (value: UnwrapValue<Eighth>) => Ninth, tenth: (value: UnwrapValue<Ninth>) => Tenth): AttemptFlow<First, Tenth>;
|
|
5200
5393
|
/**
|
|
5201
5394
|
* Create a Flow, a function that attempts to pipe values through a series of functions
|
|
5202
|
-
*
|
|
5203
|
-
* Available as `attemptFlow` and `attempt.flow`
|
|
5204
5395
|
* @returns Flow function
|
|
5205
5396
|
*/
|
|
5206
5397
|
declare function attemptFlow<First extends GenericCallback>(first: First, ...fns: Array<(value: UnwrapValue<ReturnType<First>>) => unknown>): AttemptFlow<First, ReturnType<First>>;
|
|
5207
5398
|
/**
|
|
5208
5399
|
* Create a Flow, a function that attempts to pipe values through a series of functions
|
|
5209
|
-
*
|
|
5210
|
-
* Available as `attemptFlow` and `attempt.flow`
|
|
5211
5400
|
* @returns Flow function
|
|
5212
5401
|
*/
|
|
5213
5402
|
declare function attemptFlow(...fns: GenericCallback[]): (...args: unknown[]) => Result<unknown>;
|
|
@@ -5220,7 +5409,7 @@ type WrapValue<Value> = Result<UnwrapValue<Value>>;
|
|
|
5220
5409
|
/**
|
|
5221
5410
|
* Attempt to pipe a value through a function
|
|
5222
5411
|
*
|
|
5223
|
-
* Available as `attemptAsyncPipe` and `
|
|
5412
|
+
* Available as `attemptAsyncPipe` and `attemptPipe.async`
|
|
5224
5413
|
* @param initial Initial value
|
|
5225
5414
|
* @returns Piped result
|
|
5226
5415
|
*/
|
|
@@ -5228,7 +5417,7 @@ declare function attemptAsyncPipe<Initial, Piped>(initial: GenericCallback | Ini
|
|
|
5228
5417
|
/**
|
|
5229
5418
|
* Attempt to pipe a value through a series of functions
|
|
5230
5419
|
*
|
|
5231
|
-
* Available as `attemptAsyncPipe` and `
|
|
5420
|
+
* Available as `attemptAsyncPipe` and `attemptPipe.async`
|
|
5232
5421
|
* @param initial Initial value
|
|
5233
5422
|
* @returns Piped result
|
|
5234
5423
|
*/
|
|
@@ -5236,7 +5425,7 @@ declare function attemptAsyncPipe<Initial, First, Second>(initial: GenericCallba
|
|
|
5236
5425
|
/**
|
|
5237
5426
|
* Attempt to pipe a value through a series of functions
|
|
5238
5427
|
*
|
|
5239
|
-
* Available as `attemptAsyncPipe` and `
|
|
5428
|
+
* Available as `attemptAsyncPipe` and `attemptPipe.async`
|
|
5240
5429
|
* @param initial Initial value
|
|
5241
5430
|
* @returns Piped result
|
|
5242
5431
|
*/
|
|
@@ -5244,7 +5433,7 @@ declare function attemptAsyncPipe<Initial, First, Second, Third>(initial: Generi
|
|
|
5244
5433
|
/**
|
|
5245
5434
|
* Attempt to pipe a value through a series of functions
|
|
5246
5435
|
*
|
|
5247
|
-
* Available as `attemptAsyncPipe` and `
|
|
5436
|
+
* Available as `attemptAsyncPipe` and `attemptPipe.async`
|
|
5248
5437
|
* @param initial Initial value
|
|
5249
5438
|
* @returns Piped result
|
|
5250
5439
|
*/
|
|
@@ -5252,7 +5441,7 @@ declare function attemptAsyncPipe<Initial, First, Second, Third, Fourth>(initial
|
|
|
5252
5441
|
/**
|
|
5253
5442
|
* Attempt to pipe a value through a series of functions
|
|
5254
5443
|
*
|
|
5255
|
-
* Available as `attemptAsyncPipe` and `
|
|
5444
|
+
* Available as `attemptAsyncPipe` and `attemptPipe.async`
|
|
5256
5445
|
* @param initial Initial value
|
|
5257
5446
|
* @returns Piped result
|
|
5258
5447
|
*/
|
|
@@ -5260,7 +5449,7 @@ declare function attemptAsyncPipe<Initial, First, Second, Third, Fourth, Fifth>(
|
|
|
5260
5449
|
/**
|
|
5261
5450
|
* Attempt to pipe a value through a series of functions
|
|
5262
5451
|
*
|
|
5263
|
-
* Available as `attemptAsyncPipe` and `
|
|
5452
|
+
* Available as `attemptAsyncPipe` and `attemptPipe.async`
|
|
5264
5453
|
* @param initial Initial value
|
|
5265
5454
|
* @returns Piped result
|
|
5266
5455
|
*/
|
|
@@ -5268,7 +5457,7 @@ declare function attemptAsyncPipe<Initial, First, Second, Third, Fourth, Fifth,
|
|
|
5268
5457
|
/**
|
|
5269
5458
|
* Attempt to pipe a value through a series of functions
|
|
5270
5459
|
*
|
|
5271
|
-
* Available as `attemptAsyncPipe` and `
|
|
5460
|
+
* Available as `attemptAsyncPipe` and `attemptPipe.async`
|
|
5272
5461
|
* @param initial Initial value
|
|
5273
5462
|
* @returns Piped result
|
|
5274
5463
|
*/
|
|
@@ -5276,7 +5465,7 @@ declare function attemptAsyncPipe<Initial, First, Second, Third, Fourth, Fifth,
|
|
|
5276
5465
|
/**
|
|
5277
5466
|
* Attempt to pipe a value through a series of functions
|
|
5278
5467
|
*
|
|
5279
|
-
* Available as `attemptAsyncPipe` and `
|
|
5468
|
+
* Available as `attemptAsyncPipe` and `attemptPipe.async`
|
|
5280
5469
|
* @param initial Initial value
|
|
5281
5470
|
* @returns Piped result
|
|
5282
5471
|
*/
|
|
@@ -5284,7 +5473,7 @@ declare function attemptAsyncPipe<Initial, First, Second, Third, Fourth, Fifth,
|
|
|
5284
5473
|
/**
|
|
5285
5474
|
* Attempt to pipe a value through a series of functions
|
|
5286
5475
|
*
|
|
5287
|
-
* Available as `attemptAsyncPipe` and `
|
|
5476
|
+
* Available as `attemptAsyncPipe` and `attemptPipe.async`
|
|
5288
5477
|
* @param initial Initial value
|
|
5289
5478
|
* @returns Piped result
|
|
5290
5479
|
*/
|
|
@@ -5292,7 +5481,7 @@ declare function attemptAsyncPipe<Initial, First, Second, Third, Fourth, Fifth,
|
|
|
5292
5481
|
/**
|
|
5293
5482
|
* Attempt to pipe a value through a series of functions
|
|
5294
5483
|
*
|
|
5295
|
-
* Available as `attemptAsyncPipe` and `
|
|
5484
|
+
* Available as `attemptAsyncPipe` and `attemptPipe.async`
|
|
5296
5485
|
* @param initial Initial value
|
|
5297
5486
|
* @returns Piped result
|
|
5298
5487
|
*/
|
|
@@ -5300,95 +5489,73 @@ declare function attemptAsyncPipe<Initial, First, Second, Third, Fourth, Fifth,
|
|
|
5300
5489
|
/**
|
|
5301
5490
|
* Attempt to pipe a result through a series of functions
|
|
5302
5491
|
*
|
|
5303
|
-
* Available as `attemptAsyncPipe` and `
|
|
5492
|
+
* Available as `attemptAsyncPipe` and `attemptPipe.async`
|
|
5304
5493
|
* @param initial Initial result
|
|
5305
5494
|
* @returns Piped result
|
|
5306
5495
|
*/
|
|
5307
5496
|
declare function attemptAsyncPipe<Initial>(initial: GenericCallback | Initial | Promise<Initial> | Result<Initial>, first?: (value: UnwrapValue<Initial>) => unknown, ...seconds: Array<(value: unknown) => unknown>): Promise<WrapValue<Initial>>;
|
|
5308
5497
|
/**
|
|
5309
5498
|
* Attempt to pipe a value through a function
|
|
5310
|
-
*
|
|
5311
|
-
* Available as `attemptPipe` and `attempt.pipe`
|
|
5312
5499
|
* @param initial Initial value
|
|
5313
5500
|
* @returns Piped result
|
|
5314
5501
|
*/
|
|
5315
5502
|
declare function attemptPipe<Initial, Pipe>(initial: GenericCallback | Initial | Result<Initial>, pipe: (value: UnwrapValue<Initial>) => Pipe): WrapValue<Pipe>;
|
|
5316
5503
|
/**
|
|
5317
5504
|
* Attempt to pipe a value through a series of functions
|
|
5318
|
-
*
|
|
5319
|
-
* Available as `attemptPipe` and `attempt.pipe`
|
|
5320
5505
|
* @param initial Initial value
|
|
5321
5506
|
* @returns Piped result
|
|
5322
5507
|
*/
|
|
5323
5508
|
declare function attemptPipe<Initial, First, Second>(initial: GenericCallback | Initial | Result<Initial>, first: (value: UnwrapValue<Initial>) => First, second: (value: UnwrapValue<First>) => Second): WrapValue<Second>;
|
|
5324
5509
|
/**
|
|
5325
5510
|
* Attempt to pipe a value through a series of functions
|
|
5326
|
-
*
|
|
5327
|
-
* Available as `attemptPipe` and `attempt.pipe`
|
|
5328
5511
|
* @param initial Initial value
|
|
5329
5512
|
* @returns Piped result
|
|
5330
5513
|
*/
|
|
5331
5514
|
declare function attemptPipe<Initial, First, Second, Third>(initial: GenericCallback | Initial | Result<Initial>, first: (value: UnwrapValue<Initial>) => First, second: (value: UnwrapValue<First>) => Second, third: (value: UnwrapValue<Second>) => Third): WrapValue<Third>;
|
|
5332
5515
|
/**
|
|
5333
5516
|
* Attempt to pipe a value through a series of functions
|
|
5334
|
-
*
|
|
5335
|
-
* Available as `attemptPipe` and `attempt.pipe`
|
|
5336
5517
|
* @param initial Initial value
|
|
5337
5518
|
* @returns Piped result
|
|
5338
5519
|
*/
|
|
5339
5520
|
declare function attemptPipe<Initial, First, Second, Third, Fourth>(initial: GenericCallback | Initial | Result<Initial>, first: (value: UnwrapValue<Initial>) => First, second: (value: UnwrapValue<First>) => Second, third: (value: UnwrapValue<Second>) => Third, fourth: (value: UnwrapValue<Third>) => Fourth): WrapValue<Fourth>;
|
|
5340
5521
|
/**
|
|
5341
5522
|
* Attempt to pipe a value through a series of functions
|
|
5342
|
-
*
|
|
5343
|
-
* Available as `attemptPipe` and `attempt.pipe`
|
|
5344
5523
|
* @param initial Initial value
|
|
5345
5524
|
* @returns Piped result
|
|
5346
5525
|
*/
|
|
5347
5526
|
declare function attemptPipe<Initial, First, Second, Third, Fourth, Fifth>(initial: GenericCallback | Initial | Result<Initial>, first: (value: UnwrapValue<Initial>) => First, second: (value: UnwrapValue<First>) => Second, third: (value: UnwrapValue<Second>) => Third, fourth: (value: UnwrapValue<Third>) => Fourth, fifth: (value: UnwrapValue<Fourth>) => Fifth): WrapValue<Fifth>;
|
|
5348
5527
|
/**
|
|
5349
5528
|
* Attempt to pipe a value through a series of functions
|
|
5350
|
-
*
|
|
5351
|
-
* Available as `attemptPipe` and `attempt.pipe`
|
|
5352
5529
|
* @param initial Initial value
|
|
5353
5530
|
* @returns Piped result
|
|
5354
5531
|
*/
|
|
5355
5532
|
declare function attemptPipe<Initial, First, Second, Third, Fourth, Fifth, Sixth>(initial: GenericCallback | Initial | Result<Initial>, first: (value: UnwrapValue<Initial>) => First, second: (value: UnwrapValue<First>) => Second, third: (value: UnwrapValue<Second>) => Third, fourth: (value: UnwrapValue<Third>) => Fourth, fifth: (value: UnwrapValue<Fourth>) => Fifth, sixth: (value: UnwrapValue<Fifth>) => Sixth): WrapValue<Sixth>;
|
|
5356
5533
|
/**
|
|
5357
5534
|
* Attempt to pipe a value through a series of functions
|
|
5358
|
-
*
|
|
5359
|
-
* Available as `attemptPipe` and `attempt.pipe`
|
|
5360
5535
|
* @param initial Initial value
|
|
5361
5536
|
* @returns Piped result
|
|
5362
5537
|
*/
|
|
5363
5538
|
declare function attemptPipe<Initial, First, Second, Third, Fourth, Fifth, Sixth, Seventh>(initial: GenericCallback | Initial | Result<Initial>, first: (value: UnwrapValue<Initial>) => First, second: (value: UnwrapValue<First>) => Second, third: (value: UnwrapValue<Second>) => Third, fourth: (value: UnwrapValue<Third>) => Fourth, fifth: (value: UnwrapValue<Fourth>) => Fifth, sixth: (value: UnwrapValue<Fifth>) => Sixth, seventh: (value: UnwrapValue<Sixth>) => Seventh): WrapValue<Seventh>;
|
|
5364
5539
|
/**
|
|
5365
5540
|
* Attempt to pipe a value through a series of functions
|
|
5366
|
-
*
|
|
5367
|
-
* Available as `attemptPipe` and `attempt.pipe`
|
|
5368
5541
|
* @param initial Initial value
|
|
5369
5542
|
* @returns Piped result
|
|
5370
5543
|
*/
|
|
5371
5544
|
declare function attemptPipe<Initial, First, Second, Third, Fourth, Fifth, Sixth, Seventh, Eighth>(initial: GenericCallback | Initial | Result<Initial>, first: (value: UnwrapValue<Initial>) => First, second: (value: UnwrapValue<First>) => Second, third: (value: UnwrapValue<Second>) => Third, fourth: (value: UnwrapValue<Third>) => Fourth, fifth: (value: UnwrapValue<Fourth>) => Fifth, sixth: (value: UnwrapValue<Fifth>) => Sixth, seventh: (value: UnwrapValue<Sixth>) => Seventh, eighth: (value: UnwrapValue<Seventh>) => Eighth): WrapValue<Eighth>;
|
|
5372
5545
|
/**
|
|
5373
5546
|
* Attempt to pipe a value through a series of functions
|
|
5374
|
-
*
|
|
5375
|
-
* Available as `attemptPipe` and `attempt.pipe`
|
|
5376
5547
|
* @param initial Initial value
|
|
5377
5548
|
* @returns Piped result
|
|
5378
5549
|
*/
|
|
5379
5550
|
declare function attemptPipe<Initial, First, Second, Third, Fourth, Fifth, Sixth, Seventh, Eighth, Ninth>(initial: GenericCallback | Initial | Result<Initial>, first: (value: UnwrapValue<Initial>) => First, second: (value: UnwrapValue<First>) => Second, third: (value: UnwrapValue<Second>) => Third, fourth: (value: UnwrapValue<Third>) => Fourth, fifth: (value: UnwrapValue<Fourth>) => Fifth, sixth: (value: UnwrapValue<Fifth>) => Sixth, seventh: (value: UnwrapValue<Sixth>) => Seventh, eighth: (value: UnwrapValue<Seventh>) => Eighth, ninth: (value: UnwrapValue<Eighth>) => Ninth): WrapValue<Ninth>;
|
|
5380
5551
|
/**
|
|
5381
5552
|
* Attempt to pipe a value through a series of functions
|
|
5382
|
-
*
|
|
5383
|
-
* Available as `attemptPipe` and `attempt.pipe`
|
|
5384
5553
|
* @param initial Initial value
|
|
5385
5554
|
* @returns Piped result
|
|
5386
5555
|
*/
|
|
5387
5556
|
declare function attemptPipe<Initial, First, Second, Third, Fourth, Fifth, Sixth, Seventh, Eighth, Ninth, Tenth>(initial: GenericCallback | Initial | Result<Initial>, first: (value: UnwrapValue<Initial>) => First, second: (value: UnwrapValue<First>) => Second, third: (value: UnwrapValue<Second>) => Third, fourth: (value: UnwrapValue<Third>) => Fourth, fifth: (value: UnwrapValue<Fourth>) => Fifth, sixth: (value: UnwrapValue<Fifth>) => Sixth, seventh: (value: UnwrapValue<Sixth>) => Seventh, eighth: (value: UnwrapValue<Seventh>) => Eighth, ninth: (value: UnwrapValue<Eighth>) => Ninth, tenth: (value: UnwrapValue<Ninth>) => Tenth): WrapValue<Tenth>;
|
|
5388
5557
|
/**
|
|
5389
5558
|
* Attempt to pipe a result through a series of functions
|
|
5390
|
-
*
|
|
5391
|
-
* Available as `attemptPipe` and `attempt.pipe`
|
|
5392
5559
|
* @param initial Initial result
|
|
5393
5560
|
* @returns Piped result
|
|
5394
5561
|
*/
|
|
@@ -5397,62 +5564,6 @@ declare namespace attemptPipe {
|
|
|
5397
5564
|
var async: typeof attemptAsyncPipe;
|
|
5398
5565
|
}
|
|
5399
5566
|
//#endregion
|
|
5400
|
-
//#region src/result/index.d.ts
|
|
5401
|
-
/**
|
|
5402
|
-
* Executes a promise, catching any errors, and returns a result
|
|
5403
|
-
*
|
|
5404
|
-
* Available as `asyncAttempt` and `attempt.async`
|
|
5405
|
-
* @param promise Promise to execute
|
|
5406
|
-
* @param error Error value
|
|
5407
|
-
* @returns Callback result
|
|
5408
|
-
*/
|
|
5409
|
-
declare function asyncAttempt<Value, E>(promise: Promise<Value>, error: E): Promise<ExtendedResult<Awaited<Value>, E>>;
|
|
5410
|
-
/**
|
|
5411
|
-
* Executes a callback asynchronously, catching any errors, and returns a result
|
|
5412
|
-
*
|
|
5413
|
-
* Available as `asyncAttempt` and `attempt.async`
|
|
5414
|
-
* @param callback Callback to execute
|
|
5415
|
-
* @param error Error value
|
|
5416
|
-
* @returns Callback result
|
|
5417
|
-
*/
|
|
5418
|
-
declare function asyncAttempt<Value, E>(callback: () => Promise<Value>, error: E): Promise<ExtendedResult<Awaited<Value>, E>>;
|
|
5419
|
-
/**
|
|
5420
|
-
* Executes a promise, catching any errors, and returns a result
|
|
5421
|
-
*
|
|
5422
|
-
* Available as `asyncAttempt` and `attempt.async`
|
|
5423
|
-
* @param promise Promise to execute
|
|
5424
|
-
* @returns Callback result
|
|
5425
|
-
*/
|
|
5426
|
-
declare function asyncAttempt<Value>(promise: Promise<Value>): Promise<Result<Awaited<Value>>>;
|
|
5427
|
-
/**
|
|
5428
|
-
* Executes a callback asynchronously, catching any errors, and returns a result
|
|
5429
|
-
*
|
|
5430
|
-
* Available as `asyncAttempt` and `attempt.async`
|
|
5431
|
-
* @param callback Callback to execute
|
|
5432
|
-
* @returns Callback result
|
|
5433
|
-
*/
|
|
5434
|
-
declare function asyncAttempt<Value>(callback: () => Promise<Value>): Promise<Result<Awaited<Value>>>;
|
|
5435
|
-
/**
|
|
5436
|
-
* Executes a callback, catching any errors, and returns a result
|
|
5437
|
-
* @param callback Callback to execute
|
|
5438
|
-
* @param error Error value
|
|
5439
|
-
* @returns Callback result
|
|
5440
|
-
*/
|
|
5441
|
-
declare function attempt<Value, E>(callback: () => Value, error: E): ExtendedResult<Value, E>;
|
|
5442
|
-
/**
|
|
5443
|
-
* Executes a callback, catching any errors, and returns a result
|
|
5444
|
-
* @param callback Callback to execute
|
|
5445
|
-
* @returns Callback result
|
|
5446
|
-
*/
|
|
5447
|
-
declare function attempt<Value>(callback: () => Value): Result<Value, Error>;
|
|
5448
|
-
declare namespace attempt {
|
|
5449
|
-
var async: typeof asyncAttempt;
|
|
5450
|
-
var flow: typeof attemptFlow;
|
|
5451
|
-
var match: typeof matchResult;
|
|
5452
|
-
var pipe: typeof attemptPipe;
|
|
5453
|
-
var promise: typeof attemptPromise;
|
|
5454
|
-
}
|
|
5455
|
-
//#endregion
|
|
5456
5567
|
//#region src/sized/map.d.ts
|
|
5457
5568
|
/**
|
|
5458
5569
|
* A Map with a maximum size
|
|
@@ -5500,8 +5611,9 @@ declare class SizedMap<SizedKey = unknown, SizedValue = unknown> extends Map<Siz
|
|
|
5500
5611
|
//#endregion
|
|
5501
5612
|
//#region src/sized/set.d.ts
|
|
5502
5613
|
/**
|
|
5503
|
-
*
|
|
5504
|
-
*
|
|
5614
|
+
* A Set with a maximum size
|
|
5615
|
+
*
|
|
5616
|
+
* Behavior is similar to a _LRU_-cache, where the oldest values are removed
|
|
5505
5617
|
*/
|
|
5506
5618
|
declare class SizedSet<Value = unknown> extends Set<Value> {
|
|
5507
5619
|
#private;
|
|
@@ -5542,4 +5654,4 @@ declare class SizedSet<Value = unknown> extends Set<Value> {
|
|
|
5542
5654
|
get(value: Value, update?: boolean): Value | undefined;
|
|
5543
5655
|
}
|
|
5544
5656
|
//#endregion
|
|
5545
|
-
export { AnyResult, ArrayComparisonSorter, ArrayKeySorter, ArrayOrPlainObject,
|
|
5657
|
+
export { AnyResult, ArrayComparison, ArrayComparisonSorter, ArrayKeySorter, ArrayOrPlainObject, ArrayValueSorter, AssertProperty, Asserter, AssignOptions, Assigner, AsyncCancelableCallback, AttemptFlow, AttemptFlowPromise, type Beacon, type BeaconOptions, BuiltIns, CancelableCallback, CancelablePromise, type Color, Constructor, DiffOptions, DiffResult, DiffValue, EqualOptions, Err, EventPosition, type Events, ExtendedErr, ExtendedResult, Flow, FlowPromise, Frozen, FulfilledPromise, FuzzyConfiguration, FuzzyOptions, FuzzyResult, FuzzySearchOptions, GenericAsyncCallback, GenericCallback, type HSLAColor, type HSLColor, type Kalas, Key$1 as Key, type KeyedQueue, KeyedValue, type Logger, type Memoized, type MemoizedOptions, MergeOptions, Merger, NestedArray, NestedKeys, NestedPartial, NestedValue, NestedValues, NormalizeOptions, Normalizer, NumericalKeys, NumericalValues, type Observable, type Observer, Ok, OnceAsyncCallback, OnceCallback, PROMISE_ABORT_EVENT, PROMISE_ABORT_OPTIONS, PROMISE_ERROR_NAME, PROMISE_MESSAGE_EXPECTATION_ATTEMPT, PROMISE_MESSAGE_EXPECTATION_RESULT, PROMISE_MESSAGE_EXPECTATION_TIMED, PROMISE_MESSAGE_TIMEOUT, PROMISE_STRATEGY_ALL, PROMISE_STRATEGY_DEFAULT, PROMISE_TYPE_FULFILLED, PROMISE_TYPE_REJECTED, PlainObject, Primitive, PromiseData, PromiseHandlers, PromiseOptions, PromiseParameters, PromiseStrategy, PromiseTimeoutError, PromisesItems, PromisesOptions, PromisesResult, PromisesUnwrapped, PromisesValue, PromisesValues, type Queue, type QueueError, type QueueOptions, type Queued, type QueuedResult, type RGBAColor, type RGBColor, RejectedPromise, RequiredKeys, Result, ResultMatch, RetryError, RetryOptions, SORT_DIRECTION_ASCENDING, SORT_DIRECTION_DESCENDING, Shaken, Simplify, SizedMap, SizedSet, Smushed, SortDirection, Sorter, type Subscription, TemplateOptions, type Time, ToString, Transformer, TypedArray, Unsmushed, Unsubscriber, UnwrapValue, assert, assertCondition, assertDefined, assertInstanceOf, assertIs, assertProperty, assign, asyncAttempt, asyncDebounce, asyncFlow, asyncMatchResult, asyncOnce, asyncPipe, asyncThrottle, attempt, attemptAsyncFlow, attemptAsyncPipe, attemptFlow, attemptPipe, attemptPromise, average, beacon, between, camelCase, cancelable, capitalize, ceil, chunk, clamp, clone, compact, compare, count, debounce, deburr, dedent, delay, deregisterCloner, deregisterComparator, deregisterEqualizer, diff, difference, drop, endsWith, endsWithArray, equal, error, exclude, exists, filter, find, findLast, first, firstOrDefault, flatten, floor, flow, freeze, fromQuery, toPromise as fromResult, toPromise, fuzzy, fuzzyMatch, getArray, getArrayComparison, getColor, getError, getForegroundColor, getHexColor, getHexaColor, getHslColor, getHslaColor, getNormalizedHex, getNumber, getRandomBoolean, getRandomCharacters, getRandomColor, getRandomFloat, getRandomHex, getRandomInteger, getRandomItem, getRandomItems, getRgbColor, getRgbaColor, getSortedIndex, getString, getTimedPromise, getUuid, getValue, groupArraysBy, groupBy, handleResult, hasValue, hasValueResult, hexToHsl, hexToHsla, hexToRgb, hexToRgba, hslToHex, hslToRgb, hslToRgba, ignoreKey, inMap, inSet, includes, includesArray, indexOf, indexOfArray, initializeAssigner, initializeEqualizer, initializeMerger, initializeNormalizer, initializeSorter, initializeTemplater, initializeTransformer, insert, intersection, isArrayOrPlainObject, isColor, isConstructor, isEmpty, isError, isFulfilled, isHexColor, isHslColor, isHslLike, isHslaColor, isInstanceOf, isKey, isNonArrayOrPlainObject, isNonConstructor, isNonEmpty, isNonInstanceOf, isNonKey, isNonNullable, isNonNullableOrEmpty, isNonNullableOrWhitespace, isNonNumber, isNonNumerical, isNonObject, isNonPlainObject, isNonPrimitive, isNonTypedArray, isNullable, isNullableOrEmpty, isNullableOrWhitespace, isNumber, isNumerical, isObject, isOk, isPlainObject, isPrimitive, isRejected, isResult, isRgbColor, isRgbLike, isRgbaColor, isSorted, isTypedArray, join, kalas, kebabCase, keyedQueue, last, lastIndexOf, lastOrDefault, logger, lowerCase, matchResult, max, median, memoize, merge, min, move, moveIndices, moveToIndex, noop, normalize, ok, omit, once, parse, partition, pascalCase, pick, pipe, promises, push, queue, range, registerCloner, registerComparator, registerEqualizer, resultPromises, retry, reverse, rgbToHex, rgbToHsl, rgbToHsla, round, select, setValue, settlePromise, shake, shuffle, single, slice, smush, snakeCase, sort, splice, startsWith, startsWithArray, sum, swap, take, template, throttle, timed, times, titleCase, toMap, toMapArrays, toQuery, toRecord, toRecordArrays, toResult, toSet, toggle, transform, trim, truncate, tryDecode, tryEncode, union, unique, unsmush, unwrap, update, upperCase, words };
|