@pawover/kit 0.0.0-beta.45 → 0.0.0-beta.50
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/package.json +52 -82
- package/{dist/hooks-alova.d.ts → packages/hooks/dist/alova.d.ts} +4 -5
- package/{dist/hooks-alova.js → packages/hooks/dist/alova.js} +3 -5
- package/packages/hooks/dist/index.d.ts +1 -0
- package/packages/hooks/dist/index.js +0 -0
- package/packages/hooks/dist/metadata.json +16 -0
- package/{dist/hooks-react.d.ts → packages/hooks/dist/react.d.ts} +76 -72
- package/packages/hooks/dist/react.js +4419 -0
- package/packages/utils/dist/index.d.ts +4293 -0
- package/packages/utils/dist/index.js +1527 -0
- package/packages/utils/dist/math.d.ts +54 -0
- package/packages/utils/dist/math.js +56 -0
- package/packages/utils/dist/metadata.json +14 -0
- package/packages/utils/dist/string-CESQdidv.js +793 -0
- package/packages/utils/dist/vite.d.ts +16 -0
- package/packages/utils/dist/vite.js +26 -0
- package/packages/zod/dist/index.d.ts +58 -0
- package/packages/zod/dist/index.js +61 -0
- package/dist/enums.d.ts +0 -2
- package/dist/enums.js +0 -145
- package/dist/enums.js.map +0 -1
- package/dist/except-6l9Qdmn1.d.ts +0 -986
- package/dist/except-6l9Qdmn1.d.ts.map +0 -1
- package/dist/hooks-alova.d.ts.map +0 -1
- package/dist/hooks-alova.js.map +0 -1
- package/dist/hooks-react.d.ts.map +0 -1
- package/dist/hooks-react.js +0 -166
- package/dist/hooks-react.js.map +0 -1
- package/dist/index-DsR_kNCf.d.ts +0 -18
- package/dist/index-DsR_kNCf.d.ts.map +0 -1
- package/dist/index-JKtXbRi8.d.ts +0 -149
- package/dist/index-JKtXbRi8.d.ts.map +0 -1
- package/dist/index.d.ts +0 -3736
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -2
- package/dist/patches-fetchEventSource.d.ts +0 -87
- package/dist/patches-fetchEventSource.d.ts.map +0 -1
- package/dist/patches-fetchEventSource.js +0 -200
- package/dist/patches-fetchEventSource.js.map +0 -1
- package/dist/utils-B7AhGrZp.js +0 -2042
- package/dist/utils-B7AhGrZp.js.map +0 -1
- package/dist/value-of-Dz22arsm.d.ts +0 -26
- package/dist/value-of-Dz22arsm.d.ts.map +0 -1
- package/dist/vite.d.ts +0 -12
- package/dist/vite.d.ts.map +0 -1
- package/dist/vite.js +0 -23
- package/dist/vite.js.map +0 -1
- package/dist/zod.d.ts +0 -112
- package/dist/zod.d.ts.map +0 -1
- package/dist/zod.js +0 -112
- package/dist/zod.js.map +0 -1
- package/metadata.json +0 -184
package/dist/index.d.ts
DELETED
|
@@ -1,3736 +0,0 @@
|
|
|
1
|
-
import { a as IsEqual, c as IsExactOptionalPropertyTypesEnabled, d as If, f as IsNever, h as UnionToIntersection, i as HomomorphicPick, l as Not, m as IsAny, n as ApplyDefaultOptions, o as Simplify, p as OptionalKeysOf, r as CollapseLiterals, s as IfNotAnyOrNever, t as Except, u as UnknownArray } from "./except-6l9Qdmn1.js";
|
|
2
|
-
import { t as ValueOf } from "./value-of-Dz22arsm.js";
|
|
3
|
-
import { a as AnyObject, i as AnyGeneratorFunction, n as AnyAsyncGeneratorFunction, o as PlainObject, r as AnyFunction, s as TreeLike, t as AnyAsyncFunction } from "./index-DsR_kNCf.js";
|
|
4
|
-
import { BigNumber, MathExpression, MathJsInstance, Matrix } from "mathjs";
|
|
5
|
-
|
|
6
|
-
//#region node_modules/.pnpm/type-fest@5.5.0/node_modules/type-fest/source/basic.d.ts
|
|
7
|
-
/**
|
|
8
|
-
Matches a [`class`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes).
|
|
9
|
-
|
|
10
|
-
@category Class
|
|
11
|
-
*/
|
|
12
|
-
type Class<T, Arguments extends unknown[] = any[]> = {
|
|
13
|
-
prototype: Pick<T, keyof T>;
|
|
14
|
-
new (...arguments_: Arguments): T;
|
|
15
|
-
};
|
|
16
|
-
//#endregion
|
|
17
|
-
//#region node_modules/.pnpm/type-fest@5.5.0/node_modules/type-fest/source/internal/array.d.ts
|
|
18
|
-
/**
|
|
19
|
-
Transforms a tuple type by replacing it's rest element with a single element that has the same type as the rest element, while keeping all the non-rest elements intact.
|
|
20
|
-
|
|
21
|
-
@example
|
|
22
|
-
```
|
|
23
|
-
type A = CollapseRestElement<[string, string, ...number[]]>;
|
|
24
|
-
//=> [string, string, number]
|
|
25
|
-
|
|
26
|
-
type B = CollapseRestElement<[...string[], number, number]>;
|
|
27
|
-
//=> [string, number, number]
|
|
28
|
-
|
|
29
|
-
type C = CollapseRestElement<[string, string, ...Array<number | bigint>]>;
|
|
30
|
-
//=> [string, string, number | bigint]
|
|
31
|
-
|
|
32
|
-
type D = CollapseRestElement<[string, number]>;
|
|
33
|
-
//=> [string, number]
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
Note: Optional modifiers (`?`) are removed from elements unless the `exactOptionalPropertyTypes` compiler option is disabled. When disabled, there's an additional `| undefined` for optional elements.
|
|
37
|
-
|
|
38
|
-
@example
|
|
39
|
-
```
|
|
40
|
-
// `exactOptionalPropertyTypes` enabled
|
|
41
|
-
type A = CollapseRestElement<[string?, string?, ...number[]]>;
|
|
42
|
-
//=> [string, string, number]
|
|
43
|
-
|
|
44
|
-
// `exactOptionalPropertyTypes` disabled
|
|
45
|
-
type B = CollapseRestElement<[string?, string?, ...number[]]>;
|
|
46
|
-
//=> [string | undefined, string | undefined, number]
|
|
47
|
-
```
|
|
48
|
-
*/
|
|
49
|
-
type CollapseRestElement<TArray extends UnknownArray> = IfNotAnyOrNever<TArray, _CollapseRestElement<TArray>>;
|
|
50
|
-
type _CollapseRestElement<TArray extends UnknownArray, ForwardAccumulator extends UnknownArray = [], BackwardAccumulator extends UnknownArray = []> = TArray extends UnknownArray // For distributing `TArray`
|
|
51
|
-
? keyof TArray & `${number}` extends never // Enters this branch, if `TArray` is empty (e.g., []),
|
|
52
|
-
// or `TArray` contains no non-rest elements preceding the rest element (e.g., `[...string[]]` or `[...string[], string]`).
|
|
53
|
-
? TArray extends readonly [...infer Rest, infer Last] ? _CollapseRestElement<Rest, ForwardAccumulator, [Last, ...BackwardAccumulator]> // Accumulate elements that are present after the rest element.
|
|
54
|
-
: TArray extends readonly [] ? [...ForwardAccumulator, ...BackwardAccumulator] : [...ForwardAccumulator, TArray[number], ...BackwardAccumulator] // Add the rest element between the accumulated elements.
|
|
55
|
-
: TArray extends readonly [(infer First)?, ...infer Rest] ? _CollapseRestElement<Rest, [...ForwardAccumulator, '0' extends OptionalKeysOf<TArray> ? If<IsExactOptionalPropertyTypesEnabled, First, First | undefined> // Add `| undefined` for optional elements, if `exactOptionalPropertyTypes` is disabled.
|
|
56
|
-
: First], BackwardAccumulator> : never // Should never happen, since `[(infer First)?, ...infer Rest]` is a top-type for arrays.
|
|
57
|
-
: never; // Should never happen
|
|
58
|
-
//#endregion
|
|
59
|
-
//#region node_modules/.pnpm/type-fest@5.5.0/node_modules/type-fest/source/numeric.d.ts
|
|
60
|
-
type _Numeric = number | bigint;
|
|
61
|
-
type Zero = 0 | 0n;
|
|
62
|
-
/**
|
|
63
|
-
Matches the hidden `Infinity` type.
|
|
64
|
-
|
|
65
|
-
Please upvote [this issue](https://github.com/microsoft/TypeScript/issues/32277) if you want to have this type as a built-in in TypeScript.
|
|
66
|
-
|
|
67
|
-
@see {@link NegativeInfinity}
|
|
68
|
-
|
|
69
|
-
@category Numeric
|
|
70
|
-
*/
|
|
71
|
-
// See https://github.com/microsoft/TypeScript/issues/31752
|
|
72
|
-
// eslint-disable-next-line no-loss-of-precision
|
|
73
|
-
/**
|
|
74
|
-
A negative `number`/`bigint` (`-∞ < x < 0`)
|
|
75
|
-
|
|
76
|
-
Use-case: Validating and documenting parameters.
|
|
77
|
-
|
|
78
|
-
@see {@link NegativeInteger}
|
|
79
|
-
@see {@link NonNegative}
|
|
80
|
-
|
|
81
|
-
@category Numeric
|
|
82
|
-
*/
|
|
83
|
-
type Negative<T extends _Numeric> = T extends Zero ? never : `${T}` extends `-${string}` ? T : never;
|
|
84
|
-
/**
|
|
85
|
-
Returns a boolean for whether the given number is a negative number.
|
|
86
|
-
|
|
87
|
-
@see {@link Negative}
|
|
88
|
-
|
|
89
|
-
@example
|
|
90
|
-
```
|
|
91
|
-
import type {IsNegative} from 'type-fest';
|
|
92
|
-
|
|
93
|
-
type ShouldBeFalse = IsNegative<1>;
|
|
94
|
-
type ShouldBeTrue = IsNegative<-1>;
|
|
95
|
-
```
|
|
96
|
-
|
|
97
|
-
@category Numeric
|
|
98
|
-
*/
|
|
99
|
-
type IsNegative<T extends _Numeric> = T extends Negative<T> ? true : false;
|
|
100
|
-
//#endregion
|
|
101
|
-
//#region node_modules/.pnpm/tagged-tag@1.0.0/node_modules/tagged-tag/index.d.ts
|
|
102
|
-
declare const tag: unique symbol;
|
|
103
|
-
//#endregion
|
|
104
|
-
//#region node_modules/.pnpm/type-fest@5.5.0/node_modules/type-fest/source/tagged.d.ts
|
|
105
|
-
// eslint-disable-next-line type-fest/require-exported-types
|
|
106
|
-
type TagContainer<Token> = {
|
|
107
|
-
readonly [tag]: Token;
|
|
108
|
-
};
|
|
109
|
-
type Tag<Token extends PropertyKey, TagMetadata> = TagContainer<{ [K in Token]: TagMetadata }>;
|
|
110
|
-
/**
|
|
111
|
-
Attach a "tag" to an arbitrary type. This allows you to create distinct types, that aren't assignable to one another, for distinct concepts in your program that should not be interchangeable, even if their runtime values have the same type. (See examples.)
|
|
112
|
-
|
|
113
|
-
A type returned by `Tagged` can be passed to `Tagged` again, to create a type with multiple tags.
|
|
114
|
-
|
|
115
|
-
[Read more about tagged types.](https://medium.com/@KevinBGreene/surviving-the-typescript-ecosystem-branding-and-type-tagging-6cf6e516523d)
|
|
116
|
-
|
|
117
|
-
A tag's name is usually a string (and must be a string, number, or symbol), but each application of a tag can also contain an arbitrary type as its "metadata". See {@link GetTagMetadata} for examples and explanation.
|
|
118
|
-
|
|
119
|
-
A type `A` returned by `Tagged` is assignable to another type `B` returned by `Tagged` if and only if:
|
|
120
|
-
- the underlying (untagged) type of `A` is assignable to the underlying type of `B`;
|
|
121
|
-
- `A` contains at least all the tags `B` has;
|
|
122
|
-
- and the metadata type for each of `A`'s tags is assignable to the metadata type of `B`'s corresponding tag.
|
|
123
|
-
|
|
124
|
-
There have been several discussions about adding similar features to TypeScript. Unfortunately, nothing has (yet) moved forward:
|
|
125
|
-
- [Microsoft/TypeScript#202](https://github.com/microsoft/TypeScript/issues/202)
|
|
126
|
-
- [Microsoft/TypeScript#4895](https://github.com/microsoft/TypeScript/issues/4895)
|
|
127
|
-
- [Microsoft/TypeScript#33290](https://github.com/microsoft/TypeScript/pull/33290)
|
|
128
|
-
|
|
129
|
-
@example
|
|
130
|
-
```
|
|
131
|
-
import type {Tagged} from 'type-fest';
|
|
132
|
-
|
|
133
|
-
type AccountNumber = Tagged<number, 'AccountNumber'>;
|
|
134
|
-
type AccountBalance = Tagged<number, 'AccountBalance'>;
|
|
135
|
-
|
|
136
|
-
function createAccountNumber(): AccountNumber {
|
|
137
|
-
// As you can see, casting from a `number` (the underlying type being tagged) is allowed.
|
|
138
|
-
return 2 as AccountNumber;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
declare function getMoneyForAccount(accountNumber: AccountNumber): AccountBalance;
|
|
142
|
-
|
|
143
|
-
// This will compile successfully.
|
|
144
|
-
getMoneyForAccount(createAccountNumber());
|
|
145
|
-
|
|
146
|
-
// But this won't, because it has to be explicitly passed as an `AccountNumber` type!
|
|
147
|
-
// Critically, you could not accidentally use an `AccountBalance` as an `AccountNumber`.
|
|
148
|
-
// @ts-expect-error
|
|
149
|
-
getMoneyForAccount(2);
|
|
150
|
-
|
|
151
|
-
// You can also use tagged values like their underlying, untagged type.
|
|
152
|
-
// I.e., this will compile successfully because an `AccountNumber` can be used as a regular `number`.
|
|
153
|
-
// In this sense, the underlying base type is not hidden, which differentiates tagged types from opaque types in other languages.
|
|
154
|
-
const accountNumber = createAccountNumber() + 2;
|
|
155
|
-
```
|
|
156
|
-
|
|
157
|
-
@example
|
|
158
|
-
```
|
|
159
|
-
import type {Tagged} from 'type-fest';
|
|
160
|
-
|
|
161
|
-
// You can apply multiple tags to a type by using `Tagged` repeatedly.
|
|
162
|
-
type Url = Tagged<string, 'URL'>;
|
|
163
|
-
type SpecialCacheKey = Tagged<Url, 'SpecialCacheKey'>;
|
|
164
|
-
|
|
165
|
-
// You can also pass a union of tag names, so this is equivalent to the above, although it doesn't give you the ability to assign distinct metadata to each tag.
|
|
166
|
-
type SpecialCacheKey2 = Tagged<string, 'URL' | 'SpecialCacheKey'>;
|
|
167
|
-
```
|
|
168
|
-
|
|
169
|
-
@category Type
|
|
170
|
-
*/
|
|
171
|
-
type Tagged<Type, TagName extends PropertyKey, TagMetadata = never> = Type & Tag<TagName, TagMetadata>;
|
|
172
|
-
/**
|
|
173
|
-
Revert a tagged type back to its original type by removing all tags.
|
|
174
|
-
|
|
175
|
-
Why is this necessary?
|
|
176
|
-
|
|
177
|
-
1. Use a `Tagged` type as object keys
|
|
178
|
-
2. Prevent TS4058 error: "Return type of exported function has or is using name X from external module Y but cannot be named"
|
|
179
|
-
|
|
180
|
-
@example
|
|
181
|
-
```
|
|
182
|
-
import type {Tagged, UnwrapTagged} from 'type-fest';
|
|
183
|
-
|
|
184
|
-
type AccountType = Tagged<'SAVINGS' | 'CHECKING', 'AccountType'>;
|
|
185
|
-
|
|
186
|
-
const moneyByAccountType: Record<UnwrapTagged<AccountType>, number> = {
|
|
187
|
-
SAVINGS: 99,
|
|
188
|
-
CHECKING: 0.1,
|
|
189
|
-
};
|
|
190
|
-
|
|
191
|
-
// Without UnwrapTagged, the following expression would throw a type error.
|
|
192
|
-
const money = moneyByAccountType.SAVINGS; // TS error: Property 'SAVINGS' does not exist
|
|
193
|
-
|
|
194
|
-
// Attempting to pass a non-Tagged type to UnwrapTagged will raise a type error.
|
|
195
|
-
// @ts-expect-error
|
|
196
|
-
type WontWork = UnwrapTagged<string>;
|
|
197
|
-
```
|
|
198
|
-
|
|
199
|
-
@category Type
|
|
200
|
-
*/
|
|
201
|
-
type UnwrapTagged<TaggedType extends Tag<PropertyKey, any>> = RemoveAllTags<TaggedType>;
|
|
202
|
-
type RemoveAllTags<T> = T extends Tag<PropertyKey, any> ? { [ThisTag in keyof T[typeof tag]]: T extends Tagged<infer Type, ThisTag, T[typeof tag][ThisTag]> ? RemoveAllTags<Type> : never }[keyof T[typeof tag]] : T;
|
|
203
|
-
/**
|
|
204
|
-
Note: The `Opaque` type is deprecated in favor of `Tagged`.
|
|
205
|
-
|
|
206
|
-
Attach a "tag" to an arbitrary type. This allows you to create distinct types, that aren't assignable to one another, for runtime values that would otherwise have the same type. (See examples.)
|
|
207
|
-
|
|
208
|
-
The generic type parameters can be anything.
|
|
209
|
-
|
|
210
|
-
Note that `Opaque` is somewhat of a misnomer here, in that, unlike [some alternative implementations](https://github.com/microsoft/TypeScript/issues/4895#issuecomment-425132582), the original, untagged type is not actually hidden. (E.g., functions that accept the untagged type can still be called with the "opaque" version -- but not vice-versa.)
|
|
211
|
-
|
|
212
|
-
Also note that this implementation is limited to a single tag. If you want to allow multiple tags, use `Tagged` instead.
|
|
213
|
-
|
|
214
|
-
[Read more about tagged types.](https://medium.com/@KevinBGreene/surviving-the-typescript-ecosystem-branding-and-type-tagging-6cf6e516523d)
|
|
215
|
-
|
|
216
|
-
There have been several discussions about adding similar features to TypeScript. Unfortunately, nothing has (yet) moved forward:
|
|
217
|
-
- [Microsoft/TypeScript#202](https://github.com/microsoft/TypeScript/issues/202)
|
|
218
|
-
- [Microsoft/TypeScript#15408](https://github.com/Microsoft/TypeScript/issues/15408)
|
|
219
|
-
- [Microsoft/TypeScript#15807](https://github.com/Microsoft/TypeScript/issues/15807)
|
|
220
|
-
|
|
221
|
-
@example
|
|
222
|
-
```
|
|
223
|
-
import type {Opaque} from 'type-fest';
|
|
224
|
-
|
|
225
|
-
type AccountNumber = Opaque<number, 'AccountNumber'>;
|
|
226
|
-
type AccountBalance = Opaque<number, 'AccountBalance'>;
|
|
227
|
-
|
|
228
|
-
// The `Token` parameter allows the compiler to differentiate between types, whereas "unknown" will not. For example, consider the following structures:
|
|
229
|
-
type ThingOne = Opaque<string>;
|
|
230
|
-
type ThingTwo = Opaque<string>;
|
|
231
|
-
|
|
232
|
-
// To the compiler, these types are allowed to be cast to each other as they have the same underlying type. They are both `string & { __opaque__: unknown }`.
|
|
233
|
-
// To avoid this behaviour, you would instead pass the "Token" parameter, like so.
|
|
234
|
-
type NewThingOne = Opaque<string, 'ThingOne'>;
|
|
235
|
-
type NewThingTwo = Opaque<string, 'ThingTwo'>;
|
|
236
|
-
|
|
237
|
-
// Now they're completely separate types, so the following will fail to compile.
|
|
238
|
-
function createNewThingOne(): NewThingOne {
|
|
239
|
-
// As you can see, casting from a string is still allowed. However, you may not cast NewThingOne to NewThingTwo, and vice versa.
|
|
240
|
-
return 'new thing one' as NewThingOne;
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
// This will fail to compile, as they are fundamentally different types.
|
|
244
|
-
// @ts-expect-error
|
|
245
|
-
const thingTwo = createNewThingOne() as NewThingTwo;
|
|
246
|
-
|
|
247
|
-
// Here's another example of opaque typing.
|
|
248
|
-
function createAccountNumber(): AccountNumber {
|
|
249
|
-
return 2 as AccountNumber;
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
declare function getMoneyForAccount(accountNumber: AccountNumber): AccountBalance;
|
|
253
|
-
|
|
254
|
-
// This will compile successfully.
|
|
255
|
-
getMoneyForAccount(createAccountNumber());
|
|
256
|
-
|
|
257
|
-
// But this won't, because it has to be explicitly passed as an `AccountNumber` type.
|
|
258
|
-
// @ts-expect-error
|
|
259
|
-
getMoneyForAccount(2);
|
|
260
|
-
|
|
261
|
-
// You can use opaque values like they aren't opaque too.
|
|
262
|
-
const accountNumber = createAccountNumber();
|
|
263
|
-
|
|
264
|
-
// This will compile successfully.
|
|
265
|
-
const newAccountNumber = accountNumber + 2;
|
|
266
|
-
|
|
267
|
-
// As a side note, you can (and should) use recursive types for your opaque types to make them stronger and hopefully easier to type.
|
|
268
|
-
type Person = {
|
|
269
|
-
id: Opaque<number, Person>;
|
|
270
|
-
name: string;
|
|
271
|
-
};
|
|
272
|
-
```
|
|
273
|
-
|
|
274
|
-
@category Type
|
|
275
|
-
@deprecated Use {@link Tagged} instead
|
|
276
|
-
*/
|
|
277
|
-
//#endregion
|
|
278
|
-
//#region node_modules/.pnpm/type-fest@5.5.0/node_modules/type-fest/source/is-literal.d.ts
|
|
279
|
-
/**
|
|
280
|
-
Returns a boolean for whether the given type is a `string` [literal type](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#literal-types).
|
|
281
|
-
|
|
282
|
-
Useful for:
|
|
283
|
-
- providing strongly-typed string manipulation functions
|
|
284
|
-
- constraining strings to be a string literal
|
|
285
|
-
- type utilities, such as when constructing parsers and ASTs
|
|
286
|
-
|
|
287
|
-
The implementation of this type is inspired by the trick mentioned in this [StackOverflow answer](https://stackoverflow.com/a/68261113/420747).
|
|
288
|
-
|
|
289
|
-
@example
|
|
290
|
-
```
|
|
291
|
-
import type {IsStringLiteral} from 'type-fest';
|
|
292
|
-
|
|
293
|
-
type CapitalizedString<T extends string> = IsStringLiteral<T> extends true ? Capitalize<T> : string;
|
|
294
|
-
|
|
295
|
-
// https://github.com/yankeeinlondon/native-dash/blob/master/src/capitalize.ts
|
|
296
|
-
function capitalize<T extends Readonly<string>>(input: T): CapitalizedString<T> {
|
|
297
|
-
return (input.slice(0, 1).toUpperCase() + input.slice(1)) as CapitalizedString<T>;
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
const output = capitalize('hello, world!');
|
|
301
|
-
//=> 'Hello, world!'
|
|
302
|
-
```
|
|
303
|
-
|
|
304
|
-
@example
|
|
305
|
-
```
|
|
306
|
-
// String types with infinite set of possible values return `false`.
|
|
307
|
-
|
|
308
|
-
import type {IsStringLiteral} from 'type-fest';
|
|
309
|
-
|
|
310
|
-
type AllUppercaseStrings = IsStringLiteral<Uppercase<string>>;
|
|
311
|
-
//=> false
|
|
312
|
-
|
|
313
|
-
type StringsStartingWithOn = IsStringLiteral<`on${string}`>;
|
|
314
|
-
//=> false
|
|
315
|
-
|
|
316
|
-
// This behaviour is particularly useful in string manipulation utilities, as infinite string types often require separate handling.
|
|
317
|
-
|
|
318
|
-
type Length<S extends string, Counter extends never[] = []> =
|
|
319
|
-
IsStringLiteral<S> extends false
|
|
320
|
-
? number // return `number` for infinite string types
|
|
321
|
-
: S extends `${string}${infer Tail}`
|
|
322
|
-
? Length<Tail, [...Counter, never]>
|
|
323
|
-
: Counter['length'];
|
|
324
|
-
|
|
325
|
-
type L1 = Length<Lowercase<string>>;
|
|
326
|
-
//=> number
|
|
327
|
-
|
|
328
|
-
type L2 = Length<`${number}`>;
|
|
329
|
-
//=> number
|
|
330
|
-
```
|
|
331
|
-
|
|
332
|
-
@category Type Guard
|
|
333
|
-
@category Utilities
|
|
334
|
-
*/
|
|
335
|
-
type IsStringLiteral<S> = IfNotAnyOrNever<S, _IsStringLiteral<CollapseLiterals<S extends TagContainer<any> ? UnwrapTagged<S> : S>>, false, false>;
|
|
336
|
-
type _IsStringLiteral<S> = // If `T` is an infinite string type (e.g., `on${string}`), `Record<T, never>` produces an index signature,
|
|
337
|
-
// and since `{}` extends index signatures, the result becomes `false`.
|
|
338
|
-
S extends string ? {} extends Record<S, never> ? false : true : false;
|
|
339
|
-
//#endregion
|
|
340
|
-
//#region node_modules/.pnpm/type-fest@5.5.0/node_modules/type-fest/source/tuple-of.d.ts
|
|
341
|
-
/**
|
|
342
|
-
Create a tuple type of the specified length with elements of the specified type.
|
|
343
|
-
|
|
344
|
-
@example
|
|
345
|
-
```
|
|
346
|
-
import type {TupleOf} from 'type-fest';
|
|
347
|
-
|
|
348
|
-
type RGB = TupleOf<3, number>;
|
|
349
|
-
//=> [number, number, number]
|
|
350
|
-
|
|
351
|
-
type Line = TupleOf<2, {x: number; y: number}>;
|
|
352
|
-
//=> [{x: number; y: number}, {x: number; y: number}]
|
|
353
|
-
|
|
354
|
-
type TicTacToeBoard = TupleOf<3, TupleOf<3, 'X' | 'O' | null>>;
|
|
355
|
-
//=> [['X' | 'O' | null, 'X' | 'O' | null, 'X' | 'O' | null], ['X' | 'O' | null, 'X' | 'O' | null, 'X' | 'O' | null], ['X' | 'O' | null, 'X' | 'O' | null, 'X' | 'O' | null]]
|
|
356
|
-
```
|
|
357
|
-
|
|
358
|
-
@example
|
|
359
|
-
```
|
|
360
|
-
import type {TupleOf} from 'type-fest';
|
|
361
|
-
|
|
362
|
-
type Range<Start extends number, End extends number> = Exclude<keyof TupleOf<End>, keyof TupleOf<Start>>;
|
|
363
|
-
|
|
364
|
-
type ZeroToFour = Range<0, 5>;
|
|
365
|
-
//=> '0' | '1' | '2' | '3' | '4'
|
|
366
|
-
|
|
367
|
-
type ThreeToEight = Range<3, 9>;
|
|
368
|
-
//=> '5' | '3' | '4' | '6' | '7' | '8'
|
|
369
|
-
```
|
|
370
|
-
|
|
371
|
-
Note: If the specified length is the non-literal `number` type, the result will not be a tuple but a regular array.
|
|
372
|
-
|
|
373
|
-
@example
|
|
374
|
-
```
|
|
375
|
-
import type {TupleOf} from 'type-fest';
|
|
376
|
-
|
|
377
|
-
type StringArray = TupleOf<number, string>;
|
|
378
|
-
//=> string[]
|
|
379
|
-
```
|
|
380
|
-
|
|
381
|
-
Note: If the type for elements is not specified, it will default to `unknown`.
|
|
382
|
-
|
|
383
|
-
@example
|
|
384
|
-
```
|
|
385
|
-
import type {TupleOf} from 'type-fest';
|
|
386
|
-
|
|
387
|
-
type UnknownTriplet = TupleOf<3>;
|
|
388
|
-
//=> [unknown, unknown, unknown]
|
|
389
|
-
```
|
|
390
|
-
|
|
391
|
-
Note: If the specified length is negative, the result will be an empty tuple.
|
|
392
|
-
|
|
393
|
-
@example
|
|
394
|
-
```
|
|
395
|
-
import type {TupleOf} from 'type-fest';
|
|
396
|
-
|
|
397
|
-
type EmptyTuple = TupleOf<-3, string>;
|
|
398
|
-
//=> []
|
|
399
|
-
```
|
|
400
|
-
|
|
401
|
-
Note: If you need a readonly tuple, simply wrap this type with `Readonly`, for example, to create `readonly [number, number, number]` use `Readonly<TupleOf<3, number>>`.
|
|
402
|
-
|
|
403
|
-
@category Array
|
|
404
|
-
*/
|
|
405
|
-
type TupleOf<Length extends number, Fill = unknown> = IfNotAnyOrNever<Length, _TupleOf<If<IsNegative<Length>, 0, Length>, Fill, []>, Fill[], []>;
|
|
406
|
-
type _TupleOf<L extends number, Fill, Accumulator extends UnknownArray> = number extends L ? Fill[] : L extends Accumulator['length'] ? Accumulator : _TupleOf<L, Fill, [...Accumulator, Fill]>;
|
|
407
|
-
//#endregion
|
|
408
|
-
//#region node_modules/.pnpm/type-fest@5.5.0/node_modules/type-fest/source/some-extend.d.ts
|
|
409
|
-
/**
|
|
410
|
-
@see {@link SomeExtend}
|
|
411
|
-
*/
|
|
412
|
-
type SomeExtendOptions = {
|
|
413
|
-
/**
|
|
414
|
-
Consider `never` elements to match the target type only if the target type itself is `never` (or `any`).
|
|
415
|
-
- When set to `true` (default), `never` is _not_ treated as a bottom type, instead, it is treated as a type that matches only itself (or `any`).
|
|
416
|
-
- When set to `false`, `never` is treated as a bottom type, and behaves as it normally would.
|
|
417
|
-
@default true
|
|
418
|
-
@example
|
|
419
|
-
```
|
|
420
|
-
import type {SomeExtend} from 'type-fest';
|
|
421
|
-
type A = SomeExtend<[1, 2, never], string, {strictNever: true}>;
|
|
422
|
-
//=> false
|
|
423
|
-
type B = SomeExtend<[1, 2, never], string, {strictNever: false}>;
|
|
424
|
-
//=> true
|
|
425
|
-
type C = SomeExtend<[1, never], never, {strictNever: true}>;
|
|
426
|
-
//=> true
|
|
427
|
-
type D = SomeExtend<[1, never], never, {strictNever: false}>;
|
|
428
|
-
//=> true
|
|
429
|
-
type E = SomeExtend<[never], any, {strictNever: true}>;
|
|
430
|
-
//=> true
|
|
431
|
-
type F = SomeExtend<[never], any, {strictNever: false}>;
|
|
432
|
-
//=> true
|
|
433
|
-
```
|
|
434
|
-
*/
|
|
435
|
-
strictNever?: boolean;
|
|
436
|
-
};
|
|
437
|
-
type DefaultSomeExtendOptions = {
|
|
438
|
-
strictNever: true;
|
|
439
|
-
};
|
|
440
|
-
/**
|
|
441
|
-
Returns a boolean for whether some element in an array type extends another type.
|
|
442
|
-
|
|
443
|
-
@example
|
|
444
|
-
```
|
|
445
|
-
import type {SomeExtend} from 'type-fest';
|
|
446
|
-
|
|
447
|
-
type A = SomeExtend<['1', '2', 3], number>;
|
|
448
|
-
//=> true
|
|
449
|
-
|
|
450
|
-
type B = SomeExtend<[1, 2, 3], string>;
|
|
451
|
-
//=> false
|
|
452
|
-
|
|
453
|
-
type C = SomeExtend<[string, number | string], number>;
|
|
454
|
-
//=> boolean
|
|
455
|
-
|
|
456
|
-
type D = SomeExtend<[true, boolean, true], false>;
|
|
457
|
-
//=> boolean
|
|
458
|
-
```
|
|
459
|
-
|
|
460
|
-
Note: Behaviour of optional elements depend on the `exactOptionalPropertyTypes` compiler option. When the option is disabled, the target type must include `undefined` for a successful match.
|
|
461
|
-
|
|
462
|
-
```
|
|
463
|
-
// @exactOptionalPropertyTypes: true
|
|
464
|
-
import type {SomeExtend} from 'type-fest';
|
|
465
|
-
|
|
466
|
-
type A = SomeExtend<[1?, 2?, '3'?], string>;
|
|
467
|
-
//=> true
|
|
468
|
-
```
|
|
469
|
-
|
|
470
|
-
```
|
|
471
|
-
// @exactOptionalPropertyTypes: false
|
|
472
|
-
import type {SomeExtend} from 'type-fest';
|
|
473
|
-
|
|
474
|
-
type A = SomeExtend<[1?, 2?, '3'?], string>;
|
|
475
|
-
//=> boolean
|
|
476
|
-
|
|
477
|
-
type B = SomeExtend<[1?, 2?, '3'?], string | undefined>;
|
|
478
|
-
//=> true
|
|
479
|
-
```
|
|
480
|
-
|
|
481
|
-
@see {@link SomeExtendOptions}
|
|
482
|
-
|
|
483
|
-
@category Utilities
|
|
484
|
-
@category Array
|
|
485
|
-
*/
|
|
486
|
-
type SomeExtend<TArray extends UnknownArray, Type, Options extends SomeExtendOptions = {}> = _SomeExtend<CollapseRestElement<TArray>, Type, ApplyDefaultOptions<SomeExtendOptions, DefaultSomeExtendOptions, Options>>;
|
|
487
|
-
type _SomeExtend<TArray extends UnknownArray, Type, Options extends Required<SomeExtendOptions>> = IfNotAnyOrNever<TArray, TArray extends readonly [infer First, ...infer Rest] ? IsNever<First> extends true ? Or<Or<IsNever<Type>, IsAny<Type>>, Not<Options['strictNever']>> extends true // If target `Type` is also `never`, or is `any`, or `strictNever` is disabled, return `true`.
|
|
488
|
-
? true : _SomeExtend<Rest, Type, Options> : First extends Type ? true : _SomeExtend<Rest, Type, Options> : false, false, false>;
|
|
489
|
-
//#endregion
|
|
490
|
-
//#region node_modules/.pnpm/type-fest@5.5.0/node_modules/type-fest/source/or-all.d.ts
|
|
491
|
-
/**
|
|
492
|
-
Returns a boolean for whether any of the given elements is `true`.
|
|
493
|
-
|
|
494
|
-
Use-cases:
|
|
495
|
-
- Check if at least one condition in a list of booleans is met.
|
|
496
|
-
|
|
497
|
-
@example
|
|
498
|
-
```
|
|
499
|
-
import type {OrAll} from 'type-fest';
|
|
500
|
-
|
|
501
|
-
type FFT = OrAll<[false, false, true]>;
|
|
502
|
-
//=> true
|
|
503
|
-
|
|
504
|
-
type FFF = OrAll<[false, false, false]>;
|
|
505
|
-
//=> false
|
|
506
|
-
```
|
|
507
|
-
|
|
508
|
-
Note: When `boolean` is passed as an element, it is distributed into separate cases, and the final result is a union of those cases.
|
|
509
|
-
For example, `OrAll<[false, boolean]>` expands to `OrAll<[false, true]> | OrAll<[false, false]>`, which simplifies to `true | false` (i.e., `boolean`).
|
|
510
|
-
|
|
511
|
-
@example
|
|
512
|
-
```
|
|
513
|
-
import type {OrAll} from 'type-fest';
|
|
514
|
-
|
|
515
|
-
type A = OrAll<[false, boolean]>;
|
|
516
|
-
//=> boolean
|
|
517
|
-
|
|
518
|
-
type B = OrAll<[true, boolean]>;
|
|
519
|
-
//=> true
|
|
520
|
-
```
|
|
521
|
-
|
|
522
|
-
Note: If `never` is passed as an element, it is treated as `false` and the result is computed accordingly.
|
|
523
|
-
|
|
524
|
-
@example
|
|
525
|
-
```
|
|
526
|
-
import type {OrAll} from 'type-fest';
|
|
527
|
-
|
|
528
|
-
type A = OrAll<[never, never, true]>;
|
|
529
|
-
//=> true
|
|
530
|
-
|
|
531
|
-
type B = OrAll<[never, never, false]>;
|
|
532
|
-
//=> false
|
|
533
|
-
|
|
534
|
-
type C = OrAll<[never, never, never]>;
|
|
535
|
-
//=> false
|
|
536
|
-
|
|
537
|
-
type D = OrAll<[never, never, boolean]>;
|
|
538
|
-
//=> boolean
|
|
539
|
-
```
|
|
540
|
-
|
|
541
|
-
Note: If `any` is passed as an element, it is treated as `boolean` and the result is computed accordingly.
|
|
542
|
-
|
|
543
|
-
@example
|
|
544
|
-
```
|
|
545
|
-
import type {OrAll} from 'type-fest';
|
|
546
|
-
|
|
547
|
-
type A = OrAll<[false, any]>;
|
|
548
|
-
//=> boolean
|
|
549
|
-
|
|
550
|
-
type B = OrAll<[true, any]>;
|
|
551
|
-
//=> true
|
|
552
|
-
```
|
|
553
|
-
|
|
554
|
-
Note: `OrAll<[]>` evaluates to `false` because there are no `true` elements in an empty tuple. See [Wikipedia: Clause (logic) > Empty clauses](https://en.wikipedia.org/wiki/Clause_(logic)#Empty_clauses:~:text=The%20truth%20evaluation%20of%20an%20empty%20disjunctive%20clause%20is%20always%20false.).
|
|
555
|
-
|
|
556
|
-
@see {@link Or}
|
|
557
|
-
@see {@link AndAll}
|
|
558
|
-
*/
|
|
559
|
-
type OrAll<T extends readonly boolean[]> = SomeExtend<T, true>;
|
|
560
|
-
//#endregion
|
|
561
|
-
//#region node_modules/.pnpm/type-fest@5.5.0/node_modules/type-fest/source/or.d.ts
|
|
562
|
-
/**
|
|
563
|
-
Returns a boolean for whether either of two given types is true.
|
|
564
|
-
|
|
565
|
-
Use-case: Constructing complex conditional types where at least one condition must be satisfied.
|
|
566
|
-
|
|
567
|
-
@example
|
|
568
|
-
```
|
|
569
|
-
import type {Or} from 'type-fest';
|
|
570
|
-
|
|
571
|
-
type TT = Or<true, true>;
|
|
572
|
-
//=> true
|
|
573
|
-
|
|
574
|
-
type TF = Or<true, false>;
|
|
575
|
-
//=> true
|
|
576
|
-
|
|
577
|
-
type FT = Or<false, true>;
|
|
578
|
-
//=> true
|
|
579
|
-
|
|
580
|
-
type FF = Or<false, false>;
|
|
581
|
-
//=> false
|
|
582
|
-
```
|
|
583
|
-
|
|
584
|
-
Note: When `boolean` is passed as an argument, it is distributed into separate cases, and the final result is a union of those cases.
|
|
585
|
-
For example, `Or<false, boolean>` expands to `Or<false, true> | Or<false, false>`, which simplifies to `true | false` (i.e., `boolean`).
|
|
586
|
-
|
|
587
|
-
@example
|
|
588
|
-
```
|
|
589
|
-
import type {Or} from 'type-fest';
|
|
590
|
-
|
|
591
|
-
type A = Or<false, boolean>;
|
|
592
|
-
//=> boolean
|
|
593
|
-
|
|
594
|
-
type B = Or<boolean, false>;
|
|
595
|
-
//=> boolean
|
|
596
|
-
|
|
597
|
-
type C = Or<true, boolean>;
|
|
598
|
-
//=> true
|
|
599
|
-
|
|
600
|
-
type D = Or<boolean, true>;
|
|
601
|
-
//=> true
|
|
602
|
-
|
|
603
|
-
type E = Or<boolean, boolean>;
|
|
604
|
-
//=> boolean
|
|
605
|
-
```
|
|
606
|
-
|
|
607
|
-
Note: If `never` is passed as an argument, it is treated as `false` and the result is computed accordingly.
|
|
608
|
-
|
|
609
|
-
@example
|
|
610
|
-
```
|
|
611
|
-
import type {Or} from 'type-fest';
|
|
612
|
-
|
|
613
|
-
type A = Or<true, never>;
|
|
614
|
-
//=> true
|
|
615
|
-
|
|
616
|
-
type B = Or<never, true>;
|
|
617
|
-
//=> true
|
|
618
|
-
|
|
619
|
-
type C = Or<false, never>;
|
|
620
|
-
//=> false
|
|
621
|
-
|
|
622
|
-
type D = Or<never, false>;
|
|
623
|
-
//=> false
|
|
624
|
-
|
|
625
|
-
type E = Or<boolean, never>;
|
|
626
|
-
//=> boolean
|
|
627
|
-
|
|
628
|
-
type F = Or<never, boolean>;
|
|
629
|
-
//=> boolean
|
|
630
|
-
|
|
631
|
-
type G = Or<never, never>;
|
|
632
|
-
//=> false
|
|
633
|
-
```
|
|
634
|
-
|
|
635
|
-
@see {@link OrAll}
|
|
636
|
-
@see {@link And}
|
|
637
|
-
@see {@link Xor}
|
|
638
|
-
*/
|
|
639
|
-
type Or<A extends boolean, B extends boolean> = OrAll<[A, B]>;
|
|
640
|
-
//#endregion
|
|
641
|
-
//#region node_modules/.pnpm/type-fest@5.5.0/node_modules/type-fest/source/all-extend.d.ts
|
|
642
|
-
/**
|
|
643
|
-
@see {@link AllExtend}
|
|
644
|
-
*/
|
|
645
|
-
type AllExtendOptions = {
|
|
646
|
-
/**
|
|
647
|
-
Consider `never` elements to match the target type only if the target type itself is `never` (or `any`).
|
|
648
|
-
- When set to `true` (default), `never` is _not_ treated as a bottom type, instead, it is treated as a type that matches only itself (or `any`).
|
|
649
|
-
- When set to `false`, `never` is treated as a bottom type, and behaves as it normally would.
|
|
650
|
-
@default true
|
|
651
|
-
@example
|
|
652
|
-
```
|
|
653
|
-
import type {AllExtend} from 'type-fest';
|
|
654
|
-
type A = AllExtend<[1, 2, never], number, {strictNever: true}>;
|
|
655
|
-
//=> false
|
|
656
|
-
type B = AllExtend<[1, 2, never], number, {strictNever: false}>;
|
|
657
|
-
//=> true
|
|
658
|
-
type C = AllExtend<[never, never], never, {strictNever: true}>;
|
|
659
|
-
//=> true
|
|
660
|
-
type D = AllExtend<[never, never], never, {strictNever: false}>;
|
|
661
|
-
//=> true
|
|
662
|
-
type E = AllExtend<['a', 'b', never], any, {strictNever: true}>;
|
|
663
|
-
//=> true
|
|
664
|
-
type F = AllExtend<['a', 'b', never], any, {strictNever: false}>;
|
|
665
|
-
//=> true
|
|
666
|
-
type G = AllExtend<[never, 1], never, {strictNever: true}>;
|
|
667
|
-
//=> false
|
|
668
|
-
type H = AllExtend<[never, 1], never, {strictNever: false}>;
|
|
669
|
-
//=> false
|
|
670
|
-
```
|
|
671
|
-
*/
|
|
672
|
-
strictNever?: boolean;
|
|
673
|
-
};
|
|
674
|
-
type DefaultAllExtendOptions = {
|
|
675
|
-
strictNever: true;
|
|
676
|
-
};
|
|
677
|
-
/**
|
|
678
|
-
Returns a boolean for whether every element in an array type extends another type.
|
|
679
|
-
|
|
680
|
-
@example
|
|
681
|
-
```
|
|
682
|
-
import type {AllExtend} from 'type-fest';
|
|
683
|
-
|
|
684
|
-
type A = AllExtend<[1, 2, 3], number>;
|
|
685
|
-
//=> true
|
|
686
|
-
|
|
687
|
-
type B = AllExtend<[1, 2, '3'], number>;
|
|
688
|
-
//=> false
|
|
689
|
-
|
|
690
|
-
type C = AllExtend<[number, number | string], number>;
|
|
691
|
-
//=> boolean
|
|
692
|
-
|
|
693
|
-
type D = AllExtend<[true, boolean, true], true>;
|
|
694
|
-
//=> boolean
|
|
695
|
-
```
|
|
696
|
-
|
|
697
|
-
Note: Behaviour of optional elements depend on the `exactOptionalPropertyTypes` compiler option. When the option is disabled, the target type must include `undefined` for a successful match.
|
|
698
|
-
|
|
699
|
-
```
|
|
700
|
-
// @exactOptionalPropertyTypes: true
|
|
701
|
-
import type {AllExtend} from 'type-fest';
|
|
702
|
-
|
|
703
|
-
type A = AllExtend<[1?, 2?, 3?], number>;
|
|
704
|
-
//=> true
|
|
705
|
-
```
|
|
706
|
-
|
|
707
|
-
```
|
|
708
|
-
// @exactOptionalPropertyTypes: false
|
|
709
|
-
import type {AllExtend} from 'type-fest';
|
|
710
|
-
|
|
711
|
-
type A = AllExtend<[1?, 2?, 3?], number>;
|
|
712
|
-
//=> boolean
|
|
713
|
-
|
|
714
|
-
type B = AllExtend<[1?, 2?, 3?], number | undefined>;
|
|
715
|
-
//=> true
|
|
716
|
-
```
|
|
717
|
-
|
|
718
|
-
@see {@link AllExtendOptions}
|
|
719
|
-
|
|
720
|
-
@category Utilities
|
|
721
|
-
@category Array
|
|
722
|
-
*/
|
|
723
|
-
type AllExtend<TArray extends UnknownArray, Type, Options extends AllExtendOptions = {}> = _AllExtend<CollapseRestElement<TArray>, Type, ApplyDefaultOptions<AllExtendOptions, DefaultAllExtendOptions, Options>>;
|
|
724
|
-
type _AllExtend<TArray extends UnknownArray, Type, Options extends Required<AllExtendOptions>> = IfNotAnyOrNever<TArray, TArray extends readonly [infer First, ...infer Rest] ? IsNever<First> extends true ? Or<Or<IsNever<Type>, IsAny<Type>>, Not<Options['strictNever']>> extends true // If target `Type` is also `never`, or is `any`, or `strictNever` is disabled, recurse further.
|
|
725
|
-
? _AllExtend<Rest, Type, Options> : false : First extends Type ? _AllExtend<Rest, Type, Options> : false : true, false, false>;
|
|
726
|
-
//#endregion
|
|
727
|
-
//#region node_modules/.pnpm/type-fest@5.5.0/node_modules/type-fest/source/and-all.d.ts
|
|
728
|
-
/**
|
|
729
|
-
Returns a boolean for whether all of the given elements are `true`.
|
|
730
|
-
|
|
731
|
-
Use-cases:
|
|
732
|
-
- Check if all conditions in a list of booleans are met.
|
|
733
|
-
|
|
734
|
-
@example
|
|
735
|
-
```
|
|
736
|
-
import type {AndAll} from 'type-fest';
|
|
737
|
-
|
|
738
|
-
type TTT = AndAll<[true, true, true]>;
|
|
739
|
-
//=> true
|
|
740
|
-
|
|
741
|
-
type TTF = AndAll<[true, true, false]>;
|
|
742
|
-
//=> false
|
|
743
|
-
|
|
744
|
-
type TFT = AndAll<[true, false, true]>;
|
|
745
|
-
//=> false
|
|
746
|
-
```
|
|
747
|
-
|
|
748
|
-
Note: When `boolean` is passed as an element, it is distributed into separate cases, and the final result is a union of those cases.
|
|
749
|
-
For example, `AndAll<[true, boolean]>` expands to `AndAll<[true, true]> | AndAll<[true, false]>`, which simplifies to `true | false` (i.e., `boolean`).
|
|
750
|
-
|
|
751
|
-
@example
|
|
752
|
-
```
|
|
753
|
-
import type {AndAll} from 'type-fest';
|
|
754
|
-
|
|
755
|
-
type A = AndAll<[true, boolean]>;
|
|
756
|
-
//=> boolean
|
|
757
|
-
|
|
758
|
-
type B = AndAll<[false, boolean]>;
|
|
759
|
-
//=> false
|
|
760
|
-
```
|
|
761
|
-
|
|
762
|
-
Note: If any of the elements is `never`, the result becomes `false`.
|
|
763
|
-
|
|
764
|
-
@example
|
|
765
|
-
```
|
|
766
|
-
import type {AndAll} from 'type-fest';
|
|
767
|
-
|
|
768
|
-
type A = AndAll<[true, true, never]>;
|
|
769
|
-
//=> false
|
|
770
|
-
|
|
771
|
-
type B = AndAll<[false, never, never]>;
|
|
772
|
-
//=> false
|
|
773
|
-
|
|
774
|
-
type C = AndAll<[never, never, never]>;
|
|
775
|
-
//=> false
|
|
776
|
-
|
|
777
|
-
type D = AndAll<[boolean, true, never]>;
|
|
778
|
-
//=> false
|
|
779
|
-
```
|
|
780
|
-
|
|
781
|
-
Note: If `any` is passed as an element, it is treated as `boolean` and the result is computed accordingly.
|
|
782
|
-
|
|
783
|
-
@example
|
|
784
|
-
```
|
|
785
|
-
import type {AndAll} from 'type-fest';
|
|
786
|
-
|
|
787
|
-
type A = AndAll<[false, any]>;
|
|
788
|
-
//=> false
|
|
789
|
-
|
|
790
|
-
type B = AndAll<[true, any]>;
|
|
791
|
-
//=> boolean
|
|
792
|
-
```
|
|
793
|
-
|
|
794
|
-
Note: `AndAll<[]>` evaluates to `true` due to the concept of [vacuous truth](https://en.wikipedia.org/wiki/Logical_conjunction#:~:text=In%20keeping%20with%20the%20concept%20of%20vacuous%20truth%2C%20when%20conjunction%20is%20defined%20as%20an%20operator%20or%20function%20of%20arbitrary%20arity%2C%20the%20empty%20conjunction%20(AND%2Ding%20over%20an%20empty%20set%20of%20operands)%20is%20often%20defined%20as%20having%20the%20result%20true.), i.e., there are no `false` elements in an empty tuple.
|
|
795
|
-
|
|
796
|
-
@see {@link And}
|
|
797
|
-
@see {@link OrAll}
|
|
798
|
-
*/
|
|
799
|
-
type AndAll<T extends readonly boolean[]> = AllExtend<T, true>;
|
|
800
|
-
//#endregion
|
|
801
|
-
//#region node_modules/.pnpm/type-fest@5.5.0/node_modules/type-fest/source/and.d.ts
|
|
802
|
-
/**
|
|
803
|
-
Returns a boolean for whether two given types are both true.
|
|
804
|
-
|
|
805
|
-
Use-case: Constructing complex conditional types where multiple conditions must be satisfied.
|
|
806
|
-
|
|
807
|
-
@example
|
|
808
|
-
```
|
|
809
|
-
import type {And} from 'type-fest';
|
|
810
|
-
|
|
811
|
-
type TT = And<true, true>;
|
|
812
|
-
//=> true
|
|
813
|
-
|
|
814
|
-
type TF = And<true, false>;
|
|
815
|
-
//=> false
|
|
816
|
-
|
|
817
|
-
type FT = And<false, true>;
|
|
818
|
-
//=> false
|
|
819
|
-
|
|
820
|
-
type FF = And<false, false>;
|
|
821
|
-
//=> false
|
|
822
|
-
```
|
|
823
|
-
|
|
824
|
-
Note: When `boolean` is passed as an argument, it is distributed into separate cases, and the final result is a union of those cases.
|
|
825
|
-
For example, `And<true, boolean>` expands to `And<true, true> | And<true, false>`, which simplifies to `true | false` (i.e., `boolean`).
|
|
826
|
-
|
|
827
|
-
@example
|
|
828
|
-
```
|
|
829
|
-
import type {And} from 'type-fest';
|
|
830
|
-
|
|
831
|
-
type A = And<true, boolean>;
|
|
832
|
-
//=> boolean
|
|
833
|
-
|
|
834
|
-
type B = And<boolean, true>;
|
|
835
|
-
//=> boolean
|
|
836
|
-
|
|
837
|
-
type C = And<false, boolean>;
|
|
838
|
-
//=> false
|
|
839
|
-
|
|
840
|
-
type D = And<boolean, false>;
|
|
841
|
-
//=> false
|
|
842
|
-
|
|
843
|
-
type E = And<boolean, boolean>;
|
|
844
|
-
//=> boolean
|
|
845
|
-
```
|
|
846
|
-
|
|
847
|
-
Note: If either of the types is `never`, the result becomes `false`.
|
|
848
|
-
|
|
849
|
-
@example
|
|
850
|
-
```
|
|
851
|
-
import type {And} from 'type-fest';
|
|
852
|
-
|
|
853
|
-
type A = And<true, never>;
|
|
854
|
-
//=> false
|
|
855
|
-
|
|
856
|
-
type B = And<never, true>;
|
|
857
|
-
//=> false
|
|
858
|
-
|
|
859
|
-
type C = And<false, never>;
|
|
860
|
-
//=> false
|
|
861
|
-
|
|
862
|
-
type D = And<never, false>;
|
|
863
|
-
//=> false
|
|
864
|
-
|
|
865
|
-
type E = And<boolean, never>;
|
|
866
|
-
//=> false
|
|
867
|
-
|
|
868
|
-
type F = And<never, boolean>;
|
|
869
|
-
//=> false
|
|
870
|
-
|
|
871
|
-
type G = And<never, never>;
|
|
872
|
-
//=> false
|
|
873
|
-
```
|
|
874
|
-
|
|
875
|
-
@see {@link AndAll}
|
|
876
|
-
@see {@link Or}
|
|
877
|
-
@see {@link Xor}
|
|
878
|
-
*/
|
|
879
|
-
type And<A extends boolean, B extends boolean> = AndAll<[A, B]>;
|
|
880
|
-
//#endregion
|
|
881
|
-
//#region node_modules/.pnpm/type-fest@5.5.0/node_modules/type-fest/source/exclude-exactly.d.ts
|
|
882
|
-
/**
|
|
883
|
-
A stricter version of `Exclude<T, U>` that excludes types only when they are exactly identical.
|
|
884
|
-
|
|
885
|
-
@example
|
|
886
|
-
```
|
|
887
|
-
import type {ExcludeExactly} from 'type-fest';
|
|
888
|
-
|
|
889
|
-
type TestExclude1 = Exclude<'a' | 'b' | 'c' | 1 | 2 | 3, string>;
|
|
890
|
-
//=> 1 | 2 | 3
|
|
891
|
-
|
|
892
|
-
type TestExcludeExactly1 = ExcludeExactly<'a' | 'b' | 'c' | 1 | 2 | 3, string>;
|
|
893
|
-
//=> 'a' | 'b' | 'c' | 1 | 2 | 3
|
|
894
|
-
|
|
895
|
-
type TestExclude2 = Exclude<'a' | 'b' | 'c' | 1 | 2 | 3, any>;
|
|
896
|
-
//=> never
|
|
897
|
-
|
|
898
|
-
type TestExcludeExactly2 = ExcludeExactly<'a' | 'b' | 'c' | 1 | 2 | 3, any>;
|
|
899
|
-
//=> 'a' | 'b' | 'c' | 1 | 2 | 3
|
|
900
|
-
|
|
901
|
-
type TestExclude3 = Exclude<{a: string} | {a: string; b: string}, {a: string}>;
|
|
902
|
-
//=> never
|
|
903
|
-
|
|
904
|
-
type TestExcludeExactly3 = ExcludeExactly<{a: string} | {a: string; b: string}, {a: string}>;
|
|
905
|
-
//=> {a: string; b: string}
|
|
906
|
-
```
|
|
907
|
-
|
|
908
|
-
@category Improved Built-in
|
|
909
|
-
*/
|
|
910
|
-
type ExcludeExactly<Union, Delete> = IfNotAnyOrNever<Union, _ExcludeExactly<Union, Delete>, // If `Union` is `any`, then if `Delete` is `any`, return `never`, else return `Union`.
|
|
911
|
-
If<IsAny<Delete>, never, Union>, // If `Union` is `never`, then if `Delete` is `never`, return `never`, else return `Union`.
|
|
912
|
-
If<IsNever<Delete>, never, Union>>;
|
|
913
|
-
type _ExcludeExactly<Union, Delete> = IfNotAnyOrNever<Delete, Union extends unknown // For distributing `Union`
|
|
914
|
-
? [Delete extends unknown // For distributing `Delete`
|
|
915
|
-
? If<IsEqual<Union, Delete>, true, never> : never] extends [never] ? Union : never : never, // If `Delete` is `any` or `never`, then return `Union`,
|
|
916
|
-
// because `Union` cannot be `any` or `never` here.
|
|
917
|
-
Union, Union>;
|
|
918
|
-
//#endregion
|
|
919
|
-
//#region node_modules/.pnpm/type-fest@5.5.0/node_modules/type-fest/source/union-member.d.ts
|
|
920
|
-
/**
|
|
921
|
-
Returns an arbitrary member of a union type.
|
|
922
|
-
|
|
923
|
-
Use-cases:
|
|
924
|
-
- Implementing recursive type functions that accept a union type.
|
|
925
|
-
|
|
926
|
-
@example
|
|
927
|
-
```
|
|
928
|
-
import type {UnionMember, IsNever} from 'type-fest';
|
|
929
|
-
|
|
930
|
-
type UnionLength<T, Acc extends any[] = []> =
|
|
931
|
-
UnionMember<T> extends infer Member
|
|
932
|
-
? IsNever<Member> extends false
|
|
933
|
-
? UnionLength<Exclude<T, Member>, [...Acc, Member]>
|
|
934
|
-
: Acc['length']
|
|
935
|
-
: never;
|
|
936
|
-
|
|
937
|
-
type T1 = UnionLength<'foo' | 'bar' | 'baz'>;
|
|
938
|
-
//=> 3
|
|
939
|
-
|
|
940
|
-
type T2 = UnionLength<{a: string}>;
|
|
941
|
-
//=> 1
|
|
942
|
-
```
|
|
943
|
-
|
|
944
|
-
- Picking an arbitrary member from a union
|
|
945
|
-
|
|
946
|
-
@example
|
|
947
|
-
```
|
|
948
|
-
import type {UnionMember, Primitive, LiteralToPrimitive} from 'type-fest';
|
|
949
|
-
|
|
950
|
-
type IsHomogenous<T extends Primitive> = [T] extends [LiteralToPrimitive<UnionMember<T>>] ? true : false;
|
|
951
|
-
|
|
952
|
-
type T1 = IsHomogenous<1 | 2 | 3 | 4>;
|
|
953
|
-
//=> true
|
|
954
|
-
|
|
955
|
-
type T2 = IsHomogenous<'foo' | 'bar'>;
|
|
956
|
-
//=> true
|
|
957
|
-
|
|
958
|
-
type T3 = IsHomogenous<'foo' | 'bar' | 1>;
|
|
959
|
-
//=> false
|
|
960
|
-
```
|
|
961
|
-
|
|
962
|
-
Returns `never` when the input is `never`.
|
|
963
|
-
|
|
964
|
-
@example
|
|
965
|
-
```
|
|
966
|
-
import type {UnionMember} from 'type-fest';
|
|
967
|
-
|
|
968
|
-
type LastNever = UnionMember<never>;
|
|
969
|
-
//=> never
|
|
970
|
-
```
|
|
971
|
-
|
|
972
|
-
@category Type
|
|
973
|
-
*/
|
|
974
|
-
type UnionMember<T> = IsNever<T> extends true ? never : UnionToIntersection<T extends any ? () => T : never> extends (() => (infer R)) ? R : never;
|
|
975
|
-
//#endregion
|
|
976
|
-
//#region node_modules/.pnpm/type-fest@5.5.0/node_modules/type-fest/source/union-to-tuple.d.ts
|
|
977
|
-
/**
|
|
978
|
-
Convert a union type into an unordered tuple type of its elements.
|
|
979
|
-
|
|
980
|
-
"Unordered" means the elements of the tuple are not guaranteed to be in the same order as in the union type. The arrangement can appear random and may change at any time.
|
|
981
|
-
|
|
982
|
-
This can be useful when you have objects with a finite set of keys and want a type defining only the allowed keys, but do not want to repeat yourself.
|
|
983
|
-
|
|
984
|
-
@example
|
|
985
|
-
```
|
|
986
|
-
import type {UnionToTuple} from 'type-fest';
|
|
987
|
-
|
|
988
|
-
type Numbers = 1 | 2 | 3;
|
|
989
|
-
type NumbersTuple = UnionToTuple<Numbers>;
|
|
990
|
-
//=> [1, 2, 3]
|
|
991
|
-
```
|
|
992
|
-
|
|
993
|
-
@example
|
|
994
|
-
```
|
|
995
|
-
import type {UnionToTuple} from 'type-fest';
|
|
996
|
-
|
|
997
|
-
const pets = {
|
|
998
|
-
dog: '🐶',
|
|
999
|
-
cat: '🐱',
|
|
1000
|
-
snake: '🐍',
|
|
1001
|
-
};
|
|
1002
|
-
|
|
1003
|
-
type Pet = keyof typeof pets;
|
|
1004
|
-
//=> 'dog' | 'cat' | 'snake'
|
|
1005
|
-
|
|
1006
|
-
const petList = Object.keys(pets) as UnionToTuple<Pet>;
|
|
1007
|
-
//=> ['dog', 'cat', 'snake']
|
|
1008
|
-
```
|
|
1009
|
-
|
|
1010
|
-
@category Array
|
|
1011
|
-
*/
|
|
1012
|
-
type UnionToTuple<T, L = UnionMember<T>> = IsNever<T> extends false ? [...UnionToTuple<ExcludeExactly<T, L>>, L] : [];
|
|
1013
|
-
//#endregion
|
|
1014
|
-
//#region node_modules/.pnpm/type-fest@5.5.0/node_modules/type-fest/source/set-optional.d.ts
|
|
1015
|
-
/**
|
|
1016
|
-
Create a type that makes the given keys optional. The remaining keys are kept as is. The sister of the `SetRequired` type.
|
|
1017
|
-
|
|
1018
|
-
Use-case: You want to define a single model where the only thing that changes is whether or not some of the keys are optional.
|
|
1019
|
-
|
|
1020
|
-
@example
|
|
1021
|
-
```
|
|
1022
|
-
import type {SetOptional} from 'type-fest';
|
|
1023
|
-
|
|
1024
|
-
type Foo = {
|
|
1025
|
-
a: number;
|
|
1026
|
-
b?: string;
|
|
1027
|
-
c: boolean;
|
|
1028
|
-
};
|
|
1029
|
-
|
|
1030
|
-
type SomeOptional = SetOptional<Foo, 'b' | 'c'>;
|
|
1031
|
-
//=> {a: number; b?: string; c?: boolean}
|
|
1032
|
-
```
|
|
1033
|
-
|
|
1034
|
-
@category Object
|
|
1035
|
-
*/
|
|
1036
|
-
type SetOptional<BaseType, Keys extends keyof BaseType> = (BaseType extends ((...arguments_: never) => any) ? (...arguments_: Parameters<BaseType>) => ReturnType<BaseType> : unknown) & _SetOptional<BaseType, Keys>;
|
|
1037
|
-
type _SetOptional<BaseType, Keys extends keyof BaseType> = BaseType extends unknown // To distribute `BaseType` when it's a union type.
|
|
1038
|
-
? Simplify< // Pick just the keys that are readonly from the base type.
|
|
1039
|
-
Except<BaseType, Keys> & // Pick the keys that should be mutable from the base type and make them mutable.
|
|
1040
|
-
Partial<HomomorphicPick<BaseType, Keys>>> : never;
|
|
1041
|
-
//#endregion
|
|
1042
|
-
//#region node_modules/.pnpm/type-fest@5.5.0/node_modules/type-fest/source/split.d.ts
|
|
1043
|
-
/**
|
|
1044
|
-
Split options.
|
|
1045
|
-
|
|
1046
|
-
@see {@link Split}
|
|
1047
|
-
*/
|
|
1048
|
-
type SplitOptions = {
|
|
1049
|
-
/**
|
|
1050
|
-
When enabled, instantiations with non-literal string types (e.g., `string`, `Uppercase<string>`, `on${string}`) simply return back `string[]` without performing any splitting, as the exact structure cannot be statically determined.
|
|
1051
|
-
@default true
|
|
1052
|
-
@example
|
|
1053
|
-
```ts
|
|
1054
|
-
import type {Split} from 'type-fest';
|
|
1055
|
-
type Example1 = Split<`foo.${string}.bar`, '.', {strictLiteralChecks: false}>;
|
|
1056
|
-
//=> ['foo', string, 'bar']
|
|
1057
|
-
type Example2 = Split<`foo.${string}`, '.', {strictLiteralChecks: true}>;
|
|
1058
|
-
//=> string[]
|
|
1059
|
-
type Example3 = Split<'foobarbaz', `b${string}`, {strictLiteralChecks: false}>;
|
|
1060
|
-
//=> ['foo', 'r', 'z']
|
|
1061
|
-
type Example4 = Split<'foobarbaz', `b${string}`, {strictLiteralChecks: true}>;
|
|
1062
|
-
//=> string[]
|
|
1063
|
-
```
|
|
1064
|
-
*/
|
|
1065
|
-
strictLiteralChecks?: boolean;
|
|
1066
|
-
};
|
|
1067
|
-
type DefaultSplitOptions = {
|
|
1068
|
-
strictLiteralChecks: true;
|
|
1069
|
-
};
|
|
1070
|
-
/**
|
|
1071
|
-
Represents an array of strings split using a given character or character set.
|
|
1072
|
-
|
|
1073
|
-
Use-case: Defining the return type of a method like `String.prototype.split`.
|
|
1074
|
-
|
|
1075
|
-
@example
|
|
1076
|
-
```
|
|
1077
|
-
import type {Split} from 'type-fest';
|
|
1078
|
-
|
|
1079
|
-
declare function split<S extends string, D extends string>(string: S, separator: D): Split<S, D>;
|
|
1080
|
-
|
|
1081
|
-
type Item = 'foo' | 'bar' | 'baz' | 'waldo';
|
|
1082
|
-
const items = 'foo,bar,baz,waldo';
|
|
1083
|
-
const array: Item[] = split(items, ',');
|
|
1084
|
-
```
|
|
1085
|
-
|
|
1086
|
-
@see {@link SplitOptions}
|
|
1087
|
-
|
|
1088
|
-
@category String
|
|
1089
|
-
@category Template literal
|
|
1090
|
-
*/
|
|
1091
|
-
type Split<S extends string, Delimiter extends string, Options extends SplitOptions = {}> = SplitHelper<S, Delimiter, ApplyDefaultOptions<SplitOptions, DefaultSplitOptions, Options>>;
|
|
1092
|
-
type SplitHelper<S extends string, Delimiter extends string, Options extends Required<SplitOptions>, Accumulator extends string[] = []> = S extends string // For distributing `S`
|
|
1093
|
-
? Delimiter extends string // For distributing `Delimiter`
|
|
1094
|
-
// If `strictLiteralChecks` is `false` OR `S` and `Delimiter` both are string literals, then perform the split
|
|
1095
|
-
? Or<Not<Options['strictLiteralChecks']>, And<IsStringLiteral<S>, IsStringLiteral<Delimiter>>> extends true ? S extends `${infer Head}${Delimiter}${infer Tail}` ? SplitHelper<Tail, Delimiter, Options, [...Accumulator, Head]> : Delimiter extends '' ? S extends '' ? Accumulator : [...Accumulator, S] : [...Accumulator, S] // Otherwise, return `string[]`
|
|
1096
|
-
: string[] : never // Should never happen
|
|
1097
|
-
: never; // Should never happen
|
|
1098
|
-
//#endregion
|
|
1099
|
-
//#region node_modules/.pnpm/type-fest@5.5.0/node_modules/type-fest/source/replace.d.ts
|
|
1100
|
-
type ReplaceOptions = {
|
|
1101
|
-
all?: boolean;
|
|
1102
|
-
};
|
|
1103
|
-
type DefaultReplaceOptions = {
|
|
1104
|
-
all: false;
|
|
1105
|
-
};
|
|
1106
|
-
/**
|
|
1107
|
-
Represents a string with some or all matches replaced by a replacement.
|
|
1108
|
-
|
|
1109
|
-
Use-case:
|
|
1110
|
-
- `kebab-case-path` to `dotted.path.notation`
|
|
1111
|
-
- Changing date/time format: `01-08-2042` → `01/08/2042`
|
|
1112
|
-
- Manipulation of type properties, for example, removal of prefixes
|
|
1113
|
-
|
|
1114
|
-
@example
|
|
1115
|
-
```
|
|
1116
|
-
import type {Replace} from 'type-fest';
|
|
1117
|
-
|
|
1118
|
-
declare function replace<
|
|
1119
|
-
Input extends string,
|
|
1120
|
-
Search extends string,
|
|
1121
|
-
Replacement extends string,
|
|
1122
|
-
>(
|
|
1123
|
-
input: Input,
|
|
1124
|
-
search: Search,
|
|
1125
|
-
replacement: Replacement
|
|
1126
|
-
): Replace<Input, Search, Replacement>;
|
|
1127
|
-
|
|
1128
|
-
declare function replaceAll<
|
|
1129
|
-
Input extends string,
|
|
1130
|
-
Search extends string,
|
|
1131
|
-
Replacement extends string,
|
|
1132
|
-
>(
|
|
1133
|
-
input: Input,
|
|
1134
|
-
search: Search,
|
|
1135
|
-
replacement: Replacement
|
|
1136
|
-
): Replace<Input, Search, Replacement, {all: true}>;
|
|
1137
|
-
|
|
1138
|
-
// The return type is the exact string literal, not just `string`.
|
|
1139
|
-
|
|
1140
|
-
replace('hello ?', '?', '🦄');
|
|
1141
|
-
//=> 'hello 🦄'
|
|
1142
|
-
|
|
1143
|
-
replace('hello ??', '?', '❓');
|
|
1144
|
-
//=> 'hello ❓?'
|
|
1145
|
-
|
|
1146
|
-
replaceAll('10:42:00', ':', '-');
|
|
1147
|
-
//=> '10-42-00'
|
|
1148
|
-
|
|
1149
|
-
replaceAll('__userName__', '__', '');
|
|
1150
|
-
//=> 'userName'
|
|
1151
|
-
|
|
1152
|
-
replaceAll('My Cool Title', ' ', '');
|
|
1153
|
-
//=> 'MyCoolTitle'
|
|
1154
|
-
```
|
|
1155
|
-
|
|
1156
|
-
@category String
|
|
1157
|
-
@category Template literal
|
|
1158
|
-
*/
|
|
1159
|
-
type Replace<Input extends string, Search extends string, Replacement extends string, Options extends ReplaceOptions = {}> = _Replace<Input, Search, Replacement, ApplyDefaultOptions<ReplaceOptions, DefaultReplaceOptions, Options>>;
|
|
1160
|
-
type _Replace<Input extends string, Search extends string, Replacement extends string, Options extends Required<ReplaceOptions>, Accumulator extends string = ''> = Search extends string // For distributing `Search`
|
|
1161
|
-
? Replacement extends string // For distributing `Replacement`
|
|
1162
|
-
? Input extends `${infer Head}${Search}${infer Tail}` ? Options['all'] extends true ? _Replace<Tail, Search, Replacement, Options, `${Accumulator}${Head}${Replacement}`> : `${Head}${Replacement}${Tail}` : `${Accumulator}${Input}` : never : never;
|
|
1163
|
-
//#endregion
|
|
1164
|
-
//#region src/utils/array/arrayCast.d.ts
|
|
1165
|
-
/**
|
|
1166
|
-
* 构造数组
|
|
1167
|
-
* @param candidate 待构造项
|
|
1168
|
-
* @param checkEmpty 是否检查 `undefined` 和 `null`,默认为 `true`
|
|
1169
|
-
* @returns 构造后的数组
|
|
1170
|
-
* @example
|
|
1171
|
-
* ```ts
|
|
1172
|
-
* arrayCast(1); // [1]
|
|
1173
|
-
* arrayCast([1, 2]); // [1, 2]
|
|
1174
|
-
* arrayCast(null); // []
|
|
1175
|
-
* arrayCast(undefined); // []
|
|
1176
|
-
* arrayCast(null, false); // [null]
|
|
1177
|
-
* ```
|
|
1178
|
-
*/
|
|
1179
|
-
declare function arrayCast<T>(candidate: T | T[] | null | undefined, checkEmpty?: true): NonNullable<T>[];
|
|
1180
|
-
declare function arrayCast<T>(candidate: T | T[] | null | undefined, checkEmpty?: false): T[];
|
|
1181
|
-
//#endregion
|
|
1182
|
-
//#region src/utils/array/arrayCompete.d.ts
|
|
1183
|
-
/**
|
|
1184
|
-
* 数组竞争
|
|
1185
|
-
* - 返回在匹配函数的比较条件中获胜的最终项目,适用于更复杂的最小值/最大值计算
|
|
1186
|
-
*
|
|
1187
|
-
* @param initialList 数组
|
|
1188
|
-
* @param match 匹配函数
|
|
1189
|
-
* @returns 获胜的元素,如果数组为空或参数无效则返回 `null`
|
|
1190
|
-
* @example
|
|
1191
|
-
* ```ts
|
|
1192
|
-
* const list = [1, 10, 5];
|
|
1193
|
-
* arrayCompete(list, (a, b) => (a > b ? a : b)); // 10
|
|
1194
|
-
* arrayCompete(list, (a, b) => (a < b ? a : b)); // 1
|
|
1195
|
-
* ```
|
|
1196
|
-
*/
|
|
1197
|
-
declare function arrayCompete<T>(initialList: readonly T[], match: (a: T, b: T, index: number) => T): T | null;
|
|
1198
|
-
//#endregion
|
|
1199
|
-
//#region node_modules/.pnpm/ts-toolbelt@9.6.0/node_modules/ts-toolbelt/out/List/List.d.ts
|
|
1200
|
-
/**
|
|
1201
|
-
* A [[List]]
|
|
1202
|
-
* @param A its type
|
|
1203
|
-
* @returns [[List]]
|
|
1204
|
-
* @example
|
|
1205
|
-
* ```ts
|
|
1206
|
-
* type list0 = [1, 2, 3]
|
|
1207
|
-
* type list1 = number[]
|
|
1208
|
-
* ```
|
|
1209
|
-
*/
|
|
1210
|
-
declare type List<A = any> = ReadonlyArray<A>;
|
|
1211
|
-
//#endregion
|
|
1212
|
-
//#region node_modules/.pnpm/ts-toolbelt@9.6.0/node_modules/ts-toolbelt/out/Any/Cast.d.ts
|
|
1213
|
-
/**
|
|
1214
|
-
* Ask TS to re-check that `A1` extends `A2`.
|
|
1215
|
-
* And if it fails, `A2` will be enforced anyway.
|
|
1216
|
-
* Can also be used to add constraints on parameters.
|
|
1217
|
-
* @param A1 to check against
|
|
1218
|
-
* @param A2 to cast to
|
|
1219
|
-
* @returns `A1 | A2`
|
|
1220
|
-
* @example
|
|
1221
|
-
* ```ts
|
|
1222
|
-
* import {A} from 'ts-toolbelt'
|
|
1223
|
-
*
|
|
1224
|
-
* type test0 = A.Cast<'42', string> // '42'
|
|
1225
|
-
* type test1 = A.Cast<'42', number> // number
|
|
1226
|
-
* ```
|
|
1227
|
-
*/
|
|
1228
|
-
declare type Cast<A1 extends any, A2 extends any> = A1 extends A2 ? A1 : A2;
|
|
1229
|
-
//#endregion
|
|
1230
|
-
//#region node_modules/.pnpm/ts-toolbelt@9.6.0/node_modules/ts-toolbelt/out/Any/Extends.d.ts
|
|
1231
|
-
/**
|
|
1232
|
-
* Check whether `A1` is part of `A2` or not. The difference with
|
|
1233
|
-
* `extends` is that it forces a [[Boolean]] return.
|
|
1234
|
-
* @param A1
|
|
1235
|
-
* @param A2
|
|
1236
|
-
* @returns [[Boolean]]
|
|
1237
|
-
* @example
|
|
1238
|
-
* ```ts
|
|
1239
|
-
* import {A} from 'ts-toolbelt'
|
|
1240
|
-
*
|
|
1241
|
-
* type test0 = A.Extends<'a' | 'b', 'b'> // Boolean
|
|
1242
|
-
* type test1 = A.Extends<'a', 'a' | 'b'> // True
|
|
1243
|
-
*
|
|
1244
|
-
* type test2 = A.Extends<{a: string}, {a: any}> // True
|
|
1245
|
-
* type test3 = A.Extends<{a: any}, {a: any, b: any}> // False
|
|
1246
|
-
*
|
|
1247
|
-
* type test4 = A.Extends<never, never> // False
|
|
1248
|
-
* /// Nothing cannot extend nothing, use `A.Equals`
|
|
1249
|
-
* ```
|
|
1250
|
-
*/
|
|
1251
|
-
declare type Extends<A1 extends any, A2 extends any> = [A1] extends [never] ? 0 : A1 extends A2 ? 1 : 0;
|
|
1252
|
-
//#endregion
|
|
1253
|
-
//#region node_modules/.pnpm/ts-toolbelt@9.6.0/node_modules/ts-toolbelt/out/Iteration/Iteration.d.ts
|
|
1254
|
-
/**
|
|
1255
|
-
* An entry of `IterationMap`
|
|
1256
|
-
*/
|
|
1257
|
-
declare type Iteration = [value: number, sign: '-' | '0' | '+', prev: keyof IterationMap, next: keyof IterationMap, oppo: keyof IterationMap];
|
|
1258
|
-
declare type IterationMap = {
|
|
1259
|
-
'__': [number, '-' | '0' | '+', '__', '__', '__'];
|
|
1260
|
-
'-100': [-100, '-', '__', '-99', '100'];
|
|
1261
|
-
'-99': [-99, '-', '-100', '-98', '99'];
|
|
1262
|
-
'-98': [-98, '-', '-99', '-97', '98'];
|
|
1263
|
-
'-97': [-97, '-', '-98', '-96', '97'];
|
|
1264
|
-
'-96': [-96, '-', '-97', '-95', '96'];
|
|
1265
|
-
'-95': [-95, '-', '-96', '-94', '95'];
|
|
1266
|
-
'-94': [-94, '-', '-95', '-93', '94'];
|
|
1267
|
-
'-93': [-93, '-', '-94', '-92', '93'];
|
|
1268
|
-
'-92': [-92, '-', '-93', '-91', '92'];
|
|
1269
|
-
'-91': [-91, '-', '-92', '-90', '91'];
|
|
1270
|
-
'-90': [-90, '-', '-91', '-89', '90'];
|
|
1271
|
-
'-89': [-89, '-', '-90', '-88', '89'];
|
|
1272
|
-
'-88': [-88, '-', '-89', '-87', '88'];
|
|
1273
|
-
'-87': [-87, '-', '-88', '-86', '87'];
|
|
1274
|
-
'-86': [-86, '-', '-87', '-85', '86'];
|
|
1275
|
-
'-85': [-85, '-', '-86', '-84', '85'];
|
|
1276
|
-
'-84': [-84, '-', '-85', '-83', '84'];
|
|
1277
|
-
'-83': [-83, '-', '-84', '-82', '83'];
|
|
1278
|
-
'-82': [-82, '-', '-83', '-81', '82'];
|
|
1279
|
-
'-81': [-81, '-', '-82', '-80', '81'];
|
|
1280
|
-
'-80': [-80, '-', '-81', '-79', '80'];
|
|
1281
|
-
'-79': [-79, '-', '-80', '-78', '79'];
|
|
1282
|
-
'-78': [-78, '-', '-79', '-77', '78'];
|
|
1283
|
-
'-77': [-77, '-', '-78', '-76', '77'];
|
|
1284
|
-
'-76': [-76, '-', '-77', '-75', '76'];
|
|
1285
|
-
'-75': [-75, '-', '-76', '-74', '75'];
|
|
1286
|
-
'-74': [-74, '-', '-75', '-73', '74'];
|
|
1287
|
-
'-73': [-73, '-', '-74', '-72', '73'];
|
|
1288
|
-
'-72': [-72, '-', '-73', '-71', '72'];
|
|
1289
|
-
'-71': [-71, '-', '-72', '-70', '71'];
|
|
1290
|
-
'-70': [-70, '-', '-71', '-69', '70'];
|
|
1291
|
-
'-69': [-69, '-', '-70', '-68', '69'];
|
|
1292
|
-
'-68': [-68, '-', '-69', '-67', '68'];
|
|
1293
|
-
'-67': [-67, '-', '-68', '-66', '67'];
|
|
1294
|
-
'-66': [-66, '-', '-67', '-65', '66'];
|
|
1295
|
-
'-65': [-65, '-', '-66', '-64', '65'];
|
|
1296
|
-
'-64': [-64, '-', '-65', '-63', '64'];
|
|
1297
|
-
'-63': [-63, '-', '-64', '-62', '63'];
|
|
1298
|
-
'-62': [-62, '-', '-63', '-61', '62'];
|
|
1299
|
-
'-61': [-61, '-', '-62', '-60', '61'];
|
|
1300
|
-
'-60': [-60, '-', '-61', '-59', '60'];
|
|
1301
|
-
'-59': [-59, '-', '-60', '-58', '59'];
|
|
1302
|
-
'-58': [-58, '-', '-59', '-57', '58'];
|
|
1303
|
-
'-57': [-57, '-', '-58', '-56', '57'];
|
|
1304
|
-
'-56': [-56, '-', '-57', '-55', '56'];
|
|
1305
|
-
'-55': [-55, '-', '-56', '-54', '55'];
|
|
1306
|
-
'-54': [-54, '-', '-55', '-53', '54'];
|
|
1307
|
-
'-53': [-53, '-', '-54', '-52', '53'];
|
|
1308
|
-
'-52': [-52, '-', '-53', '-51', '52'];
|
|
1309
|
-
'-51': [-51, '-', '-52', '-50', '51'];
|
|
1310
|
-
'-50': [-50, '-', '-51', '-49', '50'];
|
|
1311
|
-
'-49': [-49, '-', '-50', '-48', '49'];
|
|
1312
|
-
'-48': [-48, '-', '-49', '-47', '48'];
|
|
1313
|
-
'-47': [-47, '-', '-48', '-46', '47'];
|
|
1314
|
-
'-46': [-46, '-', '-47', '-45', '46'];
|
|
1315
|
-
'-45': [-45, '-', '-46', '-44', '45'];
|
|
1316
|
-
'-44': [-44, '-', '-45', '-43', '44'];
|
|
1317
|
-
'-43': [-43, '-', '-44', '-42', '43'];
|
|
1318
|
-
'-42': [-42, '-', '-43', '-41', '42'];
|
|
1319
|
-
'-41': [-41, '-', '-42', '-40', '41'];
|
|
1320
|
-
'-40': [-40, '-', '-41', '-39', '40'];
|
|
1321
|
-
'-39': [-39, '-', '-40', '-38', '39'];
|
|
1322
|
-
'-38': [-38, '-', '-39', '-37', '38'];
|
|
1323
|
-
'-37': [-37, '-', '-38', '-36', '37'];
|
|
1324
|
-
'-36': [-36, '-', '-37', '-35', '36'];
|
|
1325
|
-
'-35': [-35, '-', '-36', '-34', '35'];
|
|
1326
|
-
'-34': [-34, '-', '-35', '-33', '34'];
|
|
1327
|
-
'-33': [-33, '-', '-34', '-32', '33'];
|
|
1328
|
-
'-32': [-32, '-', '-33', '-31', '32'];
|
|
1329
|
-
'-31': [-31, '-', '-32', '-30', '31'];
|
|
1330
|
-
'-30': [-30, '-', '-31', '-29', '30'];
|
|
1331
|
-
'-29': [-29, '-', '-30', '-28', '29'];
|
|
1332
|
-
'-28': [-28, '-', '-29', '-27', '28'];
|
|
1333
|
-
'-27': [-27, '-', '-28', '-26', '27'];
|
|
1334
|
-
'-26': [-26, '-', '-27', '-25', '26'];
|
|
1335
|
-
'-25': [-25, '-', '-26', '-24', '25'];
|
|
1336
|
-
'-24': [-24, '-', '-25', '-23', '24'];
|
|
1337
|
-
'-23': [-23, '-', '-24', '-22', '23'];
|
|
1338
|
-
'-22': [-22, '-', '-23', '-21', '22'];
|
|
1339
|
-
'-21': [-21, '-', '-22', '-20', '21'];
|
|
1340
|
-
'-20': [-20, '-', '-21', '-19', '20'];
|
|
1341
|
-
'-19': [-19, '-', '-20', '-18', '19'];
|
|
1342
|
-
'-18': [-18, '-', '-19', '-17', '18'];
|
|
1343
|
-
'-17': [-17, '-', '-18', '-16', '17'];
|
|
1344
|
-
'-16': [-16, '-', '-17', '-15', '16'];
|
|
1345
|
-
'-15': [-15, '-', '-16', '-14', '15'];
|
|
1346
|
-
'-14': [-14, '-', '-15', '-13', '14'];
|
|
1347
|
-
'-13': [-13, '-', '-14', '-12', '13'];
|
|
1348
|
-
'-12': [-12, '-', '-13', '-11', '12'];
|
|
1349
|
-
'-11': [-11, '-', '-12', '-10', '11'];
|
|
1350
|
-
'-10': [-10, '-', '-11', '-9', '10'];
|
|
1351
|
-
'-9': [-9, '-', '-10', '-8', '9'];
|
|
1352
|
-
'-8': [-8, '-', '-9', '-7', '8'];
|
|
1353
|
-
'-7': [-7, '-', '-8', '-6', '7'];
|
|
1354
|
-
'-6': [-6, '-', '-7', '-5', '6'];
|
|
1355
|
-
'-5': [-5, '-', '-6', '-4', '5'];
|
|
1356
|
-
'-4': [-4, '-', '-5', '-3', '4'];
|
|
1357
|
-
'-3': [-3, '-', '-4', '-2', '3'];
|
|
1358
|
-
'-2': [-2, '-', '-3', '-1', '2'];
|
|
1359
|
-
'-1': [-1, '-', '-2', '0', '1'];
|
|
1360
|
-
'0': [0, '0', '-1', '1', '0'];
|
|
1361
|
-
'1': [1, '+', '0', '2', '-1'];
|
|
1362
|
-
'2': [2, '+', '1', '3', '-2'];
|
|
1363
|
-
'3': [3, '+', '2', '4', '-3'];
|
|
1364
|
-
'4': [4, '+', '3', '5', '-4'];
|
|
1365
|
-
'5': [5, '+', '4', '6', '-5'];
|
|
1366
|
-
'6': [6, '+', '5', '7', '-6'];
|
|
1367
|
-
'7': [7, '+', '6', '8', '-7'];
|
|
1368
|
-
'8': [8, '+', '7', '9', '-8'];
|
|
1369
|
-
'9': [9, '+', '8', '10', '-9'];
|
|
1370
|
-
'10': [10, '+', '9', '11', '-10'];
|
|
1371
|
-
'11': [11, '+', '10', '12', '-11'];
|
|
1372
|
-
'12': [12, '+', '11', '13', '-12'];
|
|
1373
|
-
'13': [13, '+', '12', '14', '-13'];
|
|
1374
|
-
'14': [14, '+', '13', '15', '-14'];
|
|
1375
|
-
'15': [15, '+', '14', '16', '-15'];
|
|
1376
|
-
'16': [16, '+', '15', '17', '-16'];
|
|
1377
|
-
'17': [17, '+', '16', '18', '-17'];
|
|
1378
|
-
'18': [18, '+', '17', '19', '-18'];
|
|
1379
|
-
'19': [19, '+', '18', '20', '-19'];
|
|
1380
|
-
'20': [20, '+', '19', '21', '-20'];
|
|
1381
|
-
'21': [21, '+', '20', '22', '-21'];
|
|
1382
|
-
'22': [22, '+', '21', '23', '-22'];
|
|
1383
|
-
'23': [23, '+', '22', '24', '-23'];
|
|
1384
|
-
'24': [24, '+', '23', '25', '-24'];
|
|
1385
|
-
'25': [25, '+', '24', '26', '-25'];
|
|
1386
|
-
'26': [26, '+', '25', '27', '-26'];
|
|
1387
|
-
'27': [27, '+', '26', '28', '-27'];
|
|
1388
|
-
'28': [28, '+', '27', '29', '-28'];
|
|
1389
|
-
'29': [29, '+', '28', '30', '-29'];
|
|
1390
|
-
'30': [30, '+', '29', '31', '-30'];
|
|
1391
|
-
'31': [31, '+', '30', '32', '-31'];
|
|
1392
|
-
'32': [32, '+', '31', '33', '-32'];
|
|
1393
|
-
'33': [33, '+', '32', '34', '-33'];
|
|
1394
|
-
'34': [34, '+', '33', '35', '-34'];
|
|
1395
|
-
'35': [35, '+', '34', '36', '-35'];
|
|
1396
|
-
'36': [36, '+', '35', '37', '-36'];
|
|
1397
|
-
'37': [37, '+', '36', '38', '-37'];
|
|
1398
|
-
'38': [38, '+', '37', '39', '-38'];
|
|
1399
|
-
'39': [39, '+', '38', '40', '-39'];
|
|
1400
|
-
'40': [40, '+', '39', '41', '-40'];
|
|
1401
|
-
'41': [41, '+', '40', '42', '-41'];
|
|
1402
|
-
'42': [42, '+', '41', '43', '-42'];
|
|
1403
|
-
'43': [43, '+', '42', '44', '-43'];
|
|
1404
|
-
'44': [44, '+', '43', '45', '-44'];
|
|
1405
|
-
'45': [45, '+', '44', '46', '-45'];
|
|
1406
|
-
'46': [46, '+', '45', '47', '-46'];
|
|
1407
|
-
'47': [47, '+', '46', '48', '-47'];
|
|
1408
|
-
'48': [48, '+', '47', '49', '-48'];
|
|
1409
|
-
'49': [49, '+', '48', '50', '-49'];
|
|
1410
|
-
'50': [50, '+', '49', '51', '-50'];
|
|
1411
|
-
'51': [51, '+', '50', '52', '-51'];
|
|
1412
|
-
'52': [52, '+', '51', '53', '-52'];
|
|
1413
|
-
'53': [53, '+', '52', '54', '-53'];
|
|
1414
|
-
'54': [54, '+', '53', '55', '-54'];
|
|
1415
|
-
'55': [55, '+', '54', '56', '-55'];
|
|
1416
|
-
'56': [56, '+', '55', '57', '-56'];
|
|
1417
|
-
'57': [57, '+', '56', '58', '-57'];
|
|
1418
|
-
'58': [58, '+', '57', '59', '-58'];
|
|
1419
|
-
'59': [59, '+', '58', '60', '-59'];
|
|
1420
|
-
'60': [60, '+', '59', '61', '-60'];
|
|
1421
|
-
'61': [61, '+', '60', '62', '-61'];
|
|
1422
|
-
'62': [62, '+', '61', '63', '-62'];
|
|
1423
|
-
'63': [63, '+', '62', '64', '-63'];
|
|
1424
|
-
'64': [64, '+', '63', '65', '-64'];
|
|
1425
|
-
'65': [65, '+', '64', '66', '-65'];
|
|
1426
|
-
'66': [66, '+', '65', '67', '-66'];
|
|
1427
|
-
'67': [67, '+', '66', '68', '-67'];
|
|
1428
|
-
'68': [68, '+', '67', '69', '-68'];
|
|
1429
|
-
'69': [69, '+', '68', '70', '-69'];
|
|
1430
|
-
'70': [70, '+', '69', '71', '-70'];
|
|
1431
|
-
'71': [71, '+', '70', '72', '-71'];
|
|
1432
|
-
'72': [72, '+', '71', '73', '-72'];
|
|
1433
|
-
'73': [73, '+', '72', '74', '-73'];
|
|
1434
|
-
'74': [74, '+', '73', '75', '-74'];
|
|
1435
|
-
'75': [75, '+', '74', '76', '-75'];
|
|
1436
|
-
'76': [76, '+', '75', '77', '-76'];
|
|
1437
|
-
'77': [77, '+', '76', '78', '-77'];
|
|
1438
|
-
'78': [78, '+', '77', '79', '-78'];
|
|
1439
|
-
'79': [79, '+', '78', '80', '-79'];
|
|
1440
|
-
'80': [80, '+', '79', '81', '-80'];
|
|
1441
|
-
'81': [81, '+', '80', '82', '-81'];
|
|
1442
|
-
'82': [82, '+', '81', '83', '-82'];
|
|
1443
|
-
'83': [83, '+', '82', '84', '-83'];
|
|
1444
|
-
'84': [84, '+', '83', '85', '-84'];
|
|
1445
|
-
'85': [85, '+', '84', '86', '-85'];
|
|
1446
|
-
'86': [86, '+', '85', '87', '-86'];
|
|
1447
|
-
'87': [87, '+', '86', '88', '-87'];
|
|
1448
|
-
'88': [88, '+', '87', '89', '-88'];
|
|
1449
|
-
'89': [89, '+', '88', '90', '-89'];
|
|
1450
|
-
'90': [90, '+', '89', '91', '-90'];
|
|
1451
|
-
'91': [91, '+', '90', '92', '-91'];
|
|
1452
|
-
'92': [92, '+', '91', '93', '-92'];
|
|
1453
|
-
'93': [93, '+', '92', '94', '-93'];
|
|
1454
|
-
'94': [94, '+', '93', '95', '-94'];
|
|
1455
|
-
'95': [95, '+', '94', '96', '-95'];
|
|
1456
|
-
'96': [96, '+', '95', '97', '-96'];
|
|
1457
|
-
'97': [97, '+', '96', '98', '-97'];
|
|
1458
|
-
'98': [98, '+', '97', '99', '-98'];
|
|
1459
|
-
'99': [99, '+', '98', '100', '-99'];
|
|
1460
|
-
'100': [100, '+', '99', '__', '-100'];
|
|
1461
|
-
};
|
|
1462
|
-
//#endregion
|
|
1463
|
-
//#region node_modules/.pnpm/ts-toolbelt@9.6.0/node_modules/ts-toolbelt/out/Iteration/Prev.d.ts
|
|
1464
|
-
/**
|
|
1465
|
-
* Move `I`'s position backwards
|
|
1466
|
-
* @param I to move
|
|
1467
|
-
* @returns [[Iteration]]
|
|
1468
|
-
* @example
|
|
1469
|
-
* ```ts
|
|
1470
|
-
* import {I} from 'ts-toolbelt'
|
|
1471
|
-
*
|
|
1472
|
-
* type i = I.IterationOf<'20'>
|
|
1473
|
-
*
|
|
1474
|
-
* type test0 = I.Pos<i> // 20
|
|
1475
|
-
* type test1 = I.Pos<I.Prev<i>> // 19
|
|
1476
|
-
* ```
|
|
1477
|
-
*/
|
|
1478
|
-
declare type Prev<I extends Iteration> = IterationMap[I[2]];
|
|
1479
|
-
//#endregion
|
|
1480
|
-
//#region node_modules/.pnpm/ts-toolbelt@9.6.0/node_modules/ts-toolbelt/out/Iteration/IterationOf.d.ts
|
|
1481
|
-
/**
|
|
1482
|
-
* Transform a number into an [[Iteration]]
|
|
1483
|
-
* (to use [[Prev]], [[Next]], & [[Pos]])
|
|
1484
|
-
* @param N to transform
|
|
1485
|
-
* @returns [[Iteration]]
|
|
1486
|
-
* @example
|
|
1487
|
-
* ```ts
|
|
1488
|
-
* import {I} from 'ts-toolbelt'
|
|
1489
|
-
*
|
|
1490
|
-
* type i = I.IterationOf<0> // ["-1", "1", "0", 0, "0"]
|
|
1491
|
-
*
|
|
1492
|
-
* type next = I.Next<i> // ["0", "2", "1", 1, "+"]
|
|
1493
|
-
* type prev = I.Prev<i> // ["-2", "0", "-1", -1, "-"]
|
|
1494
|
-
*
|
|
1495
|
-
* type nnext = I.Pos<next> // +1
|
|
1496
|
-
* type nprev = I.Pos<prev> // -1
|
|
1497
|
-
* ```
|
|
1498
|
-
*/
|
|
1499
|
-
declare type IterationOf<N extends number> = `${N}` extends keyof IterationMap ? IterationMap[`${N}`] : IterationMap['__'];
|
|
1500
|
-
//#endregion
|
|
1501
|
-
//#region node_modules/.pnpm/ts-toolbelt@9.6.0/node_modules/ts-toolbelt/out/Iteration/Pos.d.ts
|
|
1502
|
-
/**
|
|
1503
|
-
* Get the position of `I` (**number**)
|
|
1504
|
-
* @param I to query
|
|
1505
|
-
* @returns `number`
|
|
1506
|
-
* @example
|
|
1507
|
-
* ```ts
|
|
1508
|
-
* import {I} from 'ts-toolbelt'
|
|
1509
|
-
*
|
|
1510
|
-
* type i = I.IterationOf<'20'>
|
|
1511
|
-
*
|
|
1512
|
-
* type test0 = I.Pos<i> // 20
|
|
1513
|
-
* type test1 = I.Pos<I.Next<i>> // 21
|
|
1514
|
-
* ```
|
|
1515
|
-
*/
|
|
1516
|
-
declare type Pos<I extends Iteration> = I[0];
|
|
1517
|
-
//#endregion
|
|
1518
|
-
//#region node_modules/.pnpm/ts-toolbelt@9.6.0/node_modules/ts-toolbelt/out/List/Tail.d.ts
|
|
1519
|
-
/**
|
|
1520
|
-
* Remove the first item out of a [[List]]
|
|
1521
|
-
* @param L
|
|
1522
|
-
* @returns [[List]]
|
|
1523
|
-
* @example
|
|
1524
|
-
* ```ts
|
|
1525
|
-
* ```
|
|
1526
|
-
*/
|
|
1527
|
-
declare type Tail$1<L extends List> = L extends readonly [] ? L : L extends readonly [any?, ...infer LTail] ? LTail : L;
|
|
1528
|
-
//#endregion
|
|
1529
|
-
//#region node_modules/.pnpm/ts-toolbelt@9.6.0/node_modules/ts-toolbelt/out/Object/Overwrite.d.ts
|
|
1530
|
-
/**
|
|
1531
|
-
* Update the fields of `O` with the ones of `O1`
|
|
1532
|
-
* (only the existing fields will be updated)
|
|
1533
|
-
* @param O to update
|
|
1534
|
-
* @param O1 to update with
|
|
1535
|
-
* @returns [[Object]]
|
|
1536
|
-
* @example
|
|
1537
|
-
* ```ts
|
|
1538
|
-
* ```
|
|
1539
|
-
*/
|
|
1540
|
-
declare type Overwrite<O extends object, O1 extends object> = { [K in keyof O]: K extends keyof O1 ? O1[K] : O[K] } & {};
|
|
1541
|
-
//#endregion
|
|
1542
|
-
//#region node_modules/.pnpm/ts-toolbelt@9.6.0/node_modules/ts-toolbelt/out/List/_Internal.d.ts
|
|
1543
|
-
/**
|
|
1544
|
-
* Remove `?` & `readonly` from a [[List]]
|
|
1545
|
-
*/
|
|
1546
|
-
declare type Naked<L extends List> = Overwrite<Required<L>, L>;
|
|
1547
|
-
//#endregion
|
|
1548
|
-
//#region node_modules/.pnpm/ts-toolbelt@9.6.0/node_modules/ts-toolbelt/out/List/Prepend.d.ts
|
|
1549
|
-
/**
|
|
1550
|
-
* Add an element `A` at the beginning of `L`
|
|
1551
|
-
* @param L to append to
|
|
1552
|
-
* @param A to be added to
|
|
1553
|
-
* @returns [[List]]
|
|
1554
|
-
* @example
|
|
1555
|
-
* ```ts
|
|
1556
|
-
* ```
|
|
1557
|
-
*/
|
|
1558
|
-
declare type Prepend<L extends List, A extends any> = [A, ...L];
|
|
1559
|
-
//#endregion
|
|
1560
|
-
//#region node_modules/.pnpm/ts-toolbelt@9.6.0/node_modules/ts-toolbelt/out/Iteration/_Internal.d.ts
|
|
1561
|
-
/**
|
|
1562
|
-
* Describes how to perform iterations
|
|
1563
|
-
*/
|
|
1564
|
-
declare type Way = '->' | '<-';
|
|
1565
|
-
//#endregion
|
|
1566
|
-
//#region node_modules/.pnpm/ts-toolbelt@9.6.0/node_modules/ts-toolbelt/out/List/Append.d.ts
|
|
1567
|
-
/**
|
|
1568
|
-
* Add an element `A` at the end of `L`.
|
|
1569
|
-
* @param L to append to
|
|
1570
|
-
* @param A to be added to
|
|
1571
|
-
* @returns [[List]]
|
|
1572
|
-
* @example
|
|
1573
|
-
* ```ts
|
|
1574
|
-
* import {L} from 'ts-toolbelt'
|
|
1575
|
-
*
|
|
1576
|
-
* type test0 = L.Append<[1, 2, 3], 4> // [1, 2, 3, 4]
|
|
1577
|
-
* type test1 = L.Append<[], 'a'> // ['a']
|
|
1578
|
-
* type test2 = L.Append<readonly ['a', 'b'], 'c'> // ['a', 'b', 'c']
|
|
1579
|
-
* type test3 = L.Append<[1, 2], [3, 4]> // [1, 2, [3, 4]]
|
|
1580
|
-
* ```
|
|
1581
|
-
*/
|
|
1582
|
-
declare type Append<L extends List, A extends any> = [...L, A];
|
|
1583
|
-
//#endregion
|
|
1584
|
-
//#region node_modules/.pnpm/ts-toolbelt@9.6.0/node_modules/ts-toolbelt/out/List/Drop.d.ts
|
|
1585
|
-
/**
|
|
1586
|
-
* @hidden
|
|
1587
|
-
*/
|
|
1588
|
-
declare type DropForth<L extends List, N extends Iteration> = {
|
|
1589
|
-
0: DropForth<Tail$1<L>, Prev<N>>;
|
|
1590
|
-
1: L;
|
|
1591
|
-
}[Extends<0, Pos<N>>];
|
|
1592
|
-
/**
|
|
1593
|
-
* @hidden
|
|
1594
|
-
*/
|
|
1595
|
-
declare type DropBack<L extends List, N extends Iteration, I extends Iteration = Prev<N>, LN extends List = []> = {
|
|
1596
|
-
0: DropBack<L, N, Prev<I>, Prepend<LN, L[Pos<I>]>>;
|
|
1597
|
-
1: LN;
|
|
1598
|
-
}[Extends<-1, Pos<I>>];
|
|
1599
|
-
/**
|
|
1600
|
-
* @hidden
|
|
1601
|
-
*/
|
|
1602
|
-
declare type __Drop<L extends List, N extends Iteration, way extends Way> = {
|
|
1603
|
-
'->': DropForth<L, N>;
|
|
1604
|
-
'<-': DropBack<L, N>;
|
|
1605
|
-
}[way];
|
|
1606
|
-
/**
|
|
1607
|
-
* @hidden
|
|
1608
|
-
*/
|
|
1609
|
-
declare type _Drop<L extends List, N extends number, way extends Way = '->'> = __Drop<Naked<L>, IterationOf<N>, way> extends infer X ? Cast<X, List> : never;
|
|
1610
|
-
/**
|
|
1611
|
-
* Remove `N` entries out of `L`
|
|
1612
|
-
* @param L to remove from
|
|
1613
|
-
* @param N to remove out
|
|
1614
|
-
* @param way (?=`'->'`) from front: '->', from end: '<-'
|
|
1615
|
-
* @returns [[List]]
|
|
1616
|
-
* @example
|
|
1617
|
-
* ```ts
|
|
1618
|
-
* ```
|
|
1619
|
-
*/
|
|
1620
|
-
declare type Drop<L extends List, N extends number, way extends Way = '->'> = L extends unknown ? N extends unknown ? _Drop<L, N, way> : never : never;
|
|
1621
|
-
//#endregion
|
|
1622
|
-
//#region node_modules/.pnpm/ts-toolbelt@9.6.0/node_modules/ts-toolbelt/out/List/Take.d.ts
|
|
1623
|
-
/**
|
|
1624
|
-
* starts in reverse from `N` till `N` = 0
|
|
1625
|
-
* @hidden
|
|
1626
|
-
*/
|
|
1627
|
-
declare type TakeForth<L extends List, N extends Iteration, I extends Iteration = Prev<N>, LN extends List = []> = {
|
|
1628
|
-
0: TakeForth<L, N, Prev<I>, Prepend<LN, L[Pos<I>]>>;
|
|
1629
|
-
1: LN;
|
|
1630
|
-
}[Extends<-1, Pos<I>>];
|
|
1631
|
-
/**
|
|
1632
|
-
* starts in reverse from the end till `N` = 0
|
|
1633
|
-
* @hidden
|
|
1634
|
-
*/
|
|
1635
|
-
declare type TakeBack<L extends List, N extends Iteration> = {
|
|
1636
|
-
0: TakeBack<Tail$1<L>, Prev<N>>;
|
|
1637
|
-
1: L;
|
|
1638
|
-
}[Extends<0, Pos<N>>];
|
|
1639
|
-
/**
|
|
1640
|
-
* @hidden
|
|
1641
|
-
*/
|
|
1642
|
-
declare type __Take<L extends List, N extends Iteration, way extends Way> = {
|
|
1643
|
-
'->': TakeForth<L, N>;
|
|
1644
|
-
'<-': TakeBack<L, N>;
|
|
1645
|
-
}[way];
|
|
1646
|
-
/**
|
|
1647
|
-
* @hidden
|
|
1648
|
-
*/
|
|
1649
|
-
declare type _Take<L extends List, N extends number, way extends Way = '->'> = __Take<L, IterationOf<N>, way> extends infer X ? Cast<X, List> : never;
|
|
1650
|
-
/**
|
|
1651
|
-
* Extract `N` entries out of `L`
|
|
1652
|
-
* @param L to extract from
|
|
1653
|
-
* @param N to extract out
|
|
1654
|
-
* @param way (?=`'->'`) to extract from end
|
|
1655
|
-
* @returns [[List]]
|
|
1656
|
-
* @example
|
|
1657
|
-
* ```ts
|
|
1658
|
-
* ```
|
|
1659
|
-
*/
|
|
1660
|
-
declare type Take<L extends List, N extends number, way extends Way = '->'> = L extends unknown ? N extends unknown ? _Take<L, N, way> : never : never;
|
|
1661
|
-
//#endregion
|
|
1662
|
-
//#region src/types/index.type.d.ts
|
|
1663
|
-
type AnyArray<A = any> = readonly A[];
|
|
1664
|
-
type Range<Start extends number, End extends number> = Exclude<keyof TupleOf<End>, keyof TupleOf<Start>>;
|
|
1665
|
-
type TupleToEntries<A extends readonly unknown[]> = If<IsAny<A>, unknown, { [Key in keyof A]: [Key, A[Key]] }>;
|
|
1666
|
-
type Groups<L extends AnyArray, LN extends AnyArray = [], D extends number[] = []> = D["length"] extends 40 ? LN : {
|
|
1667
|
-
0: Groups<Drop<L, 1>, Append<LN, [`${LN["length"]}`, Take<L, 1>]>, [...D, 0]>;
|
|
1668
|
-
1: LN;
|
|
1669
|
-
}[Extends<L, AnyArray<never>>];
|
|
1670
|
-
type TupleToGroups<L extends AnyArray> = Groups<L> extends infer X ? Cast<X, AnyArray> : never;
|
|
1671
|
-
type MatchFunction<T, R = unknown> = (row: T, index: number) => R;
|
|
1672
|
-
//#endregion
|
|
1673
|
-
//#region src/utils/array/arrayCounting.d.ts
|
|
1674
|
-
/**
|
|
1675
|
-
* 统计数组的项目出现次数
|
|
1676
|
-
* - 通过给定的标识符匹配函数,返回一个对象,其中键是回调函数返回的 key 值,每个值是一个整数,表示该 key 出现的次数
|
|
1677
|
-
*
|
|
1678
|
-
* @param initialList 初始数组
|
|
1679
|
-
* @param match 匹配函数
|
|
1680
|
-
* @returns 统计对象
|
|
1681
|
-
* @example
|
|
1682
|
-
* ```ts
|
|
1683
|
-
* const list = ["a", "b", "a", "c"];
|
|
1684
|
-
* arrayCounting(list, (x) => x); // { a: 2, b: 1, c: 1 }
|
|
1685
|
-
*
|
|
1686
|
-
* const users = [{ id: 1, group: "A" }, { id: 2, group: "B" }, { id: 3, group: "A" }];
|
|
1687
|
-
* arrayCounting(users, (u) => u.group); // { A: 2, B: 1 }
|
|
1688
|
-
* ```
|
|
1689
|
-
*/
|
|
1690
|
-
declare function arrayCounting<T, K extends PropertyKey>(initialList: readonly T[], match: MatchFunction<T, K>): Record<string, number>;
|
|
1691
|
-
//#endregion
|
|
1692
|
-
//#region src/utils/array/arrayDifference.d.ts
|
|
1693
|
-
/**
|
|
1694
|
-
* 求数组差集
|
|
1695
|
-
* - 返回在 `initialList` 中存在,但在 `diffList` 中不存在的元素
|
|
1696
|
-
*
|
|
1697
|
-
* @param initialList 初始数组
|
|
1698
|
-
* @param diffList 对比数组
|
|
1699
|
-
* @param match 匹配函数
|
|
1700
|
-
* @returns 差集数组
|
|
1701
|
-
* @example
|
|
1702
|
-
* ```ts
|
|
1703
|
-
* arrayDifference([1, 2, 3], [2, 3, 4]); // [1]
|
|
1704
|
-
* arrayDifference([{ id: 1 }, { id: 2 }], [{ id: 2 }], (x) => x.id); // [{ id: 1 }]
|
|
1705
|
-
* ```
|
|
1706
|
-
*/
|
|
1707
|
-
declare function arrayDifference<T>(initialList: readonly T[], diffList: readonly T[], match?: (row: T, index: number) => unknown): T[];
|
|
1708
|
-
//#endregion
|
|
1709
|
-
//#region src/utils/array/arrayFirst.d.ts
|
|
1710
|
-
/**
|
|
1711
|
-
* 获取数组第一项
|
|
1712
|
-
*
|
|
1713
|
-
* @param initialList 初始数组
|
|
1714
|
-
* @param saveValue 安全值
|
|
1715
|
-
* @returns 数组第一项,如果为空则返回安全值
|
|
1716
|
-
* @example
|
|
1717
|
-
* ```ts
|
|
1718
|
-
* arrayFirst([1, 2]); // 1
|
|
1719
|
-
* arrayFirst([], 0); // 0
|
|
1720
|
-
* ```
|
|
1721
|
-
*/
|
|
1722
|
-
declare function arrayFirst<T>(initialList: readonly T[]): T | undefined;
|
|
1723
|
-
declare function arrayFirst<T>(initialList: readonly T[], saveValue: T): T;
|
|
1724
|
-
//#endregion
|
|
1725
|
-
//#region src/utils/array/arrayFork.d.ts
|
|
1726
|
-
/**
|
|
1727
|
-
* 数组分组过滤
|
|
1728
|
-
* - 给定一个数组和一个条件,返回一个由两个数组组成的元组,其中第一个数组包含所有满足条件的项,第二个数组包含所有不满足条件的项
|
|
1729
|
-
*
|
|
1730
|
-
* @param initialList 初始数组
|
|
1731
|
-
* @param match 条件匹配函数
|
|
1732
|
-
* @returns [满足条件的项[], 不满足条件的项[]]
|
|
1733
|
-
* @example
|
|
1734
|
-
* ```ts
|
|
1735
|
-
* arrayFork([1, 2, 3, 4], (n) => n % 2 === 0); // [[2, 4], [1, 3]]
|
|
1736
|
-
* ```
|
|
1737
|
-
*/
|
|
1738
|
-
declare function arrayFork<T>(initialList: readonly T[], match: MatchFunction<T, boolean>): [T[], T[]];
|
|
1739
|
-
//#endregion
|
|
1740
|
-
//#region src/utils/array/arrayIntersection.d.ts
|
|
1741
|
-
/**
|
|
1742
|
-
* 求数组交集
|
|
1743
|
-
* - 返回在 `initialList` 和 `diffList` 中都存在的元素
|
|
1744
|
-
*
|
|
1745
|
-
* @param initialList 初始数组
|
|
1746
|
-
* @param diffList 对比数组
|
|
1747
|
-
* @param match 匹配函数
|
|
1748
|
-
* @returns 交集数组
|
|
1749
|
-
* @example
|
|
1750
|
-
* ```ts
|
|
1751
|
-
* arrayIntersection([1, 2], [2, 3]); // [2]
|
|
1752
|
-
* arrayIntersection([{ id: 1 }, { id: 2 }], [{ id: 2 }], (x) => x.id); // [{ id: 2 }]
|
|
1753
|
-
* ```
|
|
1754
|
-
*/
|
|
1755
|
-
declare function arrayIntersection<T>(initialList: readonly T[], diffList: readonly T[]): T[];
|
|
1756
|
-
declare function arrayIntersection<T, D = T>(initialList: readonly T[], diffList: readonly D[], match: MatchFunction<T>): T[];
|
|
1757
|
-
//#endregion
|
|
1758
|
-
//#region src/utils/array/arrayLast.d.ts
|
|
1759
|
-
/**
|
|
1760
|
-
* 获取数组最后一项
|
|
1761
|
-
*
|
|
1762
|
-
* @param initialList 初始数组
|
|
1763
|
-
* @param saveValue 安全值
|
|
1764
|
-
* @returns 数组最后一项,如果为空则返回安全值
|
|
1765
|
-
* @example
|
|
1766
|
-
* ```ts
|
|
1767
|
-
* arrayLast([1, 2, 3]); // 3
|
|
1768
|
-
* arrayLast([], 0); // 0
|
|
1769
|
-
* ```
|
|
1770
|
-
*/
|
|
1771
|
-
declare function arrayLast<T>(initialList: readonly T[]): T | undefined;
|
|
1772
|
-
declare function arrayLast<T>(initialList: readonly T[], saveValue: T): T;
|
|
1773
|
-
//#endregion
|
|
1774
|
-
//#region src/utils/array/arrayMerge.d.ts
|
|
1775
|
-
/**
|
|
1776
|
-
* 数组合并
|
|
1777
|
-
* - 如果未提供 `match` 函数,则合并两个数组并去重(Union)
|
|
1778
|
-
* - 如果提供了 `match` 函数,则仅更新 `initialList` 中匹配到的项(Left Join Update),不会追加 `mergeList` 中新增的项
|
|
1779
|
-
*
|
|
1780
|
-
* @param initialList 初始数组
|
|
1781
|
-
* @param mergeList 待合并数组
|
|
1782
|
-
* @param match 匹配函数
|
|
1783
|
-
* @returns 合并后的数组
|
|
1784
|
-
* @example
|
|
1785
|
-
* ```ts
|
|
1786
|
-
* // 基础合并去重
|
|
1787
|
-
* arrayMerge([1, 2], [2, 3]); // [1, 2, 3]
|
|
1788
|
-
* arrayMerge([], [1, 2, 3]); // [1, 2, 3]
|
|
1789
|
-
*
|
|
1790
|
-
* // 按条件更新
|
|
1791
|
-
* const source = [{ id: 1, val: "a" }, { id: 2, val: "b" }];
|
|
1792
|
-
* const update = [{ id: 2, val: "new" }, { id: 3, val: "c" }];
|
|
1793
|
-
* arrayMerge(source, update, (x) => x.id);
|
|
1794
|
-
* // [{ id: 1, val: "a" }, { id: 2, val: "new" }] -> id:3 被忽略
|
|
1795
|
-
* ```
|
|
1796
|
-
*/
|
|
1797
|
-
declare function arrayMerge<T>(initialList: readonly T[], mergeList: readonly T[]): T[];
|
|
1798
|
-
declare function arrayMerge<T, D = T>(initialList: readonly T[], mergeList: readonly D[], match: MatchFunction<T>): T[];
|
|
1799
|
-
//#endregion
|
|
1800
|
-
//#region src/utils/array/arrayPick.d.ts
|
|
1801
|
-
/**
|
|
1802
|
-
* 数组选择
|
|
1803
|
-
* - 一次性应用 `filter` 和 `map` 操作
|
|
1804
|
-
*
|
|
1805
|
-
* @param initialList 初始数组
|
|
1806
|
-
* @param filter filter 函数
|
|
1807
|
-
* @param mapper map 函数
|
|
1808
|
-
* @returns 处理后的新数组
|
|
1809
|
-
* @example
|
|
1810
|
-
* ```ts
|
|
1811
|
-
* const list = [1, 2, 3, 4];
|
|
1812
|
-
* arrayPick(list, (n) => n % 2 === 0); // [2, 4]
|
|
1813
|
-
* arrayPick(list, (n) => n % 2 === 0, (n) => n * 2); // [4, 8]
|
|
1814
|
-
* ```
|
|
1815
|
-
*/
|
|
1816
|
-
declare function arrayPick<const T>(initialList: readonly T[], filter: (row: T, index: number) => boolean): T[];
|
|
1817
|
-
declare function arrayPick<const T, K = T>(initialList: readonly T[], filter: (row: T, index: number) => boolean, mapper: ((row: T, index: number) => K)): K[];
|
|
1818
|
-
//#endregion
|
|
1819
|
-
//#region src/utils/array/arrayReplace.d.ts
|
|
1820
|
-
/**
|
|
1821
|
-
* 数组项替换
|
|
1822
|
-
* - 在给定的数组中,替换符合匹配函数结果的项目
|
|
1823
|
-
* - 只替换第一个匹配项
|
|
1824
|
-
*
|
|
1825
|
-
* @param initialList 初始数组
|
|
1826
|
-
* @param newItem 替换项
|
|
1827
|
-
* @param match 匹配函数
|
|
1828
|
-
* @returns 替换后的新数组
|
|
1829
|
-
* @example
|
|
1830
|
-
* ```ts
|
|
1831
|
-
* arrayReplace([1, 2, 3], 4, (n) => n === 2); // [1, 4, 3]
|
|
1832
|
-
* ```
|
|
1833
|
-
*/
|
|
1834
|
-
declare function arrayReplace<const T>(initialList: readonly T[], newItem: T, match: MatchFunction<T, boolean>): T[];
|
|
1835
|
-
declare function arrayReplace<const T, K extends T>(initialList: readonly T[], newItem: K, match: MatchFunction<T, boolean>): T[];
|
|
1836
|
-
declare function arrayReplace<const T, K>(initialList: readonly T[], newItem: K, match: MatchFunction<T, boolean>): (T | K)[];
|
|
1837
|
-
//#endregion
|
|
1838
|
-
//#region src/utils/array/arrayReplaceMove.d.ts
|
|
1839
|
-
type PositionType = "start" | "end" | number;
|
|
1840
|
-
/**
|
|
1841
|
-
* 数组项替换并移动
|
|
1842
|
-
* - 在给定的数组中,替换并移动符合匹配函数结果的项目
|
|
1843
|
-
* - 只替换和移动第一个匹配项
|
|
1844
|
-
* - 未匹配时,根据 `position` 在指定位置插入 `newItem`
|
|
1845
|
-
*
|
|
1846
|
-
* @param initialList 初始数组
|
|
1847
|
-
* @param newItem 替换项
|
|
1848
|
-
* @param match 匹配函数
|
|
1849
|
-
* @param position 移动位置,可选 `start` | `end` | 索引位置, 默认为 `end`
|
|
1850
|
-
* @returns
|
|
1851
|
-
* @example
|
|
1852
|
-
* ```ts
|
|
1853
|
-
* arrayReplaceMove([1, 2, 3, 4], 5, (n) => n === 2, 0); // [5, 1, 3, 4]
|
|
1854
|
-
* arrayReplaceMove([1, 2, 3, 4], 5, (n) => n === 2, 2); // [1, 3, 5, 4]
|
|
1855
|
-
* arrayReplaceMove([1, 2, 3, 4], 5, (n) => n === 2, "start"); // [5, 1, 3, 4]
|
|
1856
|
-
* arrayReplaceMove([1, 2, 3, 4], 5, (n) => n === 2); // [1, 3, 4, 5]
|
|
1857
|
-
* ```
|
|
1858
|
-
*/
|
|
1859
|
-
declare function arrayReplaceMove<const T>(initialList: readonly T[], newItem: T, match: MatchFunction<T, boolean>, position?: PositionType): T[];
|
|
1860
|
-
//#endregion
|
|
1861
|
-
//#region src/utils/array/arraySplit.d.ts
|
|
1862
|
-
/**
|
|
1863
|
-
* 数组切分
|
|
1864
|
-
* - 将数组以指定的长度切分后,组合在高维数组中
|
|
1865
|
-
*
|
|
1866
|
-
* @param initialList 初始数组
|
|
1867
|
-
* @param size 分割尺寸,默认 `10`
|
|
1868
|
-
* @returns 切分后的二维数组
|
|
1869
|
-
* @example
|
|
1870
|
-
* ```ts
|
|
1871
|
-
* arraySplit([1, 2, 3, 4, 5], 2); // [[1, 2], [3, 4], [5]]
|
|
1872
|
-
* ```
|
|
1873
|
-
*/
|
|
1874
|
-
declare function arraySplit<T>(initialList: readonly T[], size?: number): T[][];
|
|
1875
|
-
//#endregion
|
|
1876
|
-
//#region src/utils/array/arrayZip.d.ts
|
|
1877
|
-
/**
|
|
1878
|
-
* 数组解压
|
|
1879
|
-
* - `arrayZip` 的反向操作
|
|
1880
|
-
*
|
|
1881
|
-
* @param arrays 压缩后的数组
|
|
1882
|
-
* @returns 解压后的二维数组
|
|
1883
|
-
* @example
|
|
1884
|
-
* ```ts
|
|
1885
|
-
* arrayUnzip([[1, "a"], [2, "b"]]); // [[1, 2], ["a", "b"]]
|
|
1886
|
-
* ```
|
|
1887
|
-
*/
|
|
1888
|
-
declare function arrayUnzip<T>(arrays: readonly (readonly T[])[]): T[][];
|
|
1889
|
-
/**
|
|
1890
|
-
* 数组压缩
|
|
1891
|
-
* - 将多个数组的元素按索引组合成元组
|
|
1892
|
-
*
|
|
1893
|
-
* @param arrays 多个数组
|
|
1894
|
-
* @returns 压缩后的元组数组
|
|
1895
|
-
* @example
|
|
1896
|
-
* ```ts
|
|
1897
|
-
* arrayZip([1, 2], ["a", "b"]); // [[1, "a"], [2, "b"]]
|
|
1898
|
-
* ```
|
|
1899
|
-
*/
|
|
1900
|
-
declare function arrayZip<T1, T2, T3, T4, T5>(array1: readonly T1[], array2: readonly T2[], array3: readonly T3[], array4: readonly T4[], array5: readonly T5[]): [T1, T2, T3, T4, T5][];
|
|
1901
|
-
declare function arrayZip<T1, T2, T3, T4>(array1: readonly T1[], array2: readonly T2[], array3: readonly T3[], array4: readonly T4[]): [T1, T2, T3, T4][];
|
|
1902
|
-
declare function arrayZip<T1, T2, T3>(array1: readonly T1[], array2: readonly T2[], array3: readonly T3[]): [T1, T2, T3][];
|
|
1903
|
-
declare function arrayZip<T1, T2>(array1: readonly T1[], array2: readonly T2[]): [T1, T2][];
|
|
1904
|
-
declare function arrayZip(): [];
|
|
1905
|
-
//#endregion
|
|
1906
|
-
//#region src/utils/array/arrayZipToObject.d.ts
|
|
1907
|
-
/**
|
|
1908
|
-
* 数组压缩为对象
|
|
1909
|
-
* - 将键数组和值(数组、函数或静态值)组合成对象
|
|
1910
|
-
*
|
|
1911
|
-
* @param keys 键数组
|
|
1912
|
-
* @param values 值数组、生成值的函数或静态值
|
|
1913
|
-
* @returns 生成的对象
|
|
1914
|
-
* @example
|
|
1915
|
-
* ```ts
|
|
1916
|
-
* arrayZipToObject(["a", "b"], [1, 2]); // { a: 1, b: 2 }
|
|
1917
|
-
* arrayZipToObject(["a", "b"], (k, i) => k + i); // { a: "a0", b: "b1" }
|
|
1918
|
-
* arrayZipToObject(["a", "b"], 1); // { a: 1, b: 1 }
|
|
1919
|
-
* ```
|
|
1920
|
-
*/
|
|
1921
|
-
declare function arrayZipToObject<const K extends PropertyKey, const V>(keys: readonly K[], array: readonly V[]): Record<K, V>;
|
|
1922
|
-
declare function arrayZipToObject<const K extends PropertyKey, const V>(keys: readonly K[], match: MatchFunction<K, V>): Record<K, V>;
|
|
1923
|
-
declare function arrayZipToObject<const K extends PropertyKey, const V>(keys: readonly K[], value: V): Record<K, V>;
|
|
1924
|
-
//#endregion
|
|
1925
|
-
//#region src/utils/device/isBrowser.d.ts
|
|
1926
|
-
declare function isBrowser(): boolean;
|
|
1927
|
-
//#endregion
|
|
1928
|
-
//#region src/utils/device/isDesktop.d.ts
|
|
1929
|
-
/**
|
|
1930
|
-
* 检测当前设备是否为桌面设备
|
|
1931
|
-
*
|
|
1932
|
-
* @param minWidth - 桌面设备最小宽度(默认 1200px)
|
|
1933
|
-
* @param minScreenSize - 桌面设备最小屏幕尺寸(默认 10英寸)
|
|
1934
|
-
* @param dpi - 标准 DPI 基准(默认 160)
|
|
1935
|
-
* @returns 是否为桌面设备
|
|
1936
|
-
* @example
|
|
1937
|
-
* ```ts
|
|
1938
|
-
* // 假设 window.innerWidth = 1920
|
|
1939
|
-
* isDesktop(); // true
|
|
1940
|
-
*
|
|
1941
|
-
* // 自定义阈值
|
|
1942
|
-
* isDesktop(1440, 13); // 更严格的桌面检测
|
|
1943
|
-
* ```
|
|
1944
|
-
*/
|
|
1945
|
-
declare function isDesktop(minWidth?: number, minScreenSize?: number, dpi?: number): boolean;
|
|
1946
|
-
/**
|
|
1947
|
-
* 检测当前设备是否为 Windows 桌面设备
|
|
1948
|
-
*
|
|
1949
|
-
* @param minWidth - 桌面设备最小宽度(默认 1200px)
|
|
1950
|
-
* @param minScreenSize - 桌面设备最小屏幕尺寸(默认 10英寸)
|
|
1951
|
-
* @param dpi - 标准 DPI 基准(默认 160)
|
|
1952
|
-
* @returns 是否为 Windows 桌面设备
|
|
1953
|
-
* @example
|
|
1954
|
-
* ```ts
|
|
1955
|
-
* // UA contains Windows
|
|
1956
|
-
* isWindowsDesktop(); // true
|
|
1957
|
-
* ```
|
|
1958
|
-
*/
|
|
1959
|
-
declare function isWindowsDesktop(minWidth?: number, minScreenSize?: number, dpi?: number): boolean;
|
|
1960
|
-
/**
|
|
1961
|
-
* 检测当前设备是否为 macOS 桌面设备
|
|
1962
|
-
*
|
|
1963
|
-
* @param minWidth - 桌面设备最小宽度(默认 1200px)
|
|
1964
|
-
* @param minScreenSize - 桌面设备最小屏幕尺寸(默认 10英寸)
|
|
1965
|
-
* @param dpi - 标准 DPI 基准(默认 160)
|
|
1966
|
-
* @returns 是否为 macOS 桌面设备
|
|
1967
|
-
* @example
|
|
1968
|
-
* ```ts
|
|
1969
|
-
* // UA contains Macintosh
|
|
1970
|
-
* isMacOSDesktop(); // true
|
|
1971
|
-
* ```
|
|
1972
|
-
*/
|
|
1973
|
-
declare function isMacOSDesktop(minWidth?: number, minScreenSize?: number, dpi?: number): boolean;
|
|
1974
|
-
//#endregion
|
|
1975
|
-
//#region src/utils/device/isMobile.d.ts
|
|
1976
|
-
/**
|
|
1977
|
-
* 检测当前设备是否为移动设备
|
|
1978
|
-
*
|
|
1979
|
-
* @param maxWidth - 移动设备最大宽度(默认 768px)
|
|
1980
|
-
* @param dpi - 标准 DPI 基准(默认 160)
|
|
1981
|
-
* @returns 是否为移动设备
|
|
1982
|
-
* @example
|
|
1983
|
-
* ```ts
|
|
1984
|
-
* // 假设 window.innerWidth = 500
|
|
1985
|
-
* isMobile(); // true
|
|
1986
|
-
* ```
|
|
1987
|
-
*/
|
|
1988
|
-
declare function isMobile(maxWidth?: number, dpi?: number): boolean;
|
|
1989
|
-
/**
|
|
1990
|
-
* 检测当前设备是否为IOS移动设备
|
|
1991
|
-
*
|
|
1992
|
-
* @param maxWidth - 移动设备最大宽度(默认 768px)
|
|
1993
|
-
* @param dpi - 标准 DPI 基准(默认 160)
|
|
1994
|
-
* @returns 是否为 iOS 移动设备 (iPhone/iPod)
|
|
1995
|
-
* @example
|
|
1996
|
-
* ```ts
|
|
1997
|
-
* // UA contains iPhone
|
|
1998
|
-
* isIOSMobile(); // true
|
|
1999
|
-
* ```
|
|
2000
|
-
*/
|
|
2001
|
-
declare function isIOSMobile(maxWidth?: number, dpi?: number): boolean;
|
|
2002
|
-
//#endregion
|
|
2003
|
-
//#region src/utils/device/isReactNative.d.ts
|
|
2004
|
-
declare function isReactNative(): boolean;
|
|
2005
|
-
//#endregion
|
|
2006
|
-
//#region src/utils/device/isTablet.d.ts
|
|
2007
|
-
/**
|
|
2008
|
-
* 检测当前设备是否为平板
|
|
2009
|
-
*
|
|
2010
|
-
* @param minWidth - 平板最小宽度(默认 768px)
|
|
2011
|
-
* @param maxWidth - 平板最大宽度(默认 1200px)
|
|
2012
|
-
* @param dpi - 标准 DPI 基准(默认 160)
|
|
2013
|
-
* @returns 是否为平板设备
|
|
2014
|
-
* @example
|
|
2015
|
-
* ```ts
|
|
2016
|
-
* // 假设 window.innerWidth = 1000
|
|
2017
|
-
* isTablet(); // true
|
|
2018
|
-
* ```
|
|
2019
|
-
*/
|
|
2020
|
-
declare function isTablet(minWidth?: number, maxWidth?: number, dpi?: number): boolean;
|
|
2021
|
-
//#endregion
|
|
2022
|
-
//#region src/utils/device/isWebWorker.d.ts
|
|
2023
|
-
declare function isWebWorker(): boolean;
|
|
2024
|
-
//#endregion
|
|
2025
|
-
//#region src/utils/function/to.d.ts
|
|
2026
|
-
/**
|
|
2027
|
-
*将 Promise 转换为 `[err, result]` 格式,方便 async/await 错误处理
|
|
2028
|
-
*
|
|
2029
|
-
* @param promise 待处理的 Promise
|
|
2030
|
-
* @param errorExt 附加到 error 对象的扩展信息(注意:如果原 error 是 Error 实例,扩展属性可能会覆盖或无法正确合并非枚举属性)
|
|
2031
|
-
* @returns `[err, null]` 或 `[null, data]`
|
|
2032
|
-
* @example
|
|
2033
|
-
* ```ts
|
|
2034
|
-
* const [err, data] = await to(someAsyncFunc());
|
|
2035
|
-
* if (err) return;
|
|
2036
|
-
* console.log(data);
|
|
2037
|
-
* ```
|
|
2038
|
-
*/
|
|
2039
|
-
declare function to<T, U = Error>(promise: Readonly<Promise<T>>, errorExt?: PlainObject): Promise<[U, undefined] | [null, T]>;
|
|
2040
|
-
//#endregion
|
|
2041
|
-
//#region src/utils/function/toPromise.d.ts
|
|
2042
|
-
/**
|
|
2043
|
-
* 将同步或异步函数统一包装为 Promise
|
|
2044
|
-
* - 自动捕获同步异常
|
|
2045
|
-
*
|
|
2046
|
-
* @param fn 返回值可为同步值或 Promise 的函数
|
|
2047
|
-
* @returns 标准化的 Promise
|
|
2048
|
-
*
|
|
2049
|
-
* @example
|
|
2050
|
-
* // 同步函数
|
|
2051
|
-
* toPromise(() => 42).then(v => console.log(v)); // 42
|
|
2052
|
-
*
|
|
2053
|
-
* // 异步函数
|
|
2054
|
-
* toPromise(async () => await fetchData()).then(data => ...);
|
|
2055
|
-
*
|
|
2056
|
-
* // 异常处理
|
|
2057
|
-
* toPromise(() => { throw new Error('fail'); }).catch(err => console.error(err)); // 捕获同步异常
|
|
2058
|
-
*/
|
|
2059
|
-
declare function toPromise<T>(fn: () => T | Promise<T>): Promise<T>;
|
|
2060
|
-
//#endregion
|
|
2061
|
-
//#region src/utils/math/mathToBignumber.d.ts
|
|
2062
|
-
/**
|
|
2063
|
-
* 将任意类型的值转换为 `math.bignumber`
|
|
2064
|
-
*
|
|
2065
|
-
* @param mathJsInstance mathJs 实例
|
|
2066
|
-
* @param value 任意类型的值
|
|
2067
|
-
* @param saveValue 安全值
|
|
2068
|
-
* @returns 转换后的 BigNumber
|
|
2069
|
-
* @example
|
|
2070
|
-
* ```ts
|
|
2071
|
-
* import { create, all } from "mathjs";
|
|
2072
|
-
* const math = create(all);
|
|
2073
|
-
* mathToBignumber(math, "0.1");
|
|
2074
|
-
* ```
|
|
2075
|
-
*/
|
|
2076
|
-
declare function mathToBignumber(mathJsInstance: MathJsInstance, value: unknown, saveValue?: BigNumber | undefined): BigNumber;
|
|
2077
|
-
//#endregion
|
|
2078
|
-
//#region src/utils/math/mathToDecimal.d.ts
|
|
2079
|
-
/**
|
|
2080
|
-
* 将任意类型的值转换为十进制数字字符串
|
|
2081
|
-
*
|
|
2082
|
-
* @param mathJsInstance mathJs 实例
|
|
2083
|
-
* @param value 任意类型的值
|
|
2084
|
-
* @param precision 精度
|
|
2085
|
-
* @param isFormat 是否格式化为字符串
|
|
2086
|
-
* @returns 格式化后的字符串或 BigNumber
|
|
2087
|
-
* @example
|
|
2088
|
-
* ```ts
|
|
2089
|
-
* mathToDecimal(math, 0.12345, 2); // "0.12"
|
|
2090
|
-
* ```
|
|
2091
|
-
*/
|
|
2092
|
-
declare function mathToDecimal(mathJsInstance: MathJsInstance, value: unknown, precision?: number | undefined, isFormat?: true): string;
|
|
2093
|
-
declare function mathToDecimal(mathJsInstance: MathJsInstance, value: unknown, precision?: number | undefined, isFormat?: false): BigNumber;
|
|
2094
|
-
//#endregion
|
|
2095
|
-
//#region src/utils/math/mathToEvaluate.d.ts
|
|
2096
|
-
/**
|
|
2097
|
-
* 数学表达式求值
|
|
2098
|
-
*
|
|
2099
|
-
* @param mathJsInstance mathJs 实例
|
|
2100
|
-
* @param expr 表达式
|
|
2101
|
-
* @param scope 键值映射
|
|
2102
|
-
* @returns 计算结果的字符串表示
|
|
2103
|
-
* @example
|
|
2104
|
-
* ```ts
|
|
2105
|
-
* mathToEvaluate(math, "a + b", { a: 1, b: 2 }); // "3"
|
|
2106
|
-
* ```
|
|
2107
|
-
*/
|
|
2108
|
-
declare function mathToEvaluate(mathJsInstance: MathJsInstance, expr: MathExpression | Matrix, scope?: Record<string, BigNumber>): string;
|
|
2109
|
-
//#endregion
|
|
2110
|
-
//#region src/utils/number/numberWithin.d.ts
|
|
2111
|
-
/**
|
|
2112
|
-
* 数字区间检查函数
|
|
2113
|
-
*
|
|
2114
|
-
* @param input 待检查数字
|
|
2115
|
-
* @param interval 由两个数字组成的元组 [left, right]
|
|
2116
|
-
* @param includeLeft 是否包含左边界(默认 true)
|
|
2117
|
-
* @param includeRight 是否包含右边界(默认 false)
|
|
2118
|
-
* @returns 是否在区间内
|
|
2119
|
-
* @example
|
|
2120
|
-
* ```ts
|
|
2121
|
-
* numberWithin(5, [1, 10]); // true
|
|
2122
|
-
* numberWithin(1, [1, 10], false); // false
|
|
2123
|
-
* ```
|
|
2124
|
-
*/
|
|
2125
|
-
declare function numberWithin(input: number, interval: [number, number], includeLeft?: boolean, includeRight?: boolean): boolean;
|
|
2126
|
-
//#endregion
|
|
2127
|
-
//#region src/utils/object/enumEntries.d.ts
|
|
2128
|
-
/**
|
|
2129
|
-
* 获取所有枚举成员的键/值数组
|
|
2130
|
-
*
|
|
2131
|
-
* @param enumeration 枚举对象
|
|
2132
|
-
* @returns 键值对数组
|
|
2133
|
-
* @example
|
|
2134
|
-
* ```ts
|
|
2135
|
-
* enum A { k = "v" }
|
|
2136
|
-
* enumEntries(A); // [["k", "v"]]
|
|
2137
|
-
* ```
|
|
2138
|
-
*/
|
|
2139
|
-
declare function enumEntries<E extends PlainObject>(enumeration: E): [keyof E, E[keyof E]][];
|
|
2140
|
-
declare function enumEntries<E extends AnyObject>(enumeration: E): [keyof E, E[keyof E]][];
|
|
2141
|
-
//#endregion
|
|
2142
|
-
//#region src/utils/object/enumKeys.d.ts
|
|
2143
|
-
/**
|
|
2144
|
-
* 获取所有枚举成员的键
|
|
2145
|
-
*
|
|
2146
|
-
* @param enumeration 枚举对象
|
|
2147
|
-
* @returns 键数组
|
|
2148
|
-
* @example
|
|
2149
|
-
* ```ts
|
|
2150
|
-
* enum A { k = "v" }
|
|
2151
|
-
* enumKeys(A); // ["k"]
|
|
2152
|
-
* ```
|
|
2153
|
-
*/
|
|
2154
|
-
declare function enumKeys<E extends PlainObject>(enumeration: E): (keyof E)[];
|
|
2155
|
-
declare function enumKeys<E extends AnyObject>(enumeration: E): (keyof E)[];
|
|
2156
|
-
//#endregion
|
|
2157
|
-
//#region src/utils/object/enumValues.d.ts
|
|
2158
|
-
/**
|
|
2159
|
-
* 获取所有枚举成员的值
|
|
2160
|
-
*
|
|
2161
|
-
* @param enumeration 枚举对象
|
|
2162
|
-
* @returns 值数组
|
|
2163
|
-
* @example
|
|
2164
|
-
* ```ts
|
|
2165
|
-
* enum A { k = "v" }
|
|
2166
|
-
* enumValues(A); // ["v"]
|
|
2167
|
-
* ```
|
|
2168
|
-
*/
|
|
2169
|
-
declare function enumValues<E extends PlainObject>(enumeration: E): UnionToTuple<ValueOf<E>>;
|
|
2170
|
-
declare function enumValues<E extends AnyObject>(enumeration: E): UnionToTuple<ValueOf<E>>;
|
|
2171
|
-
//#endregion
|
|
2172
|
-
//#region src/utils/object/objectMapEntries.d.ts
|
|
2173
|
-
/**
|
|
2174
|
-
* 映射对象条目
|
|
2175
|
-
* - 将对象的键值对映射为新的键值对
|
|
2176
|
-
*
|
|
2177
|
-
* @param plainObject 对象
|
|
2178
|
-
* @param toEntry 映射函数
|
|
2179
|
-
* @returns 映射后的新对象
|
|
2180
|
-
* @example
|
|
2181
|
-
* ```ts
|
|
2182
|
-
* const obj = { a: 1, b: 2 };
|
|
2183
|
-
* objectMapEntries(obj, (k, v) => [k, v * 2]); // { a: 2, b: 4 }
|
|
2184
|
-
* ```
|
|
2185
|
-
*/
|
|
2186
|
-
declare function objectMapEntries<O extends PlainObject, NK extends PropertyKey, NV>(plainObject: O, toEntry: (key: keyof O, value: O[keyof O]) => [NK, NV]): PlainObject<NK, NV>;
|
|
2187
|
-
//#endregion
|
|
2188
|
-
//#region node_modules/.pnpm/radashi@12.7.2/node_modules/radashi/dist/radashi.d.cts
|
|
2189
|
-
interface BigInt {
|
|
2190
|
-
/**
|
|
2191
|
-
* Returns a string representation of an object.
|
|
2192
|
-
* @param radix Specifies a radix for converting numeric values to strings.
|
|
2193
|
-
*/
|
|
2194
|
-
toString(radix?: number): string;
|
|
2195
|
-
/** Returns a string representation appropriate to the host environment's current locale. */
|
|
2196
|
-
toLocaleString(locales?: any, options?: BigIntToLocaleStringOptions): string;
|
|
2197
|
-
/** Returns the primitive value of the specified object. */
|
|
2198
|
-
valueOf(): bigint;
|
|
2199
|
-
readonly [Symbol.toStringTag]: "BigInt";
|
|
2200
|
-
}
|
|
2201
|
-
/**
|
|
2202
|
-
* A typed array of 64-bit signed integer values. The contents are initialized to 0. If the
|
|
2203
|
-
* requested number of bytes could not be allocated, an exception is raised.
|
|
2204
|
-
*/
|
|
2205
|
-
interface BigInt64Array$1 {
|
|
2206
|
-
/** The size in bytes of each element in the array. */
|
|
2207
|
-
readonly BYTES_PER_ELEMENT: number;
|
|
2208
|
-
/** The ArrayBuffer instance referenced by the array. */
|
|
2209
|
-
readonly buffer: ArrayBufferLike;
|
|
2210
|
-
/** The length in bytes of the array. */
|
|
2211
|
-
readonly byteLength: number;
|
|
2212
|
-
/** The offset in bytes of the array. */
|
|
2213
|
-
readonly byteOffset: number;
|
|
2214
|
-
/**
|
|
2215
|
-
* Returns the this object after copying a section of the array identified by start and end
|
|
2216
|
-
* to the same array starting at position target
|
|
2217
|
-
* @param target If target is negative, it is treated as length+target where length is the
|
|
2218
|
-
* length of the array.
|
|
2219
|
-
* @param start If start is negative, it is treated as length+start. If end is negative, it
|
|
2220
|
-
* is treated as length+end.
|
|
2221
|
-
* @param end If not specified, length of the this object is used as its default value.
|
|
2222
|
-
*/
|
|
2223
|
-
copyWithin(target: number, start: number, end?: number): this;
|
|
2224
|
-
/** Yields index, value pairs for every entry in the array. */
|
|
2225
|
-
entries(): IterableIterator<[number, bigint]>;
|
|
2226
|
-
/**
|
|
2227
|
-
* Determines whether all the members of an array satisfy the specified test.
|
|
2228
|
-
* @param predicate A function that accepts up to three arguments. The every method calls
|
|
2229
|
-
* the predicate function for each element in the array until the predicate returns false,
|
|
2230
|
-
* or until the end of the array.
|
|
2231
|
-
* @param thisArg An object to which the this keyword can refer in the predicate function.
|
|
2232
|
-
* If thisArg is omitted, undefined is used as the this value.
|
|
2233
|
-
*/
|
|
2234
|
-
every(predicate: (value: bigint, index: number, array: BigInt64Array$1) => boolean, thisArg?: any): boolean;
|
|
2235
|
-
/**
|
|
2236
|
-
* Changes all array elements from `start` to `end` index to a static `value` and returns the modified array
|
|
2237
|
-
* @param value value to fill array section with
|
|
2238
|
-
* @param start index to start filling the array at. If start is negative, it is treated as
|
|
2239
|
-
* length+start where length is the length of the array.
|
|
2240
|
-
* @param end index to stop filling the array at. If end is negative, it is treated as
|
|
2241
|
-
* length+end.
|
|
2242
|
-
*/
|
|
2243
|
-
fill(value: bigint, start?: number, end?: number): this;
|
|
2244
|
-
/**
|
|
2245
|
-
* Returns the elements of an array that meet the condition specified in a callback function.
|
|
2246
|
-
* @param predicate A function that accepts up to three arguments. The filter method calls
|
|
2247
|
-
* the predicate function one time for each element in the array.
|
|
2248
|
-
* @param thisArg An object to which the this keyword can refer in the predicate function.
|
|
2249
|
-
* If thisArg is omitted, undefined is used as the this value.
|
|
2250
|
-
*/
|
|
2251
|
-
filter(predicate: (value: bigint, index: number, array: BigInt64Array$1) => any, thisArg?: any): BigInt64Array$1;
|
|
2252
|
-
/**
|
|
2253
|
-
* Returns the value of the first element in the array where predicate is true, and undefined
|
|
2254
|
-
* otherwise.
|
|
2255
|
-
* @param predicate find calls predicate once for each element of the array, in ascending
|
|
2256
|
-
* order, until it finds one where predicate returns true. If such an element is found, find
|
|
2257
|
-
* immediately returns that element value. Otherwise, find returns undefined.
|
|
2258
|
-
* @param thisArg If provided, it will be used as the this value for each invocation of
|
|
2259
|
-
* predicate. If it is not provided, undefined is used instead.
|
|
2260
|
-
*/
|
|
2261
|
-
find(predicate: (value: bigint, index: number, array: BigInt64Array$1) => boolean, thisArg?: any): bigint | undefined;
|
|
2262
|
-
/**
|
|
2263
|
-
* Returns the index of the first element in the array where predicate is true, and -1
|
|
2264
|
-
* otherwise.
|
|
2265
|
-
* @param predicate find calls predicate once for each element of the array, in ascending
|
|
2266
|
-
* order, until it finds one where predicate returns true. If such an element is found,
|
|
2267
|
-
* findIndex immediately returns that element index. Otherwise, findIndex returns -1.
|
|
2268
|
-
* @param thisArg If provided, it will be used as the this value for each invocation of
|
|
2269
|
-
* predicate. If it is not provided, undefined is used instead.
|
|
2270
|
-
*/
|
|
2271
|
-
findIndex(predicate: (value: bigint, index: number, array: BigInt64Array$1) => boolean, thisArg?: any): number;
|
|
2272
|
-
/**
|
|
2273
|
-
* Performs the specified action for each element in an array.
|
|
2274
|
-
* @param callbackfn A function that accepts up to three arguments. forEach calls the
|
|
2275
|
-
* callbackfn function one time for each element in the array.
|
|
2276
|
-
* @param thisArg An object to which the this keyword can refer in the callbackfn function.
|
|
2277
|
-
* If thisArg is omitted, undefined is used as the this value.
|
|
2278
|
-
*/
|
|
2279
|
-
forEach(callbackfn: (value: bigint, index: number, array: BigInt64Array$1) => void, thisArg?: any): void;
|
|
2280
|
-
/**
|
|
2281
|
-
* Determines whether an array includes a certain element, returning true or false as appropriate.
|
|
2282
|
-
* @param searchElement The element to search for.
|
|
2283
|
-
* @param fromIndex The position in this array at which to begin searching for searchElement.
|
|
2284
|
-
*/
|
|
2285
|
-
includes(searchElement: bigint, fromIndex?: number): boolean;
|
|
2286
|
-
/**
|
|
2287
|
-
* Returns the index of the first occurrence of a value in an array.
|
|
2288
|
-
* @param searchElement The value to locate in the array.
|
|
2289
|
-
* @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the
|
|
2290
|
-
* search starts at index 0.
|
|
2291
|
-
*/
|
|
2292
|
-
indexOf(searchElement: bigint, fromIndex?: number): number;
|
|
2293
|
-
/**
|
|
2294
|
-
* Adds all the elements of an array separated by the specified separator string.
|
|
2295
|
-
* @param separator A string used to separate one element of an array from the next in the
|
|
2296
|
-
* resulting String. If omitted, the array elements are separated with a comma.
|
|
2297
|
-
*/
|
|
2298
|
-
join(separator?: string): string;
|
|
2299
|
-
/** Yields each index in the array. */
|
|
2300
|
-
keys(): IterableIterator<number>;
|
|
2301
|
-
/**
|
|
2302
|
-
* Returns the index of the last occurrence of a value in an array.
|
|
2303
|
-
* @param searchElement The value to locate in the array.
|
|
2304
|
-
* @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the
|
|
2305
|
-
* search starts at index 0.
|
|
2306
|
-
*/
|
|
2307
|
-
lastIndexOf(searchElement: bigint, fromIndex?: number): number;
|
|
2308
|
-
/** The length of the array. */
|
|
2309
|
-
readonly length: number;
|
|
2310
|
-
/**
|
|
2311
|
-
* Calls a defined callback function on each element of an array, and returns an array that
|
|
2312
|
-
* contains the results.
|
|
2313
|
-
* @param callbackfn A function that accepts up to three arguments. The map method calls the
|
|
2314
|
-
* callbackfn function one time for each element in the array.
|
|
2315
|
-
* @param thisArg An object to which the this keyword can refer in the callbackfn function.
|
|
2316
|
-
* If thisArg is omitted, undefined is used as the this value.
|
|
2317
|
-
*/
|
|
2318
|
-
map(callbackfn: (value: bigint, index: number, array: BigInt64Array$1) => bigint, thisArg?: any): BigInt64Array$1;
|
|
2319
|
-
/**
|
|
2320
|
-
* Calls the specified callback function for all the elements in an array. The return value of
|
|
2321
|
-
* the callback function is the accumulated result, and is provided as an argument in the next
|
|
2322
|
-
* call to the callback function.
|
|
2323
|
-
* @param callbackfn A function that accepts up to four arguments. The reduce method calls the
|
|
2324
|
-
* callbackfn function one time for each element in the array.
|
|
2325
|
-
* @param initialValue If initialValue is specified, it is used as the initial value to start
|
|
2326
|
-
* the accumulation. The first call to the callbackfn function provides this value as an argument
|
|
2327
|
-
* instead of an array value.
|
|
2328
|
-
*/
|
|
2329
|
-
reduce(callbackfn: (previousValue: bigint, currentValue: bigint, currentIndex: number, array: BigInt64Array$1) => bigint): bigint;
|
|
2330
|
-
/**
|
|
2331
|
-
* Calls the specified callback function for all the elements in an array. The return value of
|
|
2332
|
-
* the callback function is the accumulated result, and is provided as an argument in the next
|
|
2333
|
-
* call to the callback function.
|
|
2334
|
-
* @param callbackfn A function that accepts up to four arguments. The reduce method calls the
|
|
2335
|
-
* callbackfn function one time for each element in the array.
|
|
2336
|
-
* @param initialValue If initialValue is specified, it is used as the initial value to start
|
|
2337
|
-
* the accumulation. The first call to the callbackfn function provides this value as an argument
|
|
2338
|
-
* instead of an array value.
|
|
2339
|
-
*/
|
|
2340
|
-
reduce<U>(callbackfn: (previousValue: U, currentValue: bigint, currentIndex: number, array: BigInt64Array$1) => U, initialValue: U): U;
|
|
2341
|
-
/**
|
|
2342
|
-
* Calls the specified callback function for all the elements in an array, in descending order.
|
|
2343
|
-
* The return value of the callback function is the accumulated result, and is provided as an
|
|
2344
|
-
* argument in the next call to the callback function.
|
|
2345
|
-
* @param callbackfn A function that accepts up to four arguments. The reduceRight method calls
|
|
2346
|
-
* the callbackfn function one time for each element in the array.
|
|
2347
|
-
* @param initialValue If initialValue is specified, it is used as the initial value to start
|
|
2348
|
-
* the accumulation. The first call to the callbackfn function provides this value as an
|
|
2349
|
-
* argument instead of an array value.
|
|
2350
|
-
*/
|
|
2351
|
-
reduceRight(callbackfn: (previousValue: bigint, currentValue: bigint, currentIndex: number, array: BigInt64Array$1) => bigint): bigint;
|
|
2352
|
-
/**
|
|
2353
|
-
* Calls the specified callback function for all the elements in an array, in descending order.
|
|
2354
|
-
* The return value of the callback function is the accumulated result, and is provided as an
|
|
2355
|
-
* argument in the next call to the callback function.
|
|
2356
|
-
* @param callbackfn A function that accepts up to four arguments. The reduceRight method calls
|
|
2357
|
-
* the callbackfn function one time for each element in the array.
|
|
2358
|
-
* @param initialValue If initialValue is specified, it is used as the initial value to start
|
|
2359
|
-
* the accumulation. The first call to the callbackfn function provides this value as an argument
|
|
2360
|
-
* instead of an array value.
|
|
2361
|
-
*/
|
|
2362
|
-
reduceRight<U>(callbackfn: (previousValue: U, currentValue: bigint, currentIndex: number, array: BigInt64Array$1) => U, initialValue: U): U;
|
|
2363
|
-
/** Reverses the elements in the array. */
|
|
2364
|
-
reverse(): this;
|
|
2365
|
-
/**
|
|
2366
|
-
* Sets a value or an array of values.
|
|
2367
|
-
* @param array A typed or untyped array of values to set.
|
|
2368
|
-
* @param offset The index in the current array at which the values are to be written.
|
|
2369
|
-
*/
|
|
2370
|
-
set(array: ArrayLike<bigint>, offset?: number): void;
|
|
2371
|
-
/**
|
|
2372
|
-
* Returns a section of an array.
|
|
2373
|
-
* @param start The beginning of the specified portion of the array.
|
|
2374
|
-
* @param end The end of the specified portion of the array.
|
|
2375
|
-
*/
|
|
2376
|
-
slice(start?: number, end?: number): BigInt64Array$1;
|
|
2377
|
-
/**
|
|
2378
|
-
* Determines whether the specified callback function returns true for any element of an array.
|
|
2379
|
-
* @param predicate A function that accepts up to three arguments. The some method calls the
|
|
2380
|
-
* predicate function for each element in the array until the predicate returns true, or until
|
|
2381
|
-
* the end of the array.
|
|
2382
|
-
* @param thisArg An object to which the this keyword can refer in the predicate function.
|
|
2383
|
-
* If thisArg is omitted, undefined is used as the this value.
|
|
2384
|
-
*/
|
|
2385
|
-
some(predicate: (value: bigint, index: number, array: BigInt64Array$1) => boolean, thisArg?: any): boolean;
|
|
2386
|
-
/**
|
|
2387
|
-
* Sorts the array.
|
|
2388
|
-
* @param compareFn The function used to determine the order of the elements. If omitted, the elements are sorted in ascending order.
|
|
2389
|
-
*/
|
|
2390
|
-
sort(compareFn?: (a: bigint, b: bigint) => number | bigint): this;
|
|
2391
|
-
/**
|
|
2392
|
-
* Gets a new BigInt64Array view of the ArrayBuffer store for this array, referencing the elements
|
|
2393
|
-
* at begin, inclusive, up to end, exclusive.
|
|
2394
|
-
* @param begin The index of the beginning of the array.
|
|
2395
|
-
* @param end The index of the end of the array.
|
|
2396
|
-
*/
|
|
2397
|
-
subarray(begin?: number, end?: number): BigInt64Array$1;
|
|
2398
|
-
/** Converts the array to a string by using the current locale. */
|
|
2399
|
-
toLocaleString(locales?: string | string[], options?: Intl.NumberFormatOptions): string;
|
|
2400
|
-
/** Returns a string representation of the array. */
|
|
2401
|
-
toString(): string;
|
|
2402
|
-
/** Returns the primitive value of the specified object. */
|
|
2403
|
-
valueOf(): BigInt64Array$1;
|
|
2404
|
-
/** Yields each value in the array. */
|
|
2405
|
-
values(): IterableIterator<bigint>;
|
|
2406
|
-
[Symbol.iterator](): IterableIterator<bigint>;
|
|
2407
|
-
readonly [Symbol.toStringTag]: "BigInt64Array";
|
|
2408
|
-
[index: number]: bigint;
|
|
2409
|
-
}
|
|
2410
|
-
/**
|
|
2411
|
-
* A typed array of 64-bit unsigned integer values. The contents are initialized to 0. If the
|
|
2412
|
-
* requested number of bytes could not be allocated, an exception is raised.
|
|
2413
|
-
*/
|
|
2414
|
-
interface BigUint64Array$1 {
|
|
2415
|
-
/** The size in bytes of each element in the array. */
|
|
2416
|
-
readonly BYTES_PER_ELEMENT: number;
|
|
2417
|
-
/** The ArrayBuffer instance referenced by the array. */
|
|
2418
|
-
readonly buffer: ArrayBufferLike;
|
|
2419
|
-
/** The length in bytes of the array. */
|
|
2420
|
-
readonly byteLength: number;
|
|
2421
|
-
/** The offset in bytes of the array. */
|
|
2422
|
-
readonly byteOffset: number;
|
|
2423
|
-
/**
|
|
2424
|
-
* Returns the this object after copying a section of the array identified by start and end
|
|
2425
|
-
* to the same array starting at position target
|
|
2426
|
-
* @param target If target is negative, it is treated as length+target where length is the
|
|
2427
|
-
* length of the array.
|
|
2428
|
-
* @param start If start is negative, it is treated as length+start. If end is negative, it
|
|
2429
|
-
* is treated as length+end.
|
|
2430
|
-
* @param end If not specified, length of the this object is used as its default value.
|
|
2431
|
-
*/
|
|
2432
|
-
copyWithin(target: number, start: number, end?: number): this;
|
|
2433
|
-
/** Yields index, value pairs for every entry in the array. */
|
|
2434
|
-
entries(): IterableIterator<[number, bigint]>;
|
|
2435
|
-
/**
|
|
2436
|
-
* Determines whether all the members of an array satisfy the specified test.
|
|
2437
|
-
* @param predicate A function that accepts up to three arguments. The every method calls
|
|
2438
|
-
* the predicate function for each element in the array until the predicate returns false,
|
|
2439
|
-
* or until the end of the array.
|
|
2440
|
-
* @param thisArg An object to which the this keyword can refer in the predicate function.
|
|
2441
|
-
* If thisArg is omitted, undefined is used as the this value.
|
|
2442
|
-
*/
|
|
2443
|
-
every(predicate: (value: bigint, index: number, array: BigUint64Array$1) => boolean, thisArg?: any): boolean;
|
|
2444
|
-
/**
|
|
2445
|
-
* Changes all array elements from `start` to `end` index to a static `value` and returns the modified array
|
|
2446
|
-
* @param value value to fill array section with
|
|
2447
|
-
* @param start index to start filling the array at. If start is negative, it is treated as
|
|
2448
|
-
* length+start where length is the length of the array.
|
|
2449
|
-
* @param end index to stop filling the array at. If end is negative, it is treated as
|
|
2450
|
-
* length+end.
|
|
2451
|
-
*/
|
|
2452
|
-
fill(value: bigint, start?: number, end?: number): this;
|
|
2453
|
-
/**
|
|
2454
|
-
* Returns the elements of an array that meet the condition specified in a callback function.
|
|
2455
|
-
* @param predicate A function that accepts up to three arguments. The filter method calls
|
|
2456
|
-
* the predicate function one time for each element in the array.
|
|
2457
|
-
* @param thisArg An object to which the this keyword can refer in the predicate function.
|
|
2458
|
-
* If thisArg is omitted, undefined is used as the this value.
|
|
2459
|
-
*/
|
|
2460
|
-
filter(predicate: (value: bigint, index: number, array: BigUint64Array$1) => any, thisArg?: any): BigUint64Array$1;
|
|
2461
|
-
/**
|
|
2462
|
-
* Returns the value of the first element in the array where predicate is true, and undefined
|
|
2463
|
-
* otherwise.
|
|
2464
|
-
* @param predicate find calls predicate once for each element of the array, in ascending
|
|
2465
|
-
* order, until it finds one where predicate returns true. If such an element is found, find
|
|
2466
|
-
* immediately returns that element value. Otherwise, find returns undefined.
|
|
2467
|
-
* @param thisArg If provided, it will be used as the this value for each invocation of
|
|
2468
|
-
* predicate. If it is not provided, undefined is used instead.
|
|
2469
|
-
*/
|
|
2470
|
-
find(predicate: (value: bigint, index: number, array: BigUint64Array$1) => boolean, thisArg?: any): bigint | undefined;
|
|
2471
|
-
/**
|
|
2472
|
-
* Returns the index of the first element in the array where predicate is true, and -1
|
|
2473
|
-
* otherwise.
|
|
2474
|
-
* @param predicate find calls predicate once for each element of the array, in ascending
|
|
2475
|
-
* order, until it finds one where predicate returns true. If such an element is found,
|
|
2476
|
-
* findIndex immediately returns that element index. Otherwise, findIndex returns -1.
|
|
2477
|
-
* @param thisArg If provided, it will be used as the this value for each invocation of
|
|
2478
|
-
* predicate. If it is not provided, undefined is used instead.
|
|
2479
|
-
*/
|
|
2480
|
-
findIndex(predicate: (value: bigint, index: number, array: BigUint64Array$1) => boolean, thisArg?: any): number;
|
|
2481
|
-
/**
|
|
2482
|
-
* Performs the specified action for each element in an array.
|
|
2483
|
-
* @param callbackfn A function that accepts up to three arguments. forEach calls the
|
|
2484
|
-
* callbackfn function one time for each element in the array.
|
|
2485
|
-
* @param thisArg An object to which the this keyword can refer in the callbackfn function.
|
|
2486
|
-
* If thisArg is omitted, undefined is used as the this value.
|
|
2487
|
-
*/
|
|
2488
|
-
forEach(callbackfn: (value: bigint, index: number, array: BigUint64Array$1) => void, thisArg?: any): void;
|
|
2489
|
-
/**
|
|
2490
|
-
* Determines whether an array includes a certain element, returning true or false as appropriate.
|
|
2491
|
-
* @param searchElement The element to search for.
|
|
2492
|
-
* @param fromIndex The position in this array at which to begin searching for searchElement.
|
|
2493
|
-
*/
|
|
2494
|
-
includes(searchElement: bigint, fromIndex?: number): boolean;
|
|
2495
|
-
/**
|
|
2496
|
-
* Returns the index of the first occurrence of a value in an array.
|
|
2497
|
-
* @param searchElement The value to locate in the array.
|
|
2498
|
-
* @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the
|
|
2499
|
-
* search starts at index 0.
|
|
2500
|
-
*/
|
|
2501
|
-
indexOf(searchElement: bigint, fromIndex?: number): number;
|
|
2502
|
-
/**
|
|
2503
|
-
* Adds all the elements of an array separated by the specified separator string.
|
|
2504
|
-
* @param separator A string used to separate one element of an array from the next in the
|
|
2505
|
-
* resulting String. If omitted, the array elements are separated with a comma.
|
|
2506
|
-
*/
|
|
2507
|
-
join(separator?: string): string;
|
|
2508
|
-
/** Yields each index in the array. */
|
|
2509
|
-
keys(): IterableIterator<number>;
|
|
2510
|
-
/**
|
|
2511
|
-
* Returns the index of the last occurrence of a value in an array.
|
|
2512
|
-
* @param searchElement The value to locate in the array.
|
|
2513
|
-
* @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the
|
|
2514
|
-
* search starts at index 0.
|
|
2515
|
-
*/
|
|
2516
|
-
lastIndexOf(searchElement: bigint, fromIndex?: number): number;
|
|
2517
|
-
/** The length of the array. */
|
|
2518
|
-
readonly length: number;
|
|
2519
|
-
/**
|
|
2520
|
-
* Calls a defined callback function on each element of an array, and returns an array that
|
|
2521
|
-
* contains the results.
|
|
2522
|
-
* @param callbackfn A function that accepts up to three arguments. The map method calls the
|
|
2523
|
-
* callbackfn function one time for each element in the array.
|
|
2524
|
-
* @param thisArg An object to which the this keyword can refer in the callbackfn function.
|
|
2525
|
-
* If thisArg is omitted, undefined is used as the this value.
|
|
2526
|
-
*/
|
|
2527
|
-
map(callbackfn: (value: bigint, index: number, array: BigUint64Array$1) => bigint, thisArg?: any): BigUint64Array$1;
|
|
2528
|
-
/**
|
|
2529
|
-
* Calls the specified callback function for all the elements in an array. The return value of
|
|
2530
|
-
* the callback function is the accumulated result, and is provided as an argument in the next
|
|
2531
|
-
* call to the callback function.
|
|
2532
|
-
* @param callbackfn A function that accepts up to four arguments. The reduce method calls the
|
|
2533
|
-
* callbackfn function one time for each element in the array.
|
|
2534
|
-
* @param initialValue If initialValue is specified, it is used as the initial value to start
|
|
2535
|
-
* the accumulation. The first call to the callbackfn function provides this value as an argument
|
|
2536
|
-
* instead of an array value.
|
|
2537
|
-
*/
|
|
2538
|
-
reduce(callbackfn: (previousValue: bigint, currentValue: bigint, currentIndex: number, array: BigUint64Array$1) => bigint): bigint;
|
|
2539
|
-
/**
|
|
2540
|
-
* Calls the specified callback function for all the elements in an array. The return value of
|
|
2541
|
-
* the callback function is the accumulated result, and is provided as an argument in the next
|
|
2542
|
-
* call to the callback function.
|
|
2543
|
-
* @param callbackfn A function that accepts up to four arguments. The reduce method calls the
|
|
2544
|
-
* callbackfn function one time for each element in the array.
|
|
2545
|
-
* @param initialValue If initialValue is specified, it is used as the initial value to start
|
|
2546
|
-
* the accumulation. The first call to the callbackfn function provides this value as an argument
|
|
2547
|
-
* instead of an array value.
|
|
2548
|
-
*/
|
|
2549
|
-
reduce<U>(callbackfn: (previousValue: U, currentValue: bigint, currentIndex: number, array: BigUint64Array$1) => U, initialValue: U): U;
|
|
2550
|
-
/**
|
|
2551
|
-
* Calls the specified callback function for all the elements in an array, in descending order.
|
|
2552
|
-
* The return value of the callback function is the accumulated result, and is provided as an
|
|
2553
|
-
* argument in the next call to the callback function.
|
|
2554
|
-
* @param callbackfn A function that accepts up to four arguments. The reduceRight method calls
|
|
2555
|
-
* the callbackfn function one time for each element in the array.
|
|
2556
|
-
* @param initialValue If initialValue is specified, it is used as the initial value to start
|
|
2557
|
-
* the accumulation. The first call to the callbackfn function provides this value as an
|
|
2558
|
-
* argument instead of an array value.
|
|
2559
|
-
*/
|
|
2560
|
-
reduceRight(callbackfn: (previousValue: bigint, currentValue: bigint, currentIndex: number, array: BigUint64Array$1) => bigint): bigint;
|
|
2561
|
-
/**
|
|
2562
|
-
* Calls the specified callback function for all the elements in an array, in descending order.
|
|
2563
|
-
* The return value of the callback function is the accumulated result, and is provided as an
|
|
2564
|
-
* argument in the next call to the callback function.
|
|
2565
|
-
* @param callbackfn A function that accepts up to four arguments. The reduceRight method calls
|
|
2566
|
-
* the callbackfn function one time for each element in the array.
|
|
2567
|
-
* @param initialValue If initialValue is specified, it is used as the initial value to start
|
|
2568
|
-
* the accumulation. The first call to the callbackfn function provides this value as an argument
|
|
2569
|
-
* instead of an array value.
|
|
2570
|
-
*/
|
|
2571
|
-
reduceRight<U>(callbackfn: (previousValue: U, currentValue: bigint, currentIndex: number, array: BigUint64Array$1) => U, initialValue: U): U;
|
|
2572
|
-
/** Reverses the elements in the array. */
|
|
2573
|
-
reverse(): this;
|
|
2574
|
-
/**
|
|
2575
|
-
* Sets a value or an array of values.
|
|
2576
|
-
* @param array A typed or untyped array of values to set.
|
|
2577
|
-
* @param offset The index in the current array at which the values are to be written.
|
|
2578
|
-
*/
|
|
2579
|
-
set(array: ArrayLike<bigint>, offset?: number): void;
|
|
2580
|
-
/**
|
|
2581
|
-
* Returns a section of an array.
|
|
2582
|
-
* @param start The beginning of the specified portion of the array.
|
|
2583
|
-
* @param end The end of the specified portion of the array.
|
|
2584
|
-
*/
|
|
2585
|
-
slice(start?: number, end?: number): BigUint64Array$1;
|
|
2586
|
-
/**
|
|
2587
|
-
* Determines whether the specified callback function returns true for any element of an array.
|
|
2588
|
-
* @param predicate A function that accepts up to three arguments. The some method calls the
|
|
2589
|
-
* predicate function for each element in the array until the predicate returns true, or until
|
|
2590
|
-
* the end of the array.
|
|
2591
|
-
* @param thisArg An object to which the this keyword can refer in the predicate function.
|
|
2592
|
-
* If thisArg is omitted, undefined is used as the this value.
|
|
2593
|
-
*/
|
|
2594
|
-
some(predicate: (value: bigint, index: number, array: BigUint64Array$1) => boolean, thisArg?: any): boolean;
|
|
2595
|
-
/**
|
|
2596
|
-
* Sorts the array.
|
|
2597
|
-
* @param compareFn The function used to determine the order of the elements. If omitted, the elements are sorted in ascending order.
|
|
2598
|
-
*/
|
|
2599
|
-
sort(compareFn?: (a: bigint, b: bigint) => number | bigint): this;
|
|
2600
|
-
/**
|
|
2601
|
-
* Gets a new BigUint64Array view of the ArrayBuffer store for this array, referencing the elements
|
|
2602
|
-
* at begin, inclusive, up to end, exclusive.
|
|
2603
|
-
* @param begin The index of the beginning of the array.
|
|
2604
|
-
* @param end The index of the end of the array.
|
|
2605
|
-
*/
|
|
2606
|
-
subarray(begin?: number, end?: number): BigUint64Array$1;
|
|
2607
|
-
/** Converts the array to a string by using the current locale. */
|
|
2608
|
-
toLocaleString(locales?: string | string[], options?: Intl.NumberFormatOptions): string;
|
|
2609
|
-
/** Returns a string representation of the array. */
|
|
2610
|
-
toString(): string;
|
|
2611
|
-
/** Returns the primitive value of the specified object. */
|
|
2612
|
-
valueOf(): BigUint64Array$1;
|
|
2613
|
-
/** Yields each value in the array. */
|
|
2614
|
-
values(): IterableIterator<bigint>;
|
|
2615
|
-
[Symbol.iterator](): IterableIterator<bigint>;
|
|
2616
|
-
readonly [Symbol.toStringTag]: "BigUint64Array";
|
|
2617
|
-
[index: number]: bigint;
|
|
2618
|
-
}
|
|
2619
|
-
interface BigIntToLocaleStringOptions {
|
|
2620
|
-
/**
|
|
2621
|
-
* The locale matching algorithm to use.The default is "best fit". For information about this option, see the {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_negotiation Intl page}.
|
|
2622
|
-
*/
|
|
2623
|
-
localeMatcher?: string;
|
|
2624
|
-
/**
|
|
2625
|
-
* The formatting style to use , the default is "decimal".
|
|
2626
|
-
*/
|
|
2627
|
-
style?: string;
|
|
2628
|
-
numberingSystem?: string;
|
|
2629
|
-
/**
|
|
2630
|
-
* The unit to use in unit formatting, Possible values are core unit identifiers, defined in UTS #35, Part 2, Section 6. A subset of units from the full list was selected for use in ECMAScript. Pairs of simple units can be concatenated with "-per-" to make a compound unit. There is no default value; if the style is "unit", the unit property must be provided.
|
|
2631
|
-
*/
|
|
2632
|
-
unit?: string;
|
|
2633
|
-
/**
|
|
2634
|
-
* The unit formatting style to use in unit formatting, the defaults is "short".
|
|
2635
|
-
*/
|
|
2636
|
-
unitDisplay?: string;
|
|
2637
|
-
/**
|
|
2638
|
-
* The currency to use in currency formatting. Possible values are the ISO 4217 currency codes, such as "USD" for the US dollar, "EUR" for the euro, or "CNY" for the Chinese RMB — see the Current currency & funds code list. There is no default value; if the style is "currency", the currency property must be provided. It is only used when [[Style]] has the value "currency".
|
|
2639
|
-
*/
|
|
2640
|
-
currency?: string;
|
|
2641
|
-
/**
|
|
2642
|
-
* How to display the currency in currency formatting. It is only used when [[Style]] has the value "currency". The default is "symbol".
|
|
2643
|
-
*
|
|
2644
|
-
* "symbol" to use a localized currency symbol such as €,
|
|
2645
|
-
*
|
|
2646
|
-
* "code" to use the ISO currency code,
|
|
2647
|
-
*
|
|
2648
|
-
* "name" to use a localized currency name such as "dollar"
|
|
2649
|
-
*/
|
|
2650
|
-
currencyDisplay?: string;
|
|
2651
|
-
/**
|
|
2652
|
-
* Whether to use grouping separators, such as thousands separators or thousand/lakh/crore separators. The default is true.
|
|
2653
|
-
*/
|
|
2654
|
-
useGrouping?: boolean;
|
|
2655
|
-
/**
|
|
2656
|
-
* The minimum number of integer digits to use. Possible values are from 1 to 21; the default is 1.
|
|
2657
|
-
*/
|
|
2658
|
-
minimumIntegerDigits?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21;
|
|
2659
|
-
/**
|
|
2660
|
-
* The minimum number of fraction digits to use. Possible values are from 0 to 20; the default for plain number and percent formatting is 0; the default for currency formatting is the number of minor unit digits provided by the {@link http://www.currency-iso.org/en/home/tables/table-a1.html ISO 4217 currency codes list} (2 if the list doesn't provide that information).
|
|
2661
|
-
*/
|
|
2662
|
-
minimumFractionDigits?: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20;
|
|
2663
|
-
/**
|
|
2664
|
-
* The maximum number of fraction digits to use. Possible values are from 0 to 20; the default for plain number formatting is the larger of minimumFractionDigits and 3; the default for currency formatting is the larger of minimumFractionDigits and the number of minor unit digits provided by the {@link http://www.currency-iso.org/en/home/tables/table-a1.html ISO 4217 currency codes list} (2 if the list doesn't provide that information); the default for percent formatting is the larger of minimumFractionDigits and 0.
|
|
2665
|
-
*/
|
|
2666
|
-
maximumFractionDigits?: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20;
|
|
2667
|
-
/**
|
|
2668
|
-
* The minimum number of significant digits to use. Possible values are from 1 to 21; the default is 1.
|
|
2669
|
-
*/
|
|
2670
|
-
minimumSignificantDigits?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21;
|
|
2671
|
-
/**
|
|
2672
|
-
* The maximum number of significant digits to use. Possible values are from 1 to 21; the default is 21.
|
|
2673
|
-
*/
|
|
2674
|
-
maximumSignificantDigits?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21;
|
|
2675
|
-
/**
|
|
2676
|
-
* The formatting that should be displayed for the number, the defaults is "standard"
|
|
2677
|
-
*
|
|
2678
|
-
* "standard" plain number formatting
|
|
2679
|
-
*
|
|
2680
|
-
* "scientific" return the order-of-magnitude for formatted number.
|
|
2681
|
-
*
|
|
2682
|
-
* "engineering" return the exponent of ten when divisible by three
|
|
2683
|
-
*
|
|
2684
|
-
* "compact" string representing exponent, defaults is using the "short" form
|
|
2685
|
-
*/
|
|
2686
|
-
notation?: string;
|
|
2687
|
-
/**
|
|
2688
|
-
* used only when notation is "compact"
|
|
2689
|
-
*/
|
|
2690
|
-
compactDisplay?: string;
|
|
2691
|
-
}
|
|
2692
|
-
/**
|
|
2693
|
-
* The `Any` class does not exist at runtime. It's used in type
|
|
2694
|
-
* definitions to detect an `any` type.
|
|
2695
|
-
*
|
|
2696
|
-
* ```ts
|
|
2697
|
-
* type IsAny<T> = [T] extends [Any] ? 'is any' : 'is not any'
|
|
2698
|
-
* ```
|
|
2699
|
-
*/
|
|
2700
|
-
declare class Any {
|
|
2701
|
-
private any;
|
|
2702
|
-
}
|
|
2703
|
-
/**
|
|
2704
|
-
* Represents a class constructor.
|
|
2705
|
-
*/
|
|
2706
|
-
/**
|
|
2707
|
-
* Get all properties **not using** the `?:` type operator.
|
|
2708
|
-
*/
|
|
2709
|
-
type RequiredKeys<T> = T extends any ? keyof T extends infer K ? K extends keyof T ? Omit<T, K> extends T ? never : K : never : never : never;
|
|
2710
|
-
/**
|
|
2711
|
-
* Get all properties using the `?:` type operator.
|
|
2712
|
-
*/
|
|
2713
|
-
type OptionalKeys<T> = T extends any ? keyof T extends infer K ? K extends keyof T ? Omit<T, K> extends T ? K : never : never : never : never;
|
|
2714
|
-
/**
|
|
2715
|
-
* Resolves to `true` if `Left` and `Right` are exactly the same type.
|
|
2716
|
-
*
|
|
2717
|
-
* Otherwise false.
|
|
2718
|
-
*/
|
|
2719
|
-
type IsExactType<Left, Right> = [Left] extends [Any] ? [Right] extends [Any] ? true : false : (<U>() => U extends Left ? 1 : 0) extends (<U>() => U extends Right ? 1 : 0) ? true : false;
|
|
2720
|
-
type Primitive = number | string | boolean | symbol | bigint | null | undefined | void;
|
|
2721
|
-
/**
|
|
2722
|
-
* Coerce a primitive type to its boxed equivalent.
|
|
2723
|
-
*
|
|
2724
|
-
* @example
|
|
2725
|
-
* ```ts
|
|
2726
|
-
* type A = BoxedPrimitive<string>
|
|
2727
|
-
* // ^? String
|
|
2728
|
-
* type B = BoxedPrimitive<number>
|
|
2729
|
-
* // ^? Number
|
|
2730
|
-
* ```
|
|
2731
|
-
*/
|
|
2732
|
-
type BoxedPrimitive<T = any> = T extends string ? String : T extends number ? Number : T extends boolean ? Boolean : T extends bigint ? BigInt : T extends symbol ? Symbol : never;
|
|
2733
|
-
type TypedArray$1 = Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array | BigInt64Array$1 | BigUint64Array$1 | DataView | ArrayBuffer | SharedArrayBuffer;
|
|
2734
|
-
/**
|
|
2735
|
-
* Add your own classes to this registry by extending its interface
|
|
2736
|
-
* with what's called “declaration merging” in TypeScript.
|
|
2737
|
-
*
|
|
2738
|
-
* All property types in this registry type may be treated specially
|
|
2739
|
-
* by any of Radashi's complex types. For example, `assign` will avoid
|
|
2740
|
-
* merging with types in this registry.
|
|
2741
|
-
*/
|
|
2742
|
-
interface CustomClassRegistry {}
|
|
2743
|
-
/**
|
|
2744
|
-
* This type represents any custom class that was "registered" through
|
|
2745
|
-
* the `CustomClassRegistry` type.
|
|
2746
|
-
*/
|
|
2747
|
-
type CustomClass = CustomClassRegistry[keyof CustomClassRegistry];
|
|
2748
|
-
/**
|
|
2749
|
-
* These types are implemented natively.
|
|
2750
|
-
*
|
|
2751
|
-
* Note that boxed primitives like `Boolean` (different from
|
|
2752
|
-
* `boolean`) are not included, because `boolean extends Boolean ? 1 :
|
|
2753
|
-
* 0` resolves to 1.
|
|
2754
|
-
*/
|
|
2755
|
-
type BuiltInType = ES2021.BuiltInType | WebAPI.BuiltInType | NodeJS.BuiltInType;
|
|
2756
|
-
declare namespace ES2020 {
|
|
2757
|
-
type BuiltInType = Primitive | Promise<any> | Date | RegExp | Error | readonly any[] | ReadonlyMap<any, any> | ReadonlySet<any> | WeakMap<WeakKey, any> | WeakSet<WeakKey> | TypedArray$1 | Function;
|
|
2758
|
-
}
|
|
2759
|
-
declare namespace ES2021 {
|
|
2760
|
-
type BuiltInType = ES2020.BuiltInType | GlobalObjectType<'FinalizationRegistry'> | GlobalObjectType<'WeakRef'>;
|
|
2761
|
-
}
|
|
2762
|
-
declare namespace NodeJS {
|
|
2763
|
-
type BuiltInType = GlobalObjectType<'Buffer'>;
|
|
2764
|
-
}
|
|
2765
|
-
declare namespace WebAPI {
|
|
2766
|
-
type BuiltInType = GlobalObjectType<'AbortController'> | GlobalObjectType<'AbortSignal'> | GlobalObjectType<'Blob'> | GlobalObjectType<'Body'> | GlobalObjectType<'CompressionStream'> | GlobalObjectType<'Crypto'> | GlobalObjectType<'CustomEvent'> | GlobalObjectType<'DecompressionStream'> | GlobalObjectType<'Event'> | GlobalObjectType<'EventTarget'> | GlobalObjectType<'FormData'> | GlobalObjectType<'Headers'> | GlobalObjectType<'MessageChannel'> | GlobalObjectType<'Navigator'> | GlobalObjectType<'ReadableStream'> | GlobalObjectType<'ReadableStreamBYOBReader'> | GlobalObjectType<'ReadableStreamDefaultController'> | GlobalObjectType<'ReadableStreamDefaultReader'> | GlobalObjectType<'SubtleCrypto'> | GlobalObjectType<'TextDecoder'> | GlobalObjectType<'TextDecoderStream'> | GlobalObjectType<'TextEncoder'> | GlobalObjectType<'TextEncoderStream'> | GlobalObjectType<'TransformStream'> | GlobalObjectType<'TransformStreamDefaultController'> | GlobalObjectType<'URL'> | GlobalObjectType<'URLSearchParams'> | GlobalObjectType<'WebSocket'> | GlobalObjectType<'WritableStream'> | GlobalObjectType<'WritableStreamDefaultController'> | GlobalObjectType<'WritableStreamDefaultWriter'> | WebDocumentAPI.BuiltInType;
|
|
2767
|
-
}
|
|
2768
|
-
declare namespace WebDocumentAPI {
|
|
2769
|
-
type BuiltInType = GlobalObjectType<'Node'> | GlobalObjectType<'NodeList'> | GlobalObjectType<'NodeIterator'> | GlobalObjectType<'HTMLCollection'> | GlobalObjectType<'CSSStyleDeclaration'> | GlobalObjectType<'DOMStringList'> | GlobalObjectType<'DOMTokenList'>;
|
|
2770
|
-
}
|
|
2771
|
-
type GlobalObjectType<Identifier extends string> = [Identifier] extends [Any] ? never : keyof Identifier extends never ? never : typeof globalThis extends { [P in Identifier]: any } ? InstanceType<(typeof globalThis)[Identifier]> : never;
|
|
2772
|
-
/**
|
|
2773
|
-
* Converts a `PromiseLike` to a `Promise<Result>`.
|
|
2774
|
-
*
|
|
2775
|
-
* Note: If the given promise throws a non-Error value, it will be
|
|
2776
|
-
* rethrown.
|
|
2777
|
-
*
|
|
2778
|
-
* @see https://radashi.js.org/reference/async/toResult
|
|
2779
|
-
* @example
|
|
2780
|
-
* ```ts
|
|
2781
|
-
* import { toResult, Result } from 'radashi'
|
|
2782
|
-
*
|
|
2783
|
-
* const good = async (): Promise<number> => 1
|
|
2784
|
-
* const bad = async (): Promise<number> => { throw new Error('bad') }
|
|
2785
|
-
*
|
|
2786
|
-
* const goodResult = await toResult(good())
|
|
2787
|
-
* // => [undefined, 1]
|
|
2788
|
-
*
|
|
2789
|
-
* const badResult = await toResult(bad())
|
|
2790
|
-
* // => [Error('bad'), undefined]
|
|
2791
|
-
* ```
|
|
2792
|
-
* @version 12.4.0
|
|
2793
|
-
*/
|
|
2794
|
-
/**
|
|
2795
|
-
* The return type for `assign`.
|
|
2796
|
-
*
|
|
2797
|
-
* It recursively merges object types that are not native objects. The
|
|
2798
|
-
* root objects are always merged.
|
|
2799
|
-
*
|
|
2800
|
-
* @see https://radashi.js.org/reference/object/assign
|
|
2801
|
-
*/
|
|
2802
|
-
type Assign<TInitial extends object, TOverride extends object> = TInitial extends any ? TOverride extends any ? SimplifyMutable<Omit<TInitial, keyof TOverride> & Omit<TOverride, keyof TInitial> & (Pick<TInitial, keyof TInitial & keyof TOverride> extends infer TConflictInitial ? Pick<TOverride, keyof TInitial & keyof TOverride> extends infer TConflictOverride ? { [K in RequiredKeys<TConflictOverride>]: AssignDeep<TConflictInitial[K & keyof TConflictInitial], TConflictOverride[K]> } & { [K in RequiredKeys<TConflictInitial> & OptionalKeys<TConflictOverride>]: AssignDeep<TConflictInitial[K], TConflictOverride[K], true> } & { [K in OptionalKeys<TConflictInitial> & OptionalKeys<TConflictOverride>]?: AssignDeep<TConflictInitial[K], TConflictOverride[K], true> } : unknown : unknown)> : never : never;
|
|
2803
|
-
/**
|
|
2804
|
-
* Mimic the `Simplify` type and also remove `readonly` modifiers.
|
|
2805
|
-
*/
|
|
2806
|
-
type SimplifyMutable<T> = {} & { -readonly [P in keyof T]: T[P] };
|
|
2807
|
-
/**
|
|
2808
|
-
* This represents a value that should only be replaced if it exists
|
|
2809
|
-
* as an initial value; never deeply assigned into.
|
|
2810
|
-
*/
|
|
2811
|
-
type AtomicValue = BuiltInType | CustomClass | BoxedPrimitive;
|
|
2812
|
-
/**
|
|
2813
|
-
* Handle mixed types when merging nested plain objects.
|
|
2814
|
-
*
|
|
2815
|
-
* For example, if the type `TOverride` includes both `string` and `{ n:
|
|
2816
|
-
* number }` in a union, `AssignDeep` will treat `string` as
|
|
2817
|
-
* unmergeable and `{ n: number }` as mergeable.
|
|
2818
|
-
*/
|
|
2819
|
-
type AssignDeep<TInitial, TOverride, IsOptional = false> = never
|
|
2820
|
-
/**
|
|
2821
|
-
* When a native type is found in TInitial, it will only exist in
|
|
2822
|
-
* the result type if the override is optional.
|
|
2823
|
-
*/
|
|
2824
|
-
| (TInitial extends AtomicValue ? IsOptional extends true ? TInitial : never : never)
|
|
2825
|
-
/**
|
|
2826
|
-
* When a native type is found in TOverride, it will always exists
|
|
2827
|
-
* in the result type.
|
|
2828
|
-
*/
|
|
2829
|
-
| (TOverride extends AtomicValue ? TOverride : never)
|
|
2830
|
-
/**
|
|
2831
|
-
* Deep assignment is handled in this branch.
|
|
2832
|
-
*
|
|
2833
|
-
* 1. Exclude any native types from TInitial and TOverride
|
|
2834
|
-
* 2. If a non-native object type is not found in TInitial, simply
|
|
2835
|
-
* replace TInitial (or use "A | B" if the override is optional)
|
|
2836
|
-
* 3. For each non-native object type in TOverride, deep assign to
|
|
2837
|
-
* every non-native object in TInitial
|
|
2838
|
-
* 4. For each non-object type in TOverride, simply replace TInitial
|
|
2839
|
-
* (or use "A | B" if the override is optional)
|
|
2840
|
-
*/
|
|
2841
|
-
| (Exclude<TOverride, AtomicValue> extends infer TOverride ? Exclude<TInitial, Exclude<AtomicValue, void>> extends infer TInitial ? [Extract<TInitial, object>] extends [never] ? TOverride | (IsOptional extends true ? TInitial : never) : TInitial extends object ? TOverride extends object ? IsExactType<TOverride, TInitial> extends true ? TOverride : Assign<TInitial, TOverride> : // 4.
|
|
2842
|
-
TOverride | (IsOptional extends true ? TInitial : never) : Extract<TOverride, object> | (IsOptional extends true ? TInitial : never) : never : never);
|
|
2843
|
-
/**
|
|
2844
|
-
* Creates a shallow copy of the given object/value.
|
|
2845
|
-
*
|
|
2846
|
-
* @see https://radashi.js.org/reference/object/clone
|
|
2847
|
-
* @example
|
|
2848
|
-
* ```ts
|
|
2849
|
-
* const original = { a: 1, b: { c: 3 } }
|
|
2850
|
-
* const cloned = clone(original)
|
|
2851
|
-
* // => { a: 1, b: { c: 3 } }
|
|
2852
|
-
* original !== cloned
|
|
2853
|
-
* // => true
|
|
2854
|
-
* original.b === cloned.b
|
|
2855
|
-
* // => true
|
|
2856
|
-
* ```
|
|
2857
|
-
* @version 12.1.0
|
|
2858
|
-
*/
|
|
2859
|
-
//#endregion
|
|
2860
|
-
//#region src/utils/object/objectAssign.d.ts
|
|
2861
|
-
/**
|
|
2862
|
-
* 递归地将第二个对象合并到第一个对象的副本中
|
|
2863
|
-
* - 只有普通对象才会递归合并
|
|
2864
|
-
* - 会处理循环引用,避免无限递归
|
|
2865
|
-
*
|
|
2866
|
-
* @param initial 初始对象
|
|
2867
|
-
* @param override 待合并对象
|
|
2868
|
-
* @returns 合并后的新对象
|
|
2869
|
-
* @example
|
|
2870
|
-
* ```ts
|
|
2871
|
-
* const initial = { a: 1, b: { c: 2 } };
|
|
2872
|
-
* const override = { b: { d: 3 } };
|
|
2873
|
-
* objectAssign(initial, override); // { a: 1, b: { c: 2, d: 3 } }
|
|
2874
|
-
* ```
|
|
2875
|
-
*/
|
|
2876
|
-
declare function objectAssign<I extends PlainObject, O extends PlainObject>(initial: I, override: O): Assign<I, O>;
|
|
2877
|
-
declare function objectAssign<I extends AnyObject, O extends AnyObject>(initial: I, override: O): Assign<I, O>;
|
|
2878
|
-
//#endregion
|
|
2879
|
-
//#region src/utils/object/objectCrush.d.ts
|
|
2880
|
-
type Crush<T> = T extends readonly (infer U)[] ? Record<string, U extends object ? unknown : U> : Simplify<UnionToIntersection<keyof T extends infer Prop ? Prop extends keyof T ? T[Prop] extends infer Value ? ([Extract<Value, object>] extends [never] ? never : Record<string, unknown>) | ([Exclude<Value, object>] extends [never] ? never : [Extract<Value, object>] extends [never] ? { [P in Prop]: Value } : Record<string, unknown>) : never : never : never>>;
|
|
2881
|
-
/**
|
|
2882
|
-
* 压平对象
|
|
2883
|
-
* - 将多层级的对象转换为单层级的对象,键名使用点号连接
|
|
2884
|
-
*
|
|
2885
|
-
* @param plainObject 平面对象
|
|
2886
|
-
* @returns 压平后的对象
|
|
2887
|
-
* @example
|
|
2888
|
-
* ```ts
|
|
2889
|
-
* const obj = { a: { b: 1 } };
|
|
2890
|
-
* objectCrush(obj); // { "a.b": 1 }
|
|
2891
|
-
* ```
|
|
2892
|
-
*/
|
|
2893
|
-
declare function objectCrush<T extends PlainObject>(plainObject: T): Crush<T>;
|
|
2894
|
-
declare function objectCrush<T extends AnyObject>(anyObject: T): Crush<T>;
|
|
2895
|
-
//#endregion
|
|
2896
|
-
//#region src/utils/object/objectEntries.d.ts
|
|
2897
|
-
/**
|
|
2898
|
-
* 返回对象的可枚举属性的键/值数组
|
|
2899
|
-
*
|
|
2900
|
-
* @param value 对象
|
|
2901
|
-
* @returns 键值对数组
|
|
2902
|
-
* @example
|
|
2903
|
-
* ```ts
|
|
2904
|
-
* objectEntries({ a: 1 }); // [["a", 1]]
|
|
2905
|
-
* ```
|
|
2906
|
-
*/
|
|
2907
|
-
declare function objectEntries<const S extends string>(string: S): TupleToEntries<Split<S, "">>;
|
|
2908
|
-
declare function objectEntries<const A extends readonly unknown[]>(array: A): TupleToGroups<A>;
|
|
2909
|
-
declare function objectEntries<const O extends PlainObject>(plainObject: O): [`${keyof Except<O, symbol>}`, O[keyof Except<O, symbol>]][];
|
|
2910
|
-
declare function objectEntries<const O extends AnyObject>(anyObject: O): [`${keyof Except<O, symbol>}`, O[keyof Except<O, symbol>]][];
|
|
2911
|
-
//#endregion
|
|
2912
|
-
//#region src/utils/object/objectInvert.d.ts
|
|
2913
|
-
type IntersectOf<U> = (U extends unknown ? (k: U) => void : never) extends ((k: infer I) => void) ? I : never;
|
|
2914
|
-
type ComputeRaw<A> = A extends AnyFunction ? A : { [K in keyof A]: A[K] } & unknown;
|
|
2915
|
-
type _Invert<O extends Record<PropertyKey, PropertyKey>> = ComputeRaw<IntersectOf<{ [K in keyof O]: Record<O[K], K> }[keyof O]>>;
|
|
2916
|
-
type Invert<O extends Record<keyof O, PropertyKey>> = O extends unknown ? _Invert<O> : never;
|
|
2917
|
-
/**
|
|
2918
|
-
* 尽可能地交换对象的键和值
|
|
2919
|
-
*
|
|
2920
|
-
* @param obj 对象
|
|
2921
|
-
* @returns 键值互换后的对象
|
|
2922
|
-
* @example
|
|
2923
|
-
* ```ts
|
|
2924
|
-
* const obj = { a: "1", b: 2 };
|
|
2925
|
-
* objectInvert(obj); // { "1": "a", 2: "b" }
|
|
2926
|
-
* ```
|
|
2927
|
-
*/
|
|
2928
|
-
declare function objectInvert<const O extends Record<keyof O, PropertyKey>>(plainObject: O): Invert<O>;
|
|
2929
|
-
declare function objectInvert<const O extends AnyObject>(anyObject: O): Invert<O>;
|
|
2930
|
-
//#endregion
|
|
2931
|
-
//#region src/utils/object/objectKeys.d.ts
|
|
2932
|
-
/**
|
|
2933
|
-
* 返回对象可枚举属性和方法的名称
|
|
2934
|
-
* - `Object.keys` 始终返回 `string[]` 类型,此函数可以返回具体类型
|
|
2935
|
-
*
|
|
2936
|
-
* @param value 对象
|
|
2937
|
-
* @returns 键数组
|
|
2938
|
-
* @example
|
|
2939
|
-
* ```ts
|
|
2940
|
-
* objectKeys({ a: 1, b: 2 }); // ["a", "b"]
|
|
2941
|
-
* ```
|
|
2942
|
-
*/
|
|
2943
|
-
declare function objectKeys<const S extends string>(string: S): UnionToTuple<Range<0, Split<S, "">["length"]>>;
|
|
2944
|
-
declare function objectKeys<const A extends ArrayLike<unknown>>(array: A): UnionToTuple<Range<0, A["length"]>>;
|
|
2945
|
-
declare function objectKeys<O extends PlainObject>(plainObject: O): `${Extract<keyof O, string | number>}`[];
|
|
2946
|
-
declare function objectKeys<O extends AnyObject>(anyObject: O): `${Extract<keyof O, string | number>}`[];
|
|
2947
|
-
//#endregion
|
|
2948
|
-
//#region src/utils/object/objectOmit.d.ts
|
|
2949
|
-
/**
|
|
2950
|
-
* 排除对象的指定属性
|
|
2951
|
-
*
|
|
2952
|
-
* @param plainObject 对象
|
|
2953
|
-
* @param keys 要排除的属性键数组
|
|
2954
|
-
* @returns 排除指定属性后的新对象
|
|
2955
|
-
* @example
|
|
2956
|
-
* ```ts
|
|
2957
|
-
* objectOmit({ a: 1, b: 2 }, ["a"]); // { b: 2 }
|
|
2958
|
-
* ```
|
|
2959
|
-
*/
|
|
2960
|
-
declare function objectOmit<O extends PlainObject, K extends keyof O>(plainObject: O, keys: readonly K[]): Omit<O, K>;
|
|
2961
|
-
declare function objectOmit<O extends AnyObject, K extends keyof O>(anyObject: O, keys: readonly K[]): Omit<O, K>;
|
|
2962
|
-
//#endregion
|
|
2963
|
-
//#region src/utils/object/objectPick.d.ts
|
|
2964
|
-
/**
|
|
2965
|
-
* 选取对象的指定属性
|
|
2966
|
-
*
|
|
2967
|
-
* @param plainObject 对象
|
|
2968
|
-
* @param keys 要选取的属性键数组
|
|
2969
|
-
* @returns 包含指定属性的新对象
|
|
2970
|
-
* @example
|
|
2971
|
-
* ```ts
|
|
2972
|
-
* objectPick({ a: 1, b: 2 }, ["a"]); // { a: 1 }
|
|
2973
|
-
* ```
|
|
2974
|
-
*/
|
|
2975
|
-
declare function objectPick<O extends PlainObject, K extends keyof O>(plainObject: O, keys: readonly K[]): Pick<O, K>;
|
|
2976
|
-
declare function objectPick<O extends AnyObject, K extends keyof O>(anyObject: O, keys: readonly K[]): Pick<O, K>;
|
|
2977
|
-
//#endregion
|
|
2978
|
-
//#region src/utils/object/objectValues.d.ts
|
|
2979
|
-
/**
|
|
2980
|
-
* 返回对象可枚举属性的值的数组
|
|
2981
|
-
*
|
|
2982
|
-
* @param value 对象
|
|
2983
|
-
* @returns 值数组
|
|
2984
|
-
* @example
|
|
2985
|
-
* ```ts
|
|
2986
|
-
* objectValues({ a: 1, b: 2 }); // [1, 2]
|
|
2987
|
-
* ```
|
|
2988
|
-
*/
|
|
2989
|
-
declare function objectValues<S extends string>(string: S): Split<S, "">;
|
|
2990
|
-
declare function objectValues<A extends ArrayLike<unknown>>(array: A): A;
|
|
2991
|
-
declare function objectValues<O extends PlainObject>(plainObject: O): O[keyof O][];
|
|
2992
|
-
declare function objectValues<O extends AnyObject>(anyObject: O): O[keyof O][];
|
|
2993
|
-
//#endregion
|
|
2994
|
-
//#region src/utils/string/stringInitialCase.d.ts
|
|
2995
|
-
/**
|
|
2996
|
-
* 字符串首字母大小写
|
|
2997
|
-
* - 包含非西欧字母字符时,不处理
|
|
2998
|
-
* - 纯字母且全大写时,不处理
|
|
2999
|
-
* - 纯字母且非全大写时,首字母小写,其余保留
|
|
3000
|
-
* - 纯字母且非全大写时,首字母大写,其余保留
|
|
3001
|
-
*
|
|
3002
|
-
* @param input 待处理字符串
|
|
3003
|
-
* @param caseType 大小写类型
|
|
3004
|
-
* @returns 处理后的字符串
|
|
3005
|
-
* @example
|
|
3006
|
-
* ```ts
|
|
3007
|
-
* stringInitialCase("Hello", "lower"); // "hello"
|
|
3008
|
-
* stringInitialCase("hello", "upper"); // "Hello"
|
|
3009
|
-
* ```
|
|
3010
|
-
*/
|
|
3011
|
-
declare function stringInitialCase(input: string, caseType?: "lower" | "upper" | undefined): string;
|
|
3012
|
-
//#endregion
|
|
3013
|
-
//#region src/utils/string/stringReplace.d.ts
|
|
3014
|
-
/**
|
|
3015
|
-
* 字符串替换
|
|
3016
|
-
* - 替换第一个匹配项
|
|
3017
|
-
*
|
|
3018
|
-
* @param input 待处理字符串
|
|
3019
|
-
* @param search 匹配项
|
|
3020
|
-
* @param replacement 替换项
|
|
3021
|
-
* @returns 替换后的字符串
|
|
3022
|
-
* @example
|
|
3023
|
-
* ```ts
|
|
3024
|
-
* stringReplace("hello world", "world", "context"); // "hello context"
|
|
3025
|
-
* ```
|
|
3026
|
-
*/
|
|
3027
|
-
declare function stringReplace<I extends string, S extends string, R extends string>(input: I, search: S, replacement: R): Replace<I, S, R>;
|
|
3028
|
-
//#endregion
|
|
3029
|
-
//#region src/utils/string/stringTemplate.d.ts
|
|
3030
|
-
/**
|
|
3031
|
-
* 字符串模板替换
|
|
3032
|
-
* - 使用对象的属性值替换字符串中的 {{key}} 模板
|
|
3033
|
-
*
|
|
3034
|
-
* @param input 待处理字符串
|
|
3035
|
-
* @param template 模板对象
|
|
3036
|
-
* @param regex 模板匹配正则 (默认: `\{\{(.+?)\}\}`)
|
|
3037
|
-
* @returns 替换后的字符串
|
|
3038
|
-
* @example
|
|
3039
|
-
* ```ts
|
|
3040
|
-
* stringTemplate("Hello {{name}}", { name: "World" }); // "Hello World"
|
|
3041
|
-
* ```
|
|
3042
|
-
*/
|
|
3043
|
-
declare function stringTemplate(input: string, template: PlainObject, regex?: RegExp): string;
|
|
3044
|
-
//#endregion
|
|
3045
|
-
//#region src/utils/string/stringToJson.d.ts
|
|
3046
|
-
/**
|
|
3047
|
-
* 处理 JSON 字符串
|
|
3048
|
-
*
|
|
3049
|
-
* @param input 待处理字符串
|
|
3050
|
-
* @param safeValue 安全值 (当解析失败或输入无效时返回)
|
|
3051
|
-
* @returns 解析后的对象 或 安全值
|
|
3052
|
-
* @example
|
|
3053
|
-
* ```ts
|
|
3054
|
-
* stringToJson('{"a": 1}', {}); // { a: 1 }
|
|
3055
|
-
* stringToJson('invalid', {}); // {}
|
|
3056
|
-
* ```
|
|
3057
|
-
*/
|
|
3058
|
-
declare function stringToJson<D extends AnyObject = AnyObject>(input: string | null | undefined, safeValue: D): D;
|
|
3059
|
-
//#endregion
|
|
3060
|
-
//#region src/utils/string/stringToLowerCase.d.ts
|
|
3061
|
-
/**
|
|
3062
|
-
* 将字符串转换为小写
|
|
3063
|
-
* - 将字符串字面量类型转换为其小写形式
|
|
3064
|
-
* - 当输入无效时,返回空字符串
|
|
3065
|
-
*
|
|
3066
|
-
* @param input 待处理字符串
|
|
3067
|
-
* @returns 转换后的小写字符串类型,如果输入无效则返回空字符串类型 ""
|
|
3068
|
-
* @example
|
|
3069
|
-
* ```ts
|
|
3070
|
-
* stringToLowerCase("HELLO"); // 类型为 "hello"
|
|
3071
|
-
* stringToLowerCase(someUnknownString); // 类型为 string
|
|
3072
|
-
* stringToLowerCase(null); // 类型为 ""
|
|
3073
|
-
* ```
|
|
3074
|
-
*/
|
|
3075
|
-
declare function stringToLowerCase<const T extends string>(input: T): Lowercase<T>;
|
|
3076
|
-
declare function stringToLowerCase(input: unknown): "";
|
|
3077
|
-
//#endregion
|
|
3078
|
-
//#region src/utils/string/stringToNumber.d.ts
|
|
3079
|
-
/**
|
|
3080
|
-
* 从字符串中提取数字字符串
|
|
3081
|
-
* - 移除非数字字符,保留符号和小数点
|
|
3082
|
-
*
|
|
3083
|
-
* @param input 待处理字符串
|
|
3084
|
-
* @returns 提取出的数字字符串
|
|
3085
|
-
* @example
|
|
3086
|
-
* ```ts
|
|
3087
|
-
* stringToNumber("$1,234.56"); // "1234.56"
|
|
3088
|
-
* stringToNumber("abc-123"); // "-123"
|
|
3089
|
-
* ```
|
|
3090
|
-
*/
|
|
3091
|
-
declare function stringToNumber(input: string): string;
|
|
3092
|
-
//#endregion
|
|
3093
|
-
//#region src/utils/string/stringToPosix.d.ts
|
|
3094
|
-
/**
|
|
3095
|
-
* 将路径转换为 POSIX 风格
|
|
3096
|
-
* - 统一使用正斜杠 (/)
|
|
3097
|
-
* - 可选移除 Windows 盘符 (如 C:)
|
|
3098
|
-
* - 可选移除开头的斜杠
|
|
3099
|
-
* - 规范化连续斜杠为单个斜杠
|
|
3100
|
-
*
|
|
3101
|
-
* @param input 待处理字符串
|
|
3102
|
-
* @param removeLeadingSlash 是否移除开头斜杠,默认为 `false`。如果移除了盘符,路径通常会以 / 开头,此参数可控制是否保留该 /
|
|
3103
|
-
* @returns 转换后的路径,如果输入无效则返回空字符串
|
|
3104
|
-
*
|
|
3105
|
-
* @example
|
|
3106
|
-
* ```ts
|
|
3107
|
-
* stringToPosix("C:\\Windows\\System32");
|
|
3108
|
-
* // 默认: "/Windows/System32" (移除了 C: 并标准化)
|
|
3109
|
-
*
|
|
3110
|
-
* stringToPosix("C:\\Windows\\System32", true);
|
|
3111
|
-
* // 移除开头斜杠: "Windows/System32"
|
|
3112
|
-
*
|
|
3113
|
-
* stringToPosix("\\\\server\\share\\file.txt");
|
|
3114
|
-
* // UNC 路径: "/server/share/file.txt"
|
|
3115
|
-
*
|
|
3116
|
-
* stringToPosix("folder\\subfolder\\file.txt");
|
|
3117
|
-
* // 相对路径: "folder/subfolder/file.txt"
|
|
3118
|
-
* ```
|
|
3119
|
-
*/
|
|
3120
|
-
declare function stringToPosix(input: string | null | undefined, removeLeadingSlash?: boolean): string;
|
|
3121
|
-
//#endregion
|
|
3122
|
-
//#region src/utils/string/stringToUpperCase.d.ts
|
|
3123
|
-
/**
|
|
3124
|
-
* 将字符串转换为大写
|
|
3125
|
-
* - 将字符串字面量类型转换为其大写形式
|
|
3126
|
-
* - 当输入无效时,返回空字符串
|
|
3127
|
-
*
|
|
3128
|
-
* @param input 待处理字符串
|
|
3129
|
-
* @returns 转换后的大写字符串,如果输入无效则返回空字符串
|
|
3130
|
-
* @example
|
|
3131
|
-
* ```ts
|
|
3132
|
-
* stringToUpperCase("hello"); // 类型为 "HELLO"
|
|
3133
|
-
* stringToUpperCase(someUnknownString); // 类型为 string
|
|
3134
|
-
* stringToUpperCase(null); // 类型为 ""
|
|
3135
|
-
* ```
|
|
3136
|
-
*/
|
|
3137
|
-
declare function stringToUpperCase<const T extends string>(input: T): Uppercase<T>;
|
|
3138
|
-
declare function stringToUpperCase(input: unknown): "";
|
|
3139
|
-
//#endregion
|
|
3140
|
-
//#region src/utils/string/stringToValues.d.ts
|
|
3141
|
-
/**
|
|
3142
|
-
* 字符串分割为数组
|
|
3143
|
-
* - 按指定分隔符分割字符串,并转换类型
|
|
3144
|
-
*
|
|
3145
|
-
* @param input 待处理字符串
|
|
3146
|
-
* @param valueType 数组中每一项的类型,默认为 "number"
|
|
3147
|
-
* @param splitSymbol 分隔符,默认为 `,`
|
|
3148
|
-
* @returns 分割后的数组
|
|
3149
|
-
* @example
|
|
3150
|
-
* ```ts
|
|
3151
|
-
* stringToValues("1,2,3"); // [1, 2, 3]
|
|
3152
|
-
* stringToValues("a-b-c", "string", "-"); // ["a", "b", "c"]
|
|
3153
|
-
* ```
|
|
3154
|
-
*/
|
|
3155
|
-
declare function stringToValues(input: string | null | undefined, valueType?: "number" | undefined, splitSymbol?: string | undefined): number[];
|
|
3156
|
-
declare function stringToValues(input: string | null | undefined, valueType: "string", splitSymbol?: string | undefined): string[];
|
|
3157
|
-
//#endregion
|
|
3158
|
-
//#region src/utils/string/stringTrim.d.ts
|
|
3159
|
-
/**
|
|
3160
|
-
* 从字符串中裁切掉所有的前缀和后缀字符
|
|
3161
|
-
*
|
|
3162
|
-
* @param input 待处理字符串
|
|
3163
|
-
* @param charsToTrim 裁切字符,默认为 `" "`
|
|
3164
|
-
* @returns 裁切后的字符串
|
|
3165
|
-
* @example
|
|
3166
|
-
* ```ts
|
|
3167
|
-
* stringTrim(" hello "); // "hello"
|
|
3168
|
-
* stringTrim("__hello__", "_"); // "hello"
|
|
3169
|
-
* ```
|
|
3170
|
-
*/
|
|
3171
|
-
declare function stringTrim(input: string | null | undefined, charsToTrim?: string): string;
|
|
3172
|
-
//#endregion
|
|
3173
|
-
//#region src/utils/string/stringTruncate.d.ts
|
|
3174
|
-
/**
|
|
3175
|
-
* 截取字符串
|
|
3176
|
-
* - 支持自定义省略符,不会截断在汉字中间(因为JS字符串本身按字符处理)
|
|
3177
|
-
*
|
|
3178
|
-
* @param input 待处理字符串
|
|
3179
|
-
* @param maxLength 最大长度 (包含省略符)
|
|
3180
|
-
* @param ellipsis 省略符,默认为 `...`
|
|
3181
|
-
* @returns 截取后的字符串
|
|
3182
|
-
* @example
|
|
3183
|
-
* ```ts
|
|
3184
|
-
* stringTruncate("hello world", 8); // "hello..."
|
|
3185
|
-
* ```
|
|
3186
|
-
*/
|
|
3187
|
-
declare function stringTruncate(input: string, maxLength: number, ellipsis?: string): string;
|
|
3188
|
-
//#endregion
|
|
3189
|
-
//#region src/utils/time/timeZone.d.ts
|
|
3190
|
-
/**
|
|
3191
|
-
* 获取当前时区信息
|
|
3192
|
-
*
|
|
3193
|
-
* @returns 时区信息对象 (UTC偏移和时区名称)
|
|
3194
|
-
* @example
|
|
3195
|
-
* ```ts
|
|
3196
|
-
* getTimeZone(); // { UTC: "UTC+8", timeZone: "Asia/Shanghai" }
|
|
3197
|
-
* ```
|
|
3198
|
-
*/
|
|
3199
|
-
declare function getTimeZone(): {
|
|
3200
|
-
UTC: string;
|
|
3201
|
-
timeZone: string;
|
|
3202
|
-
};
|
|
3203
|
-
//#endregion
|
|
3204
|
-
//#region src/utils/tree/types.d.ts
|
|
3205
|
-
type RowKey = "id";
|
|
3206
|
-
type ParentIdKey = "parentId";
|
|
3207
|
-
type ChildrenKey = "children";
|
|
3208
|
-
type Strategy = "pre" | "post" | "breadth";
|
|
3209
|
-
interface BaseCallbackMeta<T> {
|
|
3210
|
-
depth: number;
|
|
3211
|
-
parents?: T[];
|
|
3212
|
-
}
|
|
3213
|
-
interface BaseOptions<T, CK extends string> {
|
|
3214
|
-
childrenKey?: CK;
|
|
3215
|
-
strategy?: Strategy;
|
|
3216
|
-
getChildrenKey?: ((row: T, meta: BaseCallbackMeta<T>) => CK) | undefined;
|
|
3217
|
-
}
|
|
3218
|
-
//#endregion
|
|
3219
|
-
//#region src/utils/tree/treeFilter.d.ts
|
|
3220
|
-
type TreeFilterOptions<T extends AnyObject, CK extends string = ChildrenKey> = BaseOptions<T, CK>;
|
|
3221
|
-
type TreeFilterCallback<T extends AnyObject> = (row: T, meta: BaseCallbackMeta<T>) => boolean;
|
|
3222
|
-
/**
|
|
3223
|
-
* 过滤树节点
|
|
3224
|
-
* - 返回新的树结构,包含所有回调返回 true 的节点
|
|
3225
|
-
* - 如果父节点被过滤,则其子节点也会被过滤 (pre 策略下)
|
|
3226
|
-
*
|
|
3227
|
-
* @param tree 树结构数据
|
|
3228
|
-
* @param callback 回调函数
|
|
3229
|
-
* @param options 配置项 (childrenKey, strategy等)
|
|
3230
|
-
* @returns 过滤后的树结构数组
|
|
3231
|
-
* @example
|
|
3232
|
-
* ```ts
|
|
3233
|
-
* const tree = [{ id: 1, visible: true, children: [{ id: 2, visible: false }] }];
|
|
3234
|
-
* treeFilter(tree, (node) => node.visible);
|
|
3235
|
-
* // [{ id: 1, visible: true, children: [] }]
|
|
3236
|
-
* ```
|
|
3237
|
-
*/
|
|
3238
|
-
declare function treeFilter<T extends AnyObject, CK extends string = ChildrenKey>(tree: T[], callback: TreeFilterCallback<T>, options?: TreeFilterOptions<T, CK>): T[];
|
|
3239
|
-
declare function treeFilter<T extends AnyObject, CK extends string = ChildrenKey>(tree: T, callback: TreeFilterCallback<T>, options?: TreeFilterOptions<T, CK>): T;
|
|
3240
|
-
//#endregion
|
|
3241
|
-
//#region src/utils/tree/treeFind.d.ts
|
|
3242
|
-
type TreeFindOptions<T extends AnyObject, CK extends string = ChildrenKey> = BaseOptions<T, CK>;
|
|
3243
|
-
type TreeFindCallback<T extends AnyObject> = (row: T, meta: BaseCallbackMeta<T>) => boolean;
|
|
3244
|
-
/**
|
|
3245
|
-
* 查找树节点
|
|
3246
|
-
* - 返回第一个回调返回 true 的节点
|
|
3247
|
-
*
|
|
3248
|
-
* @param tree 树结构数据
|
|
3249
|
-
* @param callback 回调函数
|
|
3250
|
-
* @param options 配置项
|
|
3251
|
-
* @returns 找到的节点,未找到则返回 undefined
|
|
3252
|
-
* @example
|
|
3253
|
-
* ```ts
|
|
3254
|
-
* const tree = [{ id: 1, children: [{ id: 2 }] }];
|
|
3255
|
-
* treeFind(tree, (node) => node.id === 2); // { id: 2, ... }
|
|
3256
|
-
* ```
|
|
3257
|
-
*/
|
|
3258
|
-
declare function treeFind<T extends AnyObject, CK extends string = ChildrenKey>(tree: T | T[], callback: TreeFindCallback<T>, options?: TreeFindOptions<T, CK>): T | undefined;
|
|
3259
|
-
//#endregion
|
|
3260
|
-
//#region src/utils/tree/treeForEach.d.ts
|
|
3261
|
-
type TreeForeachOptions<T extends AnyObject, CK extends string = ChildrenKey> = BaseOptions<T, CK>;
|
|
3262
|
-
type TreeForeachCallback<T extends AnyObject> = (row: T, meta: BaseCallbackMeta<T>) => void;
|
|
3263
|
-
/**
|
|
3264
|
-
* 遍历树节点
|
|
3265
|
-
*
|
|
3266
|
-
* @param tree 树结构数据
|
|
3267
|
-
* @param callback 回调函数
|
|
3268
|
-
* @param options 配置项
|
|
3269
|
-
* @example
|
|
3270
|
-
* ```ts
|
|
3271
|
-
* const tree = [{ id: 1, children: [{ id: 2 }] }];
|
|
3272
|
-
* const ids: number[] = [];
|
|
3273
|
-
* treeForEach(tree, (node) => ids.push(node.id));
|
|
3274
|
-
* // ids: [1, 2] (pre-order default)
|
|
3275
|
-
* ```
|
|
3276
|
-
*/
|
|
3277
|
-
declare function treeForEach<T extends AnyObject, CK extends string = ChildrenKey>(tree: T | T[], callback: TreeForeachCallback<T>, options?: TreeForeachOptions<T, CK>): void;
|
|
3278
|
-
//#endregion
|
|
3279
|
-
//#region src/utils/tree/treeMap.d.ts
|
|
3280
|
-
type TreeMapOptions<T extends AnyObject, CK extends string> = BaseOptions<T, CK>;
|
|
3281
|
-
type TreeMapCallback<R extends AnyObject, T extends AnyObject> = (row: T, meta: BaseCallbackMeta<T>) => R;
|
|
3282
|
-
/**
|
|
3283
|
-
* 映射树节点
|
|
3284
|
-
* - 返回新的树结构,保持层级关系
|
|
3285
|
-
*
|
|
3286
|
-
* @param tree 树结构数据
|
|
3287
|
-
* @param callback 回调函数 (返回映射后的节点内容)
|
|
3288
|
-
* @param options 配置项
|
|
3289
|
-
* @returns 映射后的树结构数组
|
|
3290
|
-
* @example
|
|
3291
|
-
* ```ts
|
|
3292
|
-
* const tree = [{ id: 1, val: 10, children: [{ id: 2, val: 20 }] }];
|
|
3293
|
-
* treeMap(tree, (node) => ({ ...node, val: node.val * 2 }));
|
|
3294
|
-
* // [{ id: 1, val: 20, children: [{ id: 2, val: 40 }] }]
|
|
3295
|
-
* ```
|
|
3296
|
-
*/
|
|
3297
|
-
declare function treeMap<R extends AnyObject, T extends AnyObject, CK extends string = ChildrenKey>(tree: T[], callback: TreeMapCallback<R, T>, options?: TreeMapOptions<T, CK>): TreeLike<R, CK>[];
|
|
3298
|
-
declare function treeMap<R extends AnyObject, T extends AnyObject, CK extends string = ChildrenKey>(tree: T, callback: TreeMapCallback<R, T>, options?: TreeMapOptions<T, CK>): TreeLike<R, CK>;
|
|
3299
|
-
//#endregion
|
|
3300
|
-
//#region src/utils/tree/rowsToTree.d.ts
|
|
3301
|
-
interface RowsToTreeOptions<RK extends string = RowKey, PK extends string = ParentIdKey, CK extends string = ChildrenKey> {
|
|
3302
|
-
rowKey?: RK;
|
|
3303
|
-
parentIdKey?: PK;
|
|
3304
|
-
childrenKey?: CK;
|
|
3305
|
-
}
|
|
3306
|
-
/**
|
|
3307
|
-
* 行结构 转 树结构
|
|
3308
|
-
* - 将平铺的数组转换为树形结构
|
|
3309
|
-
*
|
|
3310
|
-
* @param rows 行数据数组
|
|
3311
|
-
* @param options 配置项
|
|
3312
|
-
* @returns 树结构数组
|
|
3313
|
-
* @example
|
|
3314
|
-
* ```ts
|
|
3315
|
-
* const rows = [
|
|
3316
|
-
* { id: 1, parentId: null },
|
|
3317
|
-
* { id: 2, parentId: 1 },
|
|
3318
|
-
* ];
|
|
3319
|
-
* rowsToTree(rows);
|
|
3320
|
-
* // [{ id: 1, parentId: null, children: [{ id: 2, parentId: 1 }] }]
|
|
3321
|
-
* ```
|
|
3322
|
-
*/
|
|
3323
|
-
declare function rowsToTree<T extends AnyObject = AnyObject, CK extends string = ChildrenKey, R = TreeLike<T, CK>, RK extends string = RowKey, PK extends string = ParentIdKey>(rows: T[], options?: RowsToTreeOptions<RK, PK, CK> | undefined): R[];
|
|
3324
|
-
//#endregion
|
|
3325
|
-
//#region src/utils/tree/treeToRows.d.ts
|
|
3326
|
-
type TreeToRowsOptions<T extends AnyObject, CK extends string = ChildrenKey> = TreeForeachOptions<T, CK>;
|
|
3327
|
-
/**
|
|
3328
|
-
* 树结构 转 行结构
|
|
3329
|
-
* - 将树形结构扁平化为数组
|
|
3330
|
-
*
|
|
3331
|
-
* @param tree 树结构数据 (单个节点或节点数组)
|
|
3332
|
-
* @param options 配置项
|
|
3333
|
-
* @returns 扁平化后的数组
|
|
3334
|
-
* @example
|
|
3335
|
-
* ```ts
|
|
3336
|
-
* const tree = [{ id: 1, children: [{ id: 2 }] }];
|
|
3337
|
-
* treeToRows(tree);
|
|
3338
|
-
* // [{ id: 1, children: undefined }, { id: 2, children: undefined }]
|
|
3339
|
-
* ```
|
|
3340
|
-
*/
|
|
3341
|
-
declare function treeToRows<T extends AnyObject, CK extends string = ChildrenKey, R extends AnyObject = SetOptional<T, CK>>(tree: T | T[], options?: TreeToRowsOptions<T, CK>): R[];
|
|
3342
|
-
//#endregion
|
|
3343
|
-
//#region src/utils/typeof/isAbortSignal.d.ts
|
|
3344
|
-
/**
|
|
3345
|
-
* 检查 value 是否为 AbortSignal
|
|
3346
|
-
* @param value 待检查值
|
|
3347
|
-
* @returns 是否为 AbortSignal
|
|
3348
|
-
*/
|
|
3349
|
-
declare function isAbortSignal(value: unknown): value is AbortSignal;
|
|
3350
|
-
//#endregion
|
|
3351
|
-
//#region src/utils/typeof/isArray.d.ts
|
|
3352
|
-
type TypedArray = Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array | BigInt64Array | BigUint64Array;
|
|
3353
|
-
/**
|
|
3354
|
-
* 检查 value 是否为数组
|
|
3355
|
-
*
|
|
3356
|
-
* @param value 待检查值
|
|
3357
|
-
* @returns 是否为数组
|
|
3358
|
-
* @example
|
|
3359
|
-
* ```ts
|
|
3360
|
-
* isArray([]); // true
|
|
3361
|
-
* ```
|
|
3362
|
-
*/
|
|
3363
|
-
declare function isArray(value: unknown): value is unknown[];
|
|
3364
|
-
/**
|
|
3365
|
-
* 检查 value 是否为 TypedArray
|
|
3366
|
-
*
|
|
3367
|
-
* @param value 待检查值
|
|
3368
|
-
* @returns 是否为 TypedArray
|
|
3369
|
-
* @example
|
|
3370
|
-
* ```ts
|
|
3371
|
-
* isTypedArray(new Int8Array()); // true
|
|
3372
|
-
* ```
|
|
3373
|
-
*/
|
|
3374
|
-
declare function isTypedArray(value: unknown): value is TypedArray;
|
|
3375
|
-
//#endregion
|
|
3376
|
-
//#region src/utils/typeof/isBigInt.d.ts
|
|
3377
|
-
/**
|
|
3378
|
-
* 检查 value 是否为 BigInt
|
|
3379
|
-
* @param value 待检查值
|
|
3380
|
-
* @returns 是否为 BigInt
|
|
3381
|
-
*/
|
|
3382
|
-
declare function isBigInt(value: unknown): value is bigint;
|
|
3383
|
-
//#endregion
|
|
3384
|
-
//#region src/utils/typeof/isBlob.d.ts
|
|
3385
|
-
/**
|
|
3386
|
-
* 检查 value 是否为 Blob
|
|
3387
|
-
* @param value 待检查值
|
|
3388
|
-
* @returns 是否为 Blob
|
|
3389
|
-
*/
|
|
3390
|
-
declare function isBlob(value: unknown): value is Blob;
|
|
3391
|
-
declare function isFile(value: unknown): value is File;
|
|
3392
|
-
//#endregion
|
|
3393
|
-
//#region src/utils/typeof/isBoolean.d.ts
|
|
3394
|
-
/**
|
|
3395
|
-
* 检查 value 是否为 Boolean
|
|
3396
|
-
* @param value 待检查值
|
|
3397
|
-
* @returns 是否为 Boolean
|
|
3398
|
-
*/
|
|
3399
|
-
declare function isBoolean(value: unknown): value is boolean;
|
|
3400
|
-
//#endregion
|
|
3401
|
-
//#region src/utils/typeof/isClass.d.ts
|
|
3402
|
-
/**
|
|
3403
|
-
* 检查 value 是否为 Class
|
|
3404
|
-
*
|
|
3405
|
-
* @param value 待检查值
|
|
3406
|
-
* @returns 是否为 Class
|
|
3407
|
-
* @example
|
|
3408
|
-
* ```ts
|
|
3409
|
-
* class A {}
|
|
3410
|
-
* isClass(A); // true
|
|
3411
|
-
* isClass(() => {}); // false
|
|
3412
|
-
* ```
|
|
3413
|
-
*/
|
|
3414
|
-
declare function isClass(value: unknown): value is Class<AnyObject>;
|
|
3415
|
-
//#endregion
|
|
3416
|
-
//#region src/utils/typeof/isDate.d.ts
|
|
3417
|
-
/**
|
|
3418
|
-
* 检查 value 是否为 Date 对象
|
|
3419
|
-
*
|
|
3420
|
-
* @param value 待检查值
|
|
3421
|
-
* @param invalidCheck 是否要求日期有效(非 Invalid Date)。默认 true
|
|
3422
|
-
* - true: 仅当是有效 Date 对象时返回 true(排除 new Date('invalid'))
|
|
3423
|
-
* - false: 只要 [[Prototype]] 是 Date 即返回 true(包含 Invalid Date)
|
|
3424
|
-
* @returns 是否为 Date 对象,根据 invalidCheck 返回不同语义的 Date 判定
|
|
3425
|
-
*
|
|
3426
|
-
* @example
|
|
3427
|
-
* ```ts
|
|
3428
|
-
* isDate(new Date()); // true
|
|
3429
|
-
* isDate(new Date('invalid')); // false
|
|
3430
|
-
* isDate(new Date('invalid'), false); // true
|
|
3431
|
-
* isDate(null); // false
|
|
3432
|
-
* isDate({}); // false
|
|
3433
|
-
* ```
|
|
3434
|
-
*/
|
|
3435
|
-
declare function isDate(value: unknown, invalidCheck?: boolean): value is Date;
|
|
3436
|
-
//#endregion
|
|
3437
|
-
//#region src/utils/typeof/isEnumeration.d.ts
|
|
3438
|
-
/**
|
|
3439
|
-
* 判断一个对象是否为有效的枚举
|
|
3440
|
-
* - 枚举成员不能为空
|
|
3441
|
-
* - 枚举成员的键不能具有数值名
|
|
3442
|
-
* - 枚举成员的值必须类型一致且为 `string` 或 `number` 类型
|
|
3443
|
-
* - 枚举成员的值不能重复
|
|
3444
|
-
* - 枚举成员的值必须全部为双向映射或非双向映射
|
|
3445
|
-
*
|
|
3446
|
-
* @param enumeration 待检查值
|
|
3447
|
-
* @returns [是否为有效的枚举, 是否为双向枚举]
|
|
3448
|
-
*/
|
|
3449
|
-
declare function isEnumeration(enumeration: PlainObject): [boolean, boolean];
|
|
3450
|
-
//#endregion
|
|
3451
|
-
//#region src/utils/typeof/isEqual.d.ts
|
|
3452
|
-
/**
|
|
3453
|
-
* 深度比较两个值是否相等
|
|
3454
|
-
*
|
|
3455
|
-
* @param value 待比较值 A
|
|
3456
|
-
* @param other 待比较值 B
|
|
3457
|
-
* @returns 是否相等
|
|
3458
|
-
* @example
|
|
3459
|
-
* ```ts
|
|
3460
|
-
* isEqual({ a: 1 }, { a: 1 }); // true
|
|
3461
|
-
* ```
|
|
3462
|
-
*/
|
|
3463
|
-
declare function isEqual(x: unknown, y: unknown): boolean;
|
|
3464
|
-
//#endregion
|
|
3465
|
-
//#region src/utils/typeof/isError.d.ts
|
|
3466
|
-
/**
|
|
3467
|
-
* 检查 value 是否为 Error 对象
|
|
3468
|
-
* @param value 待检查值
|
|
3469
|
-
* @returns 是否为 Error
|
|
3470
|
-
*/
|
|
3471
|
-
declare function isError(value: unknown): value is Error;
|
|
3472
|
-
//#endregion
|
|
3473
|
-
//#region src/utils/typeof/isFalsy.d.ts
|
|
3474
|
-
/**
|
|
3475
|
-
* 检查 value 是否为 Falsy 值 (false, 0, "", null, undefined, NaN)
|
|
3476
|
-
* @param value 待检查值
|
|
3477
|
-
* @returns 是否为 Falsy
|
|
3478
|
-
*/
|
|
3479
|
-
declare function isFalsy(value: unknown): value is false | 0 | "" | null | undefined;
|
|
3480
|
-
declare function isFalsyLike(value: unknown): boolean;
|
|
3481
|
-
//#endregion
|
|
3482
|
-
//#region src/utils/typeof/isFunction.d.ts
|
|
3483
|
-
/**
|
|
3484
|
-
* 检查 value 是否为 Function
|
|
3485
|
-
* @param value 待检查值
|
|
3486
|
-
* @returns 是否为 Function
|
|
3487
|
-
*/
|
|
3488
|
-
declare function isFunction(value: unknown): value is AnyFunction;
|
|
3489
|
-
/**
|
|
3490
|
-
* 检查 value 是否为 AsyncFunction
|
|
3491
|
-
* @param value 待检查值
|
|
3492
|
-
* @returns 是否为 AsyncFunction
|
|
3493
|
-
*/
|
|
3494
|
-
declare function isAsyncFunction(value: unknown): value is AnyAsyncFunction;
|
|
3495
|
-
/**
|
|
3496
|
-
* 检查 value 是否为 GeneratorFunction
|
|
3497
|
-
* @param value 待检查值
|
|
3498
|
-
* @returns 是否为 GeneratorFunction
|
|
3499
|
-
*/
|
|
3500
|
-
declare function isGeneratorFunction(value: unknown): value is AnyGeneratorFunction;
|
|
3501
|
-
/**
|
|
3502
|
-
* 检查 value 是否为 AsyncGeneratorFunction
|
|
3503
|
-
* @param value 待检查值
|
|
3504
|
-
* @returns 是否为 AsyncGeneratorFunction
|
|
3505
|
-
*/
|
|
3506
|
-
declare function isAsyncGeneratorFunction(value: unknown): value is AnyAsyncGeneratorFunction;
|
|
3507
|
-
//#endregion
|
|
3508
|
-
//#region src/utils/typeof/isIframe.d.ts
|
|
3509
|
-
/**
|
|
3510
|
-
* 检查 value 是否为 HTMLIFrameElement
|
|
3511
|
-
* @param value 待检查值
|
|
3512
|
-
* @returns 是否为 HTMLIFrameElement
|
|
3513
|
-
*/
|
|
3514
|
-
declare function isIframe(value: unknown): value is HTMLIFrameElement;
|
|
3515
|
-
declare function isInIframe(): boolean;
|
|
3516
|
-
//#endregion
|
|
3517
|
-
//#region src/utils/typeof/isIterable.d.ts
|
|
3518
|
-
/**
|
|
3519
|
-
* 检查 value 是否为可迭代对象 (Iterable)
|
|
3520
|
-
* @param value 待检查值
|
|
3521
|
-
* @returns 是否为 Iterable
|
|
3522
|
-
*/
|
|
3523
|
-
declare function isIterable(value: unknown): value is {
|
|
3524
|
-
[Symbol.iterator]: () => Iterator<unknown>;
|
|
3525
|
-
};
|
|
3526
|
-
//#endregion
|
|
3527
|
-
//#region src/utils/typeof/isMap.d.ts
|
|
3528
|
-
/**
|
|
3529
|
-
* 检查 value 是否为 Map
|
|
3530
|
-
* @param value 待检查值
|
|
3531
|
-
* @returns 是否为 Map
|
|
3532
|
-
*/
|
|
3533
|
-
declare function isMap(value: unknown): value is Map<unknown, unknown>;
|
|
3534
|
-
/**
|
|
3535
|
-
* 检查 value 是否为 WeakMap
|
|
3536
|
-
* @param value 待检查值
|
|
3537
|
-
* @returns 是否为 WeakMap
|
|
3538
|
-
*/
|
|
3539
|
-
declare function isWeakMap(value: unknown): value is WeakMap<AnyObject, unknown>;
|
|
3540
|
-
//#endregion
|
|
3541
|
-
//#region src/utils/typeof/isNull.d.ts
|
|
3542
|
-
/**
|
|
3543
|
-
* 检查 value 是否为 null
|
|
3544
|
-
* @param value 待检查值
|
|
3545
|
-
* @returns 是否为 null
|
|
3546
|
-
*/
|
|
3547
|
-
declare function isNull(value: unknown): value is null;
|
|
3548
|
-
//#endregion
|
|
3549
|
-
//#region src/utils/typeof/isNumber.d.ts
|
|
3550
|
-
/**
|
|
3551
|
-
* 检查 value 是否为 number 类型
|
|
3552
|
-
*
|
|
3553
|
-
* @param value 待检查值
|
|
3554
|
-
* @param NaNCheck 是否排除 `NaN`,默认为 `true`
|
|
3555
|
-
* @returns 是否为 number
|
|
3556
|
-
* @example
|
|
3557
|
-
* ```ts
|
|
3558
|
-
* isNumber(1); // true
|
|
3559
|
-
* isNumber(NaN); // false (default)
|
|
3560
|
-
* isNumber(NaN, false); // true
|
|
3561
|
-
* ```
|
|
3562
|
-
*/
|
|
3563
|
-
declare function isNumber(value: unknown, NaNCheck?: boolean): value is number;
|
|
3564
|
-
/**
|
|
3565
|
-
* 检查 value 是否为 NaN
|
|
3566
|
-
*
|
|
3567
|
-
* @param value 待检查值
|
|
3568
|
-
* @returns 是否为 NaN
|
|
3569
|
-
*/
|
|
3570
|
-
declare function isNaN(value: unknown): value is number;
|
|
3571
|
-
/**
|
|
3572
|
-
* 检查 value 是否为整数
|
|
3573
|
-
*
|
|
3574
|
-
* @param value 待检查值
|
|
3575
|
-
* @param safeCheck 是否附加安全整数检查
|
|
3576
|
-
* @returns 是否为整数
|
|
3577
|
-
*/
|
|
3578
|
-
declare function isInteger(value: unknown, safeCheck?: boolean): value is number;
|
|
3579
|
-
/**
|
|
3580
|
-
* 检查 value 是否为正整数
|
|
3581
|
-
* - 此函数中 `0` 不被视为正整数
|
|
3582
|
-
*
|
|
3583
|
-
* @param value 待检查值
|
|
3584
|
-
* @param safeCheck 是否附加安全整数检查
|
|
3585
|
-
*/
|
|
3586
|
-
declare function isPositiveInteger(value: unknown, safeCheck?: boolean): value is number;
|
|
3587
|
-
/**
|
|
3588
|
-
* 检查 value 是否为负整数
|
|
3589
|
-
* - 此函数中 `0` 不被视为负整数
|
|
3590
|
-
*
|
|
3591
|
-
* @param value 待检查值
|
|
3592
|
-
* @param safeCheck 是否附加安全整数检查
|
|
3593
|
-
*/
|
|
3594
|
-
declare function isNegativeInteger(value: unknown, safeCheck?: boolean): value is number;
|
|
3595
|
-
/**
|
|
3596
|
-
* 检查 value 是否为 Infinity
|
|
3597
|
-
* - 排除 `NaN`
|
|
3598
|
-
*
|
|
3599
|
-
* @param value 待检查值
|
|
3600
|
-
*/
|
|
3601
|
-
declare function isInfinity(value: unknown): value is number;
|
|
3602
|
-
/**
|
|
3603
|
-
* 检查 value 是否类似 Infinity
|
|
3604
|
-
* - 排除 `NaN`
|
|
3605
|
-
*
|
|
3606
|
-
* @param value 待检查值
|
|
3607
|
-
*/
|
|
3608
|
-
declare function isInfinityLike(value: unknown): boolean;
|
|
3609
|
-
//#endregion
|
|
3610
|
-
//#region src/utils/typeof/isObject.d.ts
|
|
3611
|
-
/**
|
|
3612
|
-
* 判断是否为普通对象类型
|
|
3613
|
-
* - 可选是否检查原型为 `Object.prototype`,防止原型链污染
|
|
3614
|
-
*
|
|
3615
|
-
* @param value 待检查值
|
|
3616
|
-
* @param prototypeCheck 是否进行原型检查,默认 `true`
|
|
3617
|
-
* @returns 是否为 Plain Object (当 checkPrototype=true) 或 object
|
|
3618
|
-
* @example
|
|
3619
|
-
* ```ts
|
|
3620
|
-
* isObject({}); // true
|
|
3621
|
-
* isObject([]); // false
|
|
3622
|
-
* isObject(new Date()); // false
|
|
3623
|
-
* isObject(new Date(), false); // true
|
|
3624
|
-
* isObject(Object.create(null)) // false
|
|
3625
|
-
* isObject(Object.create(null), false) // true
|
|
3626
|
-
* ```
|
|
3627
|
-
*/
|
|
3628
|
-
declare function isObject(value: unknown, prototypeCheck?: boolean): value is Record<PropertyKey, unknown>;
|
|
3629
|
-
//#endregion
|
|
3630
|
-
//#region src/utils/typeof/isPromise.d.ts
|
|
3631
|
-
/**
|
|
3632
|
-
* 检查 value 是否为 Promise
|
|
3633
|
-
* @param value 待检查值
|
|
3634
|
-
* @returns 是否为 Promise
|
|
3635
|
-
*/
|
|
3636
|
-
declare function isPromise(value: unknown): value is Promise<unknown>;
|
|
3637
|
-
/**
|
|
3638
|
-
* 检查 value 是否为 PromiseLike (thenable)
|
|
3639
|
-
* @param value 待检查值
|
|
3640
|
-
* @returns 是否为 PromiseLike
|
|
3641
|
-
*/
|
|
3642
|
-
declare function isPromiseLike(value: unknown): value is PromiseLike<unknown>;
|
|
3643
|
-
//#endregion
|
|
3644
|
-
//#region src/utils/typeof/isReadableStream.d.ts
|
|
3645
|
-
/**
|
|
3646
|
-
* 检查 value 是否为 ReadableStream
|
|
3647
|
-
* - Uses `Object.prototype.toString` where supported (modern browsers, Node.js ≥18).
|
|
3648
|
-
* - Falls back to duck-typing in older environments.
|
|
3649
|
-
* - Resistant to basic forgery, but not 100% secure in all polyfill scenarios.
|
|
3650
|
-
* - ⚠️ Note: In older Node.js (<18) or with non-compliant polyfills, this may return false positives or negatives.
|
|
3651
|
-
*
|
|
3652
|
-
* @param value 待检查值
|
|
3653
|
-
* @returns 是否为 ReadableStream
|
|
3654
|
-
*/
|
|
3655
|
-
declare function isReadableStream(value: unknown): value is ReadableStream;
|
|
3656
|
-
//#endregion
|
|
3657
|
-
//#region src/utils/typeof/isRegExp.d.ts
|
|
3658
|
-
/**
|
|
3659
|
-
* 检查 value 是否为 RegExp
|
|
3660
|
-
* @param value 待检查值
|
|
3661
|
-
* @returns 是否为 RegExp
|
|
3662
|
-
*/
|
|
3663
|
-
declare function isRegExp(value: unknown): value is RegExp;
|
|
3664
|
-
//#endregion
|
|
3665
|
-
//#region src/utils/typeof/isSet.d.ts
|
|
3666
|
-
/**
|
|
3667
|
-
* 检查 value 是否为 Set
|
|
3668
|
-
* @param value 待检查值
|
|
3669
|
-
* @returns 是否为 Set
|
|
3670
|
-
*/
|
|
3671
|
-
declare function isSet(value: unknown): value is Set<unknown>;
|
|
3672
|
-
/**
|
|
3673
|
-
* 检查 value 是否为 WeakSet
|
|
3674
|
-
* @param value 待检查值
|
|
3675
|
-
* @returns 是否为 WeakSet
|
|
3676
|
-
*/
|
|
3677
|
-
declare function isWeakSet(value: unknown): value is WeakSet<AnyObject>;
|
|
3678
|
-
//#endregion
|
|
3679
|
-
//#region src/utils/typeof/isString.d.ts
|
|
3680
|
-
/**
|
|
3681
|
-
* 检查 value 是否为 string 类型
|
|
3682
|
-
*
|
|
3683
|
-
* @param value 待检查值
|
|
3684
|
-
* @param checkEmpty 是否检查空字符串
|
|
3685
|
-
* @returns 是否为字符串
|
|
3686
|
-
* @example
|
|
3687
|
-
* ```ts
|
|
3688
|
-
* isString("abc"); // true
|
|
3689
|
-
* isString(""); // true
|
|
3690
|
-
* isString("", true); // false
|
|
3691
|
-
* ```
|
|
3692
|
-
*/
|
|
3693
|
-
declare function isString(value: unknown, checkEmpty?: boolean): value is string;
|
|
3694
|
-
//#endregion
|
|
3695
|
-
//#region src/utils/typeof/isSymbol.d.ts
|
|
3696
|
-
/**
|
|
3697
|
-
* 检查 value 是否为 Symbol
|
|
3698
|
-
* @param value 待检查值
|
|
3699
|
-
* @returns 是否为 Symbol
|
|
3700
|
-
*/
|
|
3701
|
-
declare function isSymbol(value: unknown): value is symbol;
|
|
3702
|
-
//#endregion
|
|
3703
|
-
//#region src/utils/typeof/isUndefined.d.ts
|
|
3704
|
-
/**
|
|
3705
|
-
* 检查 value 是否为 undefined
|
|
3706
|
-
* @param value 待检查值
|
|
3707
|
-
* @returns 是否为 undefined
|
|
3708
|
-
*/
|
|
3709
|
-
declare function isUndefined(value: unknown): value is undefined;
|
|
3710
|
-
//#endregion
|
|
3711
|
-
//#region src/utils/typeof/isURLSearchParams.d.ts
|
|
3712
|
-
/**
|
|
3713
|
-
* 检查 value 是否为 URLSearchParams
|
|
3714
|
-
* @param value 待检查值
|
|
3715
|
-
* @returns 是否为 URLSearchParams
|
|
3716
|
-
*/
|
|
3717
|
-
declare function isURLSearchParams(value: unknown): value is URLSearchParams;
|
|
3718
|
-
//#endregion
|
|
3719
|
-
//#region src/utils/typeof/isWebSocket.d.ts
|
|
3720
|
-
/**
|
|
3721
|
-
* 检查 value 是否为 WebSocket
|
|
3722
|
-
* @param value 待检查值
|
|
3723
|
-
* @returns 是否为 WebSocket
|
|
3724
|
-
*/
|
|
3725
|
-
declare function isWebSocket(value: unknown): value is WebSocket;
|
|
3726
|
-
//#endregion
|
|
3727
|
-
//#region src/utils/typeof/isWindow.d.ts
|
|
3728
|
-
/**
|
|
3729
|
-
* 检查 value 是否为 Window
|
|
3730
|
-
* @param value 待检查值
|
|
3731
|
-
* @returns 是否为 Window
|
|
3732
|
-
*/
|
|
3733
|
-
declare function isWindow(value: unknown): value is Window;
|
|
3734
|
-
//#endregion
|
|
3735
|
-
export { arrayCast, arrayCompete, arrayCounting, arrayDifference, arrayFirst, arrayFork, arrayIntersection, arrayLast, arrayMerge, arrayPick, arrayReplace, arrayReplaceMove, arraySplit, arrayUnzip, arrayZip, arrayZipToObject, enumEntries, enumKeys, enumValues, getTimeZone, isAbortSignal, isArray, isAsyncFunction, isAsyncGeneratorFunction, isBigInt, isBlob, isBoolean, isBrowser, isClass, isDate, isDesktop, isEnumeration, isEqual, isError, isFalsy, isFalsyLike, isFile, isFunction, isGeneratorFunction, isIOSMobile, isIframe, isInIframe, isInfinity, isInfinityLike, isInteger, isIterable, isMacOSDesktop, isMap, isMobile, isNaN, isNegativeInteger, isNull, isNumber, isObject, isPositiveInteger, isPromise, isPromiseLike, isReactNative, isReadableStream, isRegExp, isSet, isString, isSymbol, isTablet, isTypedArray, isURLSearchParams, isUndefined, isWeakMap, isWeakSet, isWebSocket, isWebWorker, isWindow, isWindowsDesktop, mathToBignumber, mathToDecimal, mathToEvaluate, numberWithin, objectAssign, objectCrush, objectEntries, objectInvert, objectKeys, objectMapEntries, objectOmit, objectPick, objectValues, rowsToTree, stringInitialCase, stringReplace, stringTemplate, stringToJson, stringToLowerCase, stringToNumber, stringToPosix, stringToUpperCase, stringToValues, stringTrim, stringTruncate, to, toPromise, treeFilter, treeFind, treeForEach, treeMap, treeToRows };
|
|
3736
|
-
//# sourceMappingURL=index.d.ts.map
|