@augment-vir/common 13.2.1 → 13.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/types/augments/ansi.d.ts +0 -1
- package/dist/types/augments/array.d.ts +0 -1
- package/dist/types/augments/async.d.ts +0 -1
- package/dist/types/augments/common-number.d.ts +0 -1
- package/dist/types/augments/common-string.d.ts +0 -1
- package/dist/types/augments/date/date.d.ts +0 -1
- package/dist/types/augments/date/relative-date.d.ts +0 -1
- package/dist/types/augments/environment.d.ts +0 -1
- package/dist/types/augments/error.d.ts +0 -1
- package/dist/types/augments/function.d.ts +0 -1
- package/dist/types/augments/json-compatible.d.ts +0 -1
- package/dist/types/augments/json.d.ts +0 -1
- package/dist/types/augments/object/enum.d.ts +0 -1
- package/dist/types/augments/object/filter-object.d.ts +0 -1
- package/dist/types/augments/object/has-key.d.ts +0 -1
- package/dist/types/augments/object/jsonify.d.ts +0 -1
- package/dist/types/augments/object/map-object.d.ts +0 -1
- package/dist/types/augments/object/matches-object-shape.d.ts +0 -1
- package/dist/types/augments/object/nested-keys.d.ts +0 -1
- package/dist/types/augments/object/object-entries.d.ts +0 -1
- package/dist/types/augments/object/object.d.ts +0 -1
- package/dist/types/augments/object/pick-deep.d.ts +0 -1
- package/dist/types/augments/object/typed-has-property.d.ts +0 -1
- package/dist/types/augments/promise.d.ts +0 -1
- package/dist/types/augments/regexp.d.ts +0 -1
- package/dist/types/augments/runtime-type-of.d.ts +0 -1
- package/dist/types/augments/string/url.d.ts +0 -1
- package/dist/types/augments/string/uuid.d.ts +0 -1
- package/dist/types/augments/truncate-number.d.ts +0 -1
- package/dist/types/augments/tuple.d.ts +0 -1
- package/dist/types/augments/type.d.ts +0 -1
- package/dist/types/index.d.ts +0 -1
- package/package.json +4 -4
- package/dist/cjs/augments/ansi.d.ts +0 -2
- package/dist/cjs/augments/array.d.ts +0 -14
- package/dist/cjs/augments/async.d.ts +0 -15
- package/dist/cjs/augments/common-number.d.ts +0 -26
- package/dist/cjs/augments/common-string.d.ts +0 -45
- package/dist/cjs/augments/date/date.d.ts +0 -27
- package/dist/cjs/augments/date/relative-date.d.ts +0 -12
- package/dist/cjs/augments/environment.d.ts +0 -2
- package/dist/cjs/augments/error.d.ts +0 -11
- package/dist/cjs/augments/function.d.ts +0 -27
- package/dist/cjs/augments/json-compatible.d.ts +0 -23
- package/dist/cjs/augments/json.d.ts +0 -6
- package/dist/cjs/augments/object/enum.d.ts +0 -5
- package/dist/cjs/augments/object/filter-object.d.ts +0 -5
- package/dist/cjs/augments/object/has-key.d.ts +0 -2
- package/dist/cjs/augments/object/jsonify.d.ts +0 -3
- package/dist/cjs/augments/object/map-object.d.ts +0 -25
- package/dist/cjs/augments/object/matches-object-shape.d.ts +0 -37
- package/dist/cjs/augments/object/nested-keys.d.ts +0 -12
- package/dist/cjs/augments/object/object-entries.d.ts +0 -6
- package/dist/cjs/augments/object/object.d.ts +0 -13
- package/dist/cjs/augments/object/pick-deep.d.ts +0 -8
- package/dist/cjs/augments/object/typed-has-property.d.ts +0 -8
- package/dist/cjs/augments/promise.d.ts +0 -28
- package/dist/cjs/augments/regexp.d.ts +0 -4
- package/dist/cjs/augments/runtime-type-of.d.ts +0 -20
- package/dist/cjs/augments/string/url.d.ts +0 -8
- package/dist/cjs/augments/string/uuid.d.ts +0 -2
- package/dist/cjs/augments/truncate-number.d.ts +0 -20
- package/dist/cjs/augments/tuple.d.ts +0 -9
- package/dist/cjs/augments/type.d.ts +0 -60
- package/dist/cjs/index.d.ts +0 -32
- package/dist/esm/augments/ansi.d.ts +0 -2
- package/dist/esm/augments/array.d.ts +0 -14
- package/dist/esm/augments/async.d.ts +0 -15
- package/dist/esm/augments/common-number.d.ts +0 -26
- package/dist/esm/augments/common-string.d.ts +0 -45
- package/dist/esm/augments/date/date.d.ts +0 -27
- package/dist/esm/augments/date/relative-date.d.ts +0 -12
- package/dist/esm/augments/environment.d.ts +0 -2
- package/dist/esm/augments/error.d.ts +0 -11
- package/dist/esm/augments/function.d.ts +0 -27
- package/dist/esm/augments/json-compatible.d.ts +0 -23
- package/dist/esm/augments/json.d.ts +0 -6
- package/dist/esm/augments/object/enum.d.ts +0 -5
- package/dist/esm/augments/object/filter-object.d.ts +0 -5
- package/dist/esm/augments/object/has-key.d.ts +0 -2
- package/dist/esm/augments/object/jsonify.d.ts +0 -3
- package/dist/esm/augments/object/map-object.d.ts +0 -25
- package/dist/esm/augments/object/matches-object-shape.d.ts +0 -37
- package/dist/esm/augments/object/nested-keys.d.ts +0 -12
- package/dist/esm/augments/object/object-entries.d.ts +0 -6
- package/dist/esm/augments/object/object.d.ts +0 -13
- package/dist/esm/augments/object/pick-deep.d.ts +0 -8
- package/dist/esm/augments/object/typed-has-property.d.ts +0 -8
- package/dist/esm/augments/promise.d.ts +0 -28
- package/dist/esm/augments/regexp.d.ts +0 -4
- package/dist/esm/augments/runtime-type-of.d.ts +0 -20
- package/dist/esm/augments/string/url.d.ts +0 -8
- package/dist/esm/augments/string/uuid.d.ts +0 -2
- package/dist/esm/augments/truncate-number.d.ts +0 -20
- package/dist/esm/augments/tuple.d.ts +0 -9
- package/dist/esm/augments/type.d.ts +0 -60
- package/dist/esm/index.d.ts +0 -32
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
export declare function wait(delayMs: number): Promise<void>;
|
|
2
|
-
export declare function waitValue<ResolutionValue>(delayMs: number, returnValue: ResolutionValue): Promise<ResolutionValue>;
|
|
3
|
-
export declare function isPromiseLike<T>(input: T | unknown): input is T extends PromiseLike<infer ValueType> ? PromiseLike<ValueType> : PromiseLike<unknown>;
|
|
4
|
-
export type UnPromise<T> = T extends PromiseLike<infer PromiseType> ? Awaited<PromiseType> : T;
|
|
5
|
-
export type MaybePromise<T> = Promise<UnPromise<T>> | UnPromise<T>;
|
|
6
|
-
export declare class PromiseTimeoutError extends Error {
|
|
7
|
-
readonly durationMs: number;
|
|
8
|
-
readonly message: string;
|
|
9
|
-
readonly name = "PromiseTimeoutError";
|
|
10
|
-
constructor(durationMs: number, message?: string);
|
|
11
|
-
}
|
|
12
|
-
export declare function wrapPromiseInTimeout<PromiseValueType>(durationMs: number, originalPromise: PromiseLike<PromiseValueType>): Promise<PromiseValueType>;
|
|
13
|
-
/** A promise which can be resolved or rejected by external code. */
|
|
14
|
-
export type DeferredPromiseWrapper<T> = {
|
|
15
|
-
promise: Promise<T>;
|
|
16
|
-
resolve: (value: T | PromiseLike<T>) => void;
|
|
17
|
-
reject: (reason?: any) => void;
|
|
18
|
-
isSettled: () => boolean;
|
|
19
|
-
};
|
|
20
|
-
export declare function createDeferredPromiseWrapper<T = void>(): DeferredPromiseWrapper<T>;
|
|
21
|
-
export type WaitForConditionInputs = {
|
|
22
|
-
conditionCallback: () => boolean | Promise<boolean>;
|
|
23
|
-
timeoutMs?: number;
|
|
24
|
-
intervalMs?: number;
|
|
25
|
-
timeoutMessage?: string;
|
|
26
|
-
};
|
|
27
|
-
export declare function waitForCondition({ conditionCallback, timeoutMs, intervalMs, timeoutMessage, }: WaitForConditionInputs): Promise<void>;
|
|
28
|
-
//# sourceMappingURL=promise.d.ts.map
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { AnyFunction } from './function';
|
|
2
|
-
declare function rawGetTypeOf(x: any): "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function";
|
|
3
|
-
type RawTypeOf = ReturnType<typeof rawGetTypeOf>;
|
|
4
|
-
export type RuntimeTypeOf = RawTypeOf | 'array';
|
|
5
|
-
export type RuntimeTypeOfMapping = {
|
|
6
|
-
array: any[] | ReadonlyArray<any>;
|
|
7
|
-
bigint: bigint;
|
|
8
|
-
boolean: boolean;
|
|
9
|
-
function: AnyFunction | Readonly<AnyFunction>;
|
|
10
|
-
number: number;
|
|
11
|
-
object: Record<PropertyKey, unknown> | Readonly<Record<PropertyKey, unknown>>;
|
|
12
|
-
string: string;
|
|
13
|
-
symbol: symbol;
|
|
14
|
-
undefined: undefined;
|
|
15
|
-
};
|
|
16
|
-
export declare function getRuntimeTypeOf(input: unknown): RuntimeTypeOf;
|
|
17
|
-
export declare function isRuntimeTypeOf<T extends RuntimeTypeOf>(input: unknown, testType: T): input is RuntimeTypeOfMapping[T];
|
|
18
|
-
export declare function assertRuntimeTypeOf<T extends RuntimeTypeOf>(input: unknown, testType: T, inputName: string): asserts input is RuntimeTypeOfMapping[T];
|
|
19
|
-
export {};
|
|
20
|
-
//# sourceMappingURL=runtime-type-of.d.ts.map
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Joins all given arguments together as if they were parts of a URL. Preserves trailing slashes and
|
|
3
|
-
* removes consecutive slashes in the path. This also encodes each URL part.
|
|
4
|
-
*
|
|
5
|
-
* @example: joinToUrl('https://example.com', 'path1', 'path2/', '/path3/') === 'https://example.com/path1/path2/path3/'
|
|
6
|
-
*/
|
|
7
|
-
export declare function joinUrlParts(...urlParts: ReadonlyArray<string>): string;
|
|
8
|
-
//# sourceMappingURL=url.d.ts.map
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This truncates a number such that is will at a max have 6 characters including suffix, decimal
|
|
3
|
-
* point, or comma.
|
|
4
|
-
*
|
|
5
|
-
* Default suffixes are:
|
|
6
|
-
*
|
|
7
|
-
* 'k', // thousand
|
|
8
|
-
* 'M', // million
|
|
9
|
-
* 'B', // billion
|
|
10
|
-
* 'T', // trillion
|
|
11
|
-
* 'P', // peta-, quadrillion
|
|
12
|
-
* 'E', // exa- quintillion
|
|
13
|
-
* 'Z', // zetta- sextillion
|
|
14
|
-
* 'Y', // yotta- septillion
|
|
15
|
-
*/
|
|
16
|
-
export declare function truncateNumber(originalValue: Readonly<unknown>, { customSuffixes, maxLength, }?: Partial<{
|
|
17
|
-
customSuffixes: ReadonlyArray<string> | undefined;
|
|
18
|
-
maxLength: number | undefined;
|
|
19
|
-
}>): string;
|
|
20
|
-
//# sourceMappingURL=truncate-number.d.ts.map
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export type Tuple<ArrayElementGeneric, LengthGeneric extends number> = LengthGeneric extends LengthGeneric ? number extends LengthGeneric ? ArrayElementGeneric[] : _TupleOf<ArrayElementGeneric, LengthGeneric, []> : never;
|
|
2
|
-
type _TupleOf<ArrayElementGeneric, LengthGeneric extends number, FullArrayGeneric extends unknown[]> = FullArrayGeneric['length'] extends LengthGeneric ? FullArrayGeneric : _TupleOf<ArrayElementGeneric, LengthGeneric, [ArrayElementGeneric, ...FullArrayGeneric]>;
|
|
3
|
-
export type AtLeastTuple<ArrayElementGeneric, LengthGeneric extends number> = readonly [
|
|
4
|
-
...Tuple<ArrayElementGeneric, LengthGeneric>,
|
|
5
|
-
...(ArrayElementGeneric | undefined)[]
|
|
6
|
-
];
|
|
7
|
-
export declare function isLengthAtLeast<ArrayElementGeneric, LengthGeneric extends number>(array: ReadonlyArray<ArrayElementGeneric | undefined>, length: LengthGeneric): array is AtLeastTuple<ArrayElementGeneric, LengthGeneric>;
|
|
8
|
-
export {};
|
|
9
|
-
//# sourceMappingURL=tuple.d.ts.map
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { Except, Simplify } from 'type-fest';
|
|
2
|
-
/** Makes all properties in an object writable. This is the opposite of Readonly<> */
|
|
3
|
-
export type Writeable<T> = {
|
|
4
|
-
-readonly [P in keyof T]: T[P];
|
|
5
|
-
};
|
|
6
|
-
/** Makes all property values in an object also readonly. Can cause issues on primitive. */
|
|
7
|
-
export type DeepWriteable<T> = {
|
|
8
|
-
-readonly [P in keyof T]: DeepWriteable<T[P]>;
|
|
9
|
-
};
|
|
10
|
-
/** Replace properties in T with properties in U. */
|
|
11
|
-
export type Overwrite<T, U> = Pick<T, Exclude<keyof T, keyof U>> & U;
|
|
12
|
-
/** Extract the element type out of an array type. */
|
|
13
|
-
export type ArrayElement<ArrayType extends ReadonlyArray<any>> = ArrayType[number];
|
|
14
|
-
/**
|
|
15
|
-
* Same as the Required<> built-in type helper but this requires that each property be present and
|
|
16
|
-
* be not null.
|
|
17
|
-
*/
|
|
18
|
-
export type RequiredAndNotNull<T> = {
|
|
19
|
-
[P in keyof T]-?: NonNullable<T[P]>;
|
|
20
|
-
};
|
|
21
|
-
export type SetOptionalAndNullable<OriginalObjectGeneric, OptionalKeysGeneric extends keyof OriginalObjectGeneric> = Simplify<Except<OriginalObjectGeneric, OptionalKeysGeneric> & {
|
|
22
|
-
[PropKey in OptionalKeysGeneric]?: OriginalObjectGeneric[PropKey] | null | undefined;
|
|
23
|
-
}>;
|
|
24
|
-
/** Require only a subset of object properties. */
|
|
25
|
-
export type RequiredBy<T, K extends keyof T> = Overwrite<T, Required<Pick<T, K>>>;
|
|
26
|
-
export declare function makeWritable<T>(input: T): Writeable<T>;
|
|
27
|
-
export declare function makeReadonly<T>(input: T): Readonly<T>;
|
|
28
|
-
/**
|
|
29
|
-
* Require only a subset of object properties and require that they be not null. This is
|
|
30
|
-
* particularly useful in conjunction with the "exactOptionalPropertyTypes" tsconfig flag.
|
|
31
|
-
*/
|
|
32
|
-
export type RequiredAndNotNullBy<T, K extends keyof T> = Omit<T, K> & Required<{
|
|
33
|
-
[PropertyName in K]: NonNullable<T[PropertyName]>;
|
|
34
|
-
}>;
|
|
35
|
-
/** If type T = type U, then type Y. Else type N. */
|
|
36
|
-
export type IfEquals<T, U, Y = unknown, N = never> = (<G>() => G extends T ? 1 : 2) extends <G>() => G extends U ? 1 : 2 ? Y : N;
|
|
37
|
-
/**
|
|
38
|
-
* This function returns another function that simply returns whatever input it's given. However, it
|
|
39
|
-
* also checks that the input matches the original wrapNarrowTypeWithTypeCheck's generic, while
|
|
40
|
-
* maintaining strict "const" like typing.
|
|
41
|
-
*
|
|
42
|
-
* Use like this: wrapNarrowTypeWithTypeCheck<EnforcedTypeHere>()(valueToEnforceTypeOn as const)
|
|
43
|
-
*
|
|
44
|
-
* Sometimes "as const" isn't required, usually it is for any object or array though.
|
|
45
|
-
*/
|
|
46
|
-
export declare function wrapNarrowTypeWithTypeCheck<P>(): <T extends P>(input: T) => Readonly<T>;
|
|
47
|
-
/**
|
|
48
|
-
* This type helper is useful for forcing function generics to be explicitly provided, rather than
|
|
49
|
-
* inferring them from the given inputs. See the test file for examples.
|
|
50
|
-
*/
|
|
51
|
-
export type NoInfer<T> = [T][T extends any ? 0 : never];
|
|
52
|
-
/**
|
|
53
|
-
* This is a type helper that ensures the given input matches the given generic type. The generic is
|
|
54
|
-
* setup in such a way that if it is omitted (which is typically allowed in TypeScript, resulting in
|
|
55
|
-
* the generic being inferred from the inputs), there will actually be a type error. This forces
|
|
56
|
-
* each usage of this function to explicitly specify the generic, thus giving us type safety for the
|
|
57
|
-
* input.
|
|
58
|
-
*/
|
|
59
|
-
export declare function ensureType<ExpectedType = never>(input: NoInfer<ExpectedType>): NoInfer<ExpectedType>;
|
|
60
|
-
//# sourceMappingURL=type.d.ts.map
|
package/dist/cjs/index.d.ts
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
export * from './augments/ansi';
|
|
2
|
-
export * from './augments/array';
|
|
3
|
-
export * from './augments/async';
|
|
4
|
-
export * from './augments/common-number';
|
|
5
|
-
export * from './augments/common-string';
|
|
6
|
-
export * from './augments/date/date';
|
|
7
|
-
export * from './augments/date/relative-date';
|
|
8
|
-
export * from './augments/environment';
|
|
9
|
-
export * from './augments/error';
|
|
10
|
-
export * from './augments/function';
|
|
11
|
-
export * from './augments/json';
|
|
12
|
-
export * from './augments/json-compatible';
|
|
13
|
-
export * from './augments/object/enum';
|
|
14
|
-
export * from './augments/object/filter-object';
|
|
15
|
-
export * from './augments/object/has-key';
|
|
16
|
-
export * from './augments/object/jsonify';
|
|
17
|
-
export * from './augments/object/map-object';
|
|
18
|
-
export * from './augments/object/matches-object-shape';
|
|
19
|
-
export * from './augments/object/nested-keys';
|
|
20
|
-
export * from './augments/object/object';
|
|
21
|
-
export * from './augments/object/object-entries';
|
|
22
|
-
export * from './augments/object/pick-deep';
|
|
23
|
-
export * from './augments/object/typed-has-property';
|
|
24
|
-
export * from './augments/promise';
|
|
25
|
-
export * from './augments/regexp';
|
|
26
|
-
export * from './augments/runtime-type-of';
|
|
27
|
-
export * from './augments/string/url';
|
|
28
|
-
export * from './augments/string/uuid';
|
|
29
|
-
export * from './augments/truncate-number';
|
|
30
|
-
export * from './augments/tuple';
|
|
31
|
-
export * from './augments/type';
|
|
32
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { AtLeastTuple } from './tuple';
|
|
2
|
-
import { ArrayElement } from './type';
|
|
3
|
-
export declare function filterOutIndexes<T>(array: ReadonlyArray<T>, indexes: ReadonlyArray<number>): T[];
|
|
4
|
-
export declare function flatten2dArray<T>(array2d: ReadonlyArray<ReadonlyArray<T>>): T[];
|
|
5
|
-
export type AtLeastOneEntryArray<ArrayGeneric extends ReadonlyArray<any>> = AtLeastTuple<ArrayElement<ArrayGeneric>, 1>;
|
|
6
|
-
export declare function trimArrayStrings(input: ReadonlyArray<string>): string[];
|
|
7
|
-
export declare function typedArrayIncludes<T>(array: ReadonlyArray<T>, input: unknown): input is T;
|
|
8
|
-
type MapCallbackType<ArrayType extends ReadonlyArray<any>, OutputType> = (value: ArrayElement<ArrayType>, index: number, array: ArrayType) => OutputType;
|
|
9
|
-
/** Preserves tuple types. */
|
|
10
|
-
export declare function typedMap<InputArrayGeneric extends ReadonlyArray<any>, OutputType>(arrayToMap: InputArrayGeneric, mapCallback: MapCallbackType<InputArrayGeneric, OutputType>): {
|
|
11
|
-
[Index in keyof InputArrayGeneric]: OutputType;
|
|
12
|
-
};
|
|
13
|
-
export {};
|
|
14
|
-
//# sourceMappingURL=array.d.ts.map
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Acts like calling Array.prototype.forEach in that all elements are executed upon in order, and
|
|
3
|
-
* each execution is blocking. Meaning, the callback won't be called on element 2 until the callback
|
|
4
|
-
* has finished its call on element 1.
|
|
5
|
-
*/
|
|
6
|
-
export declare function awaitedForEach<OriginalGeneric>(input: ReadonlyArray<OriginalGeneric>, callback: (arrayElement: OriginalGeneric, index: number, wholeArray: ReadonlyArray<OriginalGeneric>) => void | PromiseLike<void>): Promise<void>;
|
|
7
|
-
export declare function awaitedBlockingMap<OriginalGeneric, MappedGeneric>(input: ReadonlyArray<OriginalGeneric>, callback: (arrayElement: OriginalGeneric, index: number, wholeArray: ReadonlyArray<OriginalGeneric>) => MappedGeneric | PromiseLike<MappedGeneric>): Promise<Awaited<MappedGeneric>[]>;
|
|
8
|
-
export declare function awaitedFilter<OriginalGeneric>(arrayInput: ReadonlyArray<OriginalGeneric>, filterCallback: (arrayElement: OriginalGeneric, index: number, wholeArray: ReadonlyArray<OriginalGeneric>) => Promise<unknown>, options?: {
|
|
9
|
-
/**
|
|
10
|
-
* Each call to the filter callback is blocking, meaning the next one won't start until the
|
|
11
|
-
* current one finishes. By default this is false.
|
|
12
|
-
*/
|
|
13
|
-
blocking?: boolean | undefined;
|
|
14
|
-
}): Promise<OriginalGeneric[]>;
|
|
15
|
-
//# sourceMappingURL=async.d.ts.map
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
export declare const NaNString: string;
|
|
2
|
-
export declare function addCommasToNumber(input: number | string): string;
|
|
3
|
-
export declare function clamp(
|
|
4
|
-
/**
|
|
5
|
-
* This uses a destructured object so that consumers cannot get confused as to which input is
|
|
6
|
-
* which (which would be easy to do since they're all of the same type).
|
|
7
|
-
*/
|
|
8
|
-
{ value, min, max, }: {
|
|
9
|
-
value: number;
|
|
10
|
-
min: number;
|
|
11
|
-
max: number;
|
|
12
|
-
}): number;
|
|
13
|
-
export declare function convertIntoNumber(input: unknown): number;
|
|
14
|
-
export declare function doesRequireScientificNotation(input: number): boolean;
|
|
15
|
-
/**
|
|
16
|
-
* Given a min and max, ensures that they are in correct order. Meaning, min is less than max. If
|
|
17
|
-
* that is not the case, the returned value is the given min and max values swapped.
|
|
18
|
-
*/
|
|
19
|
-
export declare function ensureMinAndMax({ min, max }: {
|
|
20
|
-
min: number;
|
|
21
|
-
max: number;
|
|
22
|
-
}): {
|
|
23
|
-
min: number;
|
|
24
|
-
max: number;
|
|
25
|
-
};
|
|
26
|
-
//# sourceMappingURL=common-number.d.ts.map
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { AtLeastTuple } from './tuple';
|
|
2
|
-
/**
|
|
3
|
-
* Join elements into a string with commas separating each value. Add a conjunction before the final
|
|
4
|
-
* item in the list. If the array has a length < 2, the conjunction is not added. If the list is
|
|
5
|
-
* only of length 2, then no commas are added.
|
|
6
|
-
*
|
|
7
|
-
* @param list Array of items to be converted into strings. Works best if these are simply strings
|
|
8
|
-
* to begin with.
|
|
9
|
-
* @param conjunction Defaults to 'and'. The conjunction to be used before the final element.
|
|
10
|
-
*/
|
|
11
|
-
export declare function joinWithFinalConjunction(list: ReadonlyArray<any>, conjunction?: string): string;
|
|
12
|
-
export declare function removeAnsiEscapeCodes(input: string): string;
|
|
13
|
-
export declare const removeColor: typeof removeAnsiEscapeCodes;
|
|
14
|
-
export declare function removeCommasFromNumberString(numberString: string): string;
|
|
15
|
-
/** Collapse all consecutive white space into just one space and trim surrounding whitespace. */
|
|
16
|
-
export declare function collapseWhiteSpace(input: string): string;
|
|
17
|
-
/** Same as String.prototype.split but includes the delimiter to split by in the output array. */
|
|
18
|
-
export declare function splitIncludeSplit(original: string, splitterInput: string | RegExp, caseSensitive: boolean): readonly string[];
|
|
19
|
-
export type CasingOptions = {
|
|
20
|
-
capitalizeFirstLetter: boolean;
|
|
21
|
-
};
|
|
22
|
-
export declare function capitalizeFirstLetter<InputGeneric extends string>(input: InputGeneric): Capitalize<InputGeneric>;
|
|
23
|
-
export declare function kebabCaseToCamelCase(rawKebabCase: string, casingOptions?: Partial<CasingOptions> | undefined): string;
|
|
24
|
-
export declare function camelCaseToKebabCase(rawCamelCase: string): string;
|
|
25
|
-
export declare function replaceStringAtIndex(originalString: string, start: number, newString: string, length?: number): string;
|
|
26
|
-
/**
|
|
27
|
-
* Escapes characters from the given string so that it can be used within a RegExp without being
|
|
28
|
-
* parsed as RegExp syntax.
|
|
29
|
-
*/
|
|
30
|
-
export declare function escapeStringForRegExp(input: string): string;
|
|
31
|
-
export declare function getAllIndexesOf<IncludeLength extends boolean | undefined>({ searchIn, searchFor, caseSensitive, includeLength, }: {
|
|
32
|
-
searchIn: string;
|
|
33
|
-
searchFor: string | RegExp;
|
|
34
|
-
/**
|
|
35
|
-
* CaseSensitive only applies when the input is a string. Otherwise, the RegExp's "i" flag is
|
|
36
|
-
* used to determine case sensitivity.
|
|
37
|
-
*/
|
|
38
|
-
caseSensitive: boolean;
|
|
39
|
-
includeLength?: IncludeLength;
|
|
40
|
-
}): IncludeLength extends true ? {
|
|
41
|
-
index: number;
|
|
42
|
-
length: number;
|
|
43
|
-
}[] : number[];
|
|
44
|
-
export declare function typedSplit(input: string, splitString: string): AtLeastTuple<string, 1>;
|
|
45
|
-
//# sourceMappingURL=common-string.d.ts.map
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
export declare const englishFullMonthNames: readonly ["january", "february", "march", "april", "may", "june", "july", "august", "september", "october", "november", "december"];
|
|
2
|
-
export declare const englishShortMonthNames: string[];
|
|
3
|
-
export declare class InvalidDateError extends Error {
|
|
4
|
-
readonly name = "InvalidDateError";
|
|
5
|
-
}
|
|
6
|
-
/**
|
|
7
|
-
* @param slashFormatString String that should be of format "MM/DD/YY", "MM/DD/YYYY". When the year
|
|
8
|
-
* portion only contains 2 numbers ("MM/DD/YY") the century must be provided in the form of the
|
|
9
|
-
* yearPrefix input.
|
|
10
|
-
* @param yearPrefix String or number that is used to prefix slash format strings that only contain
|
|
11
|
-
* 2 digits ("MM/DD/YY"). If the year is entirely missing form the given slash format string, the
|
|
12
|
-
* year will default to year 00 of the given century. See test file for examples.
|
|
13
|
-
*/
|
|
14
|
-
export declare function createDateFromSlashFormat(slashFormatString: string, yearPrefix?: number | string): Date;
|
|
15
|
-
/**
|
|
16
|
-
* @param commaFormatString Should be at string of the form "monthName dayNumber, fullYear" Example:
|
|
17
|
-
* "May 19, 2005"
|
|
18
|
-
* @param ignoreInvalidMonth Set to true to ignore invalid months and just use the current UTC month
|
|
19
|
-
*/
|
|
20
|
-
export declare function createDateFromNamedCommaFormat(commaFormatString: string, ignoreInvalidMonth?: boolean): Date;
|
|
21
|
-
/**
|
|
22
|
-
* Converts an iso-formatted string to a UTC date object. The time is nulled out to all zeros.
|
|
23
|
-
*
|
|
24
|
-
* @param isoFormatString Should be a date in the format YYYY-MM-DD.
|
|
25
|
-
*/
|
|
26
|
-
export declare function createDateFromUtcIsoFormat(isoFormatString: string): Date;
|
|
27
|
-
//# sourceMappingURL=date.d.ts.map
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { PartialAndUndefined } from '../..';
|
|
2
|
-
export type RelativeDateCalculation = PartialAndUndefined<{
|
|
3
|
-
milliseconds: number;
|
|
4
|
-
seconds: number;
|
|
5
|
-
minutes: number;
|
|
6
|
-
hours: number;
|
|
7
|
-
days: number;
|
|
8
|
-
months: number;
|
|
9
|
-
years: number;
|
|
10
|
-
}>;
|
|
11
|
-
export declare function calculateRelativeDate(startingDate: Date | number | string, calculations: RelativeDateCalculation): Date;
|
|
12
|
-
//# sourceMappingURL=relative-date.d.ts.map
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { AtLeastTuple, NoInputsFunction, UnPromise } from '..';
|
|
2
|
-
export declare function combineErrors(errors: AtLeastTuple<Error, 1>): Error;
|
|
3
|
-
export declare function combineErrors(errors: ReadonlyArray<never>): undefined;
|
|
4
|
-
export declare function combineErrors(errors: ReadonlyArray<Error>): Error | undefined;
|
|
5
|
-
export declare function combineErrors(errors?: undefined): undefined;
|
|
6
|
-
export declare function combineErrorMessages(errors?: ReadonlyArray<Error | string | undefined> | undefined): string;
|
|
7
|
-
export declare function extractErrorMessage(error: unknown): string;
|
|
8
|
-
export declare function ensureError(input: unknown): Error;
|
|
9
|
-
export declare function executeAndReturnError<CallbackGeneric extends NoInputsFunction<PromiseLike<any>>>(callback: CallbackGeneric): Promise<Error | UnPromise<ReturnType<CallbackGeneric>>>;
|
|
10
|
-
export declare function executeAndReturnError<CallbackGeneric extends NoInputsFunction>(callback: CallbackGeneric): Error | ReturnType<CallbackGeneric>;
|
|
11
|
-
//# sourceMappingURL=error.d.ts.map
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { ArrayElement } from './type';
|
|
2
|
-
export type AnyFunction<ReturnGeneric = any> = (...args: any[]) => ReturnGeneric;
|
|
3
|
-
export type NoInputsFunction<ReturnGeneric = any> = () => ReturnGeneric;
|
|
4
|
-
/**
|
|
5
|
-
* Accepts an "Arguments" and "Return" generic to quickly make a function type. If "Arguments" is an
|
|
6
|
-
* array, it is spread into the full function's Parameters list. If any argument should be an array,
|
|
7
|
-
* instead of a rest parameter, put it inside of a tuple. If no arguments should be possible, pass
|
|
8
|
-
* void to "Arguments". If you need an optional argument, pass it inside of a tuple.
|
|
9
|
-
*
|
|
10
|
-
* @example
|
|
11
|
-
* TypedFunction<string, number>; // (input: string) => number
|
|
12
|
-
*
|
|
13
|
-
* @example
|
|
14
|
-
* TypedFunction<string[], number>; // (...inputs: string[]) => number
|
|
15
|
-
*
|
|
16
|
-
* @example
|
|
17
|
-
* TypedFunction<[string[]], number>; // (input: string[]) => number
|
|
18
|
-
*
|
|
19
|
-
* @example
|
|
20
|
-
* TypedFunction<[string, number], number>; // (input1: string, input2: number) => number
|
|
21
|
-
*
|
|
22
|
-
* @example
|
|
23
|
-
* TypedFunction<[string | undefined], number>; // (input1: string|undefined) => number
|
|
24
|
-
*/
|
|
25
|
-
export type TypedFunction<Arguments, Return> = Arguments extends readonly any[] ? number extends Arguments['length'] ? (...args: ArrayElement<Arguments>[]) => Return : (...args: Arguments) => Return : void extends Arguments ? () => Return : (arg: Arguments) => Return;
|
|
26
|
-
export declare function isTruthy<T>(input: T): input is NonNullable<T>;
|
|
27
|
-
//# sourceMappingURL=function.d.ts.map
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { Jsonify, Primitive } from 'type-fest';
|
|
2
|
-
/**
|
|
3
|
-
* These are similar in purpose, name, and structure to type-fest's JsonValue types but these are
|
|
4
|
-
* permissive. The goal here is to allow any types that do not get serialized into just empty
|
|
5
|
-
* objects. (For example, JSON.stringify(new Map()) returns "{}", so we don't want to allow that
|
|
6
|
-
* type.)
|
|
7
|
-
*/
|
|
8
|
-
export type JsonCompatiblePrimitiveValue = Jsonify<Primitive> | undefined;
|
|
9
|
-
export type JsonCompatibleObject = Partial<{
|
|
10
|
-
readonly [key: string | number]: JsonCompatibleValue | Readonly<JsonCompatibleValue>;
|
|
11
|
-
}> | Partial<{
|
|
12
|
-
[key: string | number]: JsonCompatibleValue | Readonly<JsonCompatibleValue>;
|
|
13
|
-
}>;
|
|
14
|
-
export type JsonCompatibleArray = JsonCompatibleValue[]
|
|
15
|
-
/**
|
|
16
|
-
* This weird readonly with object syntax for an array type is so that TypeScript doesn't
|
|
17
|
-
* complain about JsonCompatibleArray circularly referencing itself
|
|
18
|
-
*/
|
|
19
|
-
| ({
|
|
20
|
-
readonly [P in number]: JsonCompatibleValue;
|
|
21
|
-
} & ReadonlyArray<any>);
|
|
22
|
-
export type JsonCompatibleValue = JsonCompatiblePrimitiveValue | JsonCompatibleObject | JsonCompatibleArray;
|
|
23
|
-
//# sourceMappingURL=json-compatible.d.ts.map
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export declare function parseJson<ParsedJsonGeneric>({ jsonString, errorHandler, shapeMatcher, }: {
|
|
2
|
-
jsonString: string;
|
|
3
|
-
errorHandler?: (error: unknown) => never | ParsedJsonGeneric;
|
|
4
|
-
shapeMatcher?: ParsedJsonGeneric;
|
|
5
|
-
}): ParsedJsonGeneric;
|
|
6
|
-
//# sourceMappingURL=json.d.ts.map
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export declare function getEnumTypedKeys<T extends object>(input: T): (keyof T)[];
|
|
2
|
-
export declare function getEnumTypedValues<T extends object>(input: T): T[keyof T][];
|
|
3
|
-
export declare function isEnumValue<T extends object>(input: unknown, checkEnum: T): input is T[keyof T];
|
|
4
|
-
export declare function filterToEnumValues<T extends object>(inputs: ReadonlyArray<unknown>, checkEnum: T, caseInsensitive?: boolean): T[keyof T][];
|
|
5
|
-
//# sourceMappingURL=enum.d.ts.map
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { PropertyValueType } from './object';
|
|
2
|
-
export declare function filterObject<ObjectGeneric>(inputObject: ObjectGeneric, callback: (key: keyof ObjectGeneric, value: PropertyValueType<ObjectGeneric>, fullObject: ObjectGeneric) => boolean): Partial<ObjectGeneric>;
|
|
3
|
-
export declare function omitObjectKeys<ObjectGeneric, KeyGeneric extends keyof ObjectGeneric>(inputObject: Readonly<ObjectGeneric>, omitTheseKeys: ReadonlyArray<KeyGeneric>): Omit<ObjectGeneric, KeyGeneric>;
|
|
4
|
-
export declare function pickObjectKeys<ObjectGeneric, KeyGeneric extends keyof ObjectGeneric>(inputObject: Readonly<ObjectGeneric>, pickTheseKeys: ReadonlyArray<KeyGeneric>): Pick<ObjectGeneric, KeyGeneric>;
|
|
5
|
-
//# sourceMappingURL=filter-object.d.ts.map
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { PropertyValueType, UnPromise } from '../..';
|
|
2
|
-
export type InnerMappedValues<EntireInputGeneric extends object, MappedValueGeneric> = {
|
|
3
|
-
[MappedProp in keyof EntireInputGeneric]: MappedValueGeneric;
|
|
4
|
-
};
|
|
5
|
-
export type MappedValues<EntireInputGeneric extends object, MappedValueGeneric> = MappedValueGeneric extends PromiseLike<unknown> ? Promise<InnerMappedValues<EntireInputGeneric, UnPromise<MappedValueGeneric>>> : InnerMappedValues<EntireInputGeneric, UnPromise<MappedValueGeneric>>;
|
|
6
|
-
/**
|
|
7
|
-
* Map an object's keys to new values synchronously. This is different from plain mapObjectValues in
|
|
8
|
-
* that this will not wrap the return value in a promise if any of the new object values are
|
|
9
|
-
* promises. This function also requires currying in order to get the types correct. This allows you
|
|
10
|
-
* to explicitly state the return type.
|
|
11
|
-
*
|
|
12
|
-
* @example
|
|
13
|
-
* mapObjectValuesSync({objectToIterateOver: 'initial value'})<{objectToIterateOver: number}>(
|
|
14
|
-
* (key, value) => ({
|
|
15
|
-
* newValue: value.length,
|
|
16
|
-
* }),
|
|
17
|
-
* );
|
|
18
|
-
*/
|
|
19
|
-
export declare function mapObjectValuesSync<EntireInputGeneric extends object>(inputObject: EntireInputGeneric): <OutputObjectGeneric extends object>(mapCallback: (inputKey: keyof EntireInputGeneric, keyValue: EntireInputGeneric[keyof EntireInputGeneric], fullObject: EntireInputGeneric) => never extends PropertyValueType<OutputObjectGeneric> ? any : PropertyValueType<OutputObjectGeneric>) => OutputObjectGeneric;
|
|
20
|
-
/**
|
|
21
|
-
* Creates a new object with the same properties as the input object, but with values set to the
|
|
22
|
-
* result of mapCallback for each property.
|
|
23
|
-
*/
|
|
24
|
-
export declare function mapObjectValues<EntireInputGeneric extends object, MappedValueGeneric>(inputObject: EntireInputGeneric, mapCallback: (inputKey: keyof EntireInputGeneric, keyValue: EntireInputGeneric[typeof inputKey], fullObject: EntireInputGeneric) => MappedValueGeneric): MappedValues<EntireInputGeneric, MappedValueGeneric>;
|
|
25
|
-
//# sourceMappingURL=map-object.d.ts.map
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { AtLeastOneEntryArray } from '../array';
|
|
2
|
-
import { NoInfer } from '../type';
|
|
3
|
-
/**
|
|
4
|
-
* Checks that the first input, testThisOne, matches the object shape of the second input,
|
|
5
|
-
* compareToThisOne. Does not compare exact values of properties, only types.
|
|
6
|
-
*
|
|
7
|
-
* To allow the test input, the first input, to have additional keys that the compare input, the
|
|
8
|
-
* second input, does not have, pass in a third argument set to true.
|
|
9
|
-
*
|
|
10
|
-
* This function REQUIRES a generic to be assigned to it: it cannot infer it from the inputs.
|
|
11
|
-
*
|
|
12
|
-
* The compare input, the second input, is required to have at least one entry in every array value
|
|
13
|
-
* that exists. If more array values are present, they will be considered other possible types for
|
|
14
|
-
* entries in that array.
|
|
15
|
-
*/
|
|
16
|
-
export declare function matchesObjectShape<MatchThisGeneric extends object>(testThisOne: unknown, compareToThisOne: NoInfer<ObjectWithAtLeastSingleEntryArrays<MatchThisGeneric>>, allowExtraProps?: boolean, shouldLogWhy?: boolean): testThisOne is MatchThisGeneric;
|
|
17
|
-
export type ObjectWithAtLeastSingleEntryArrays<BaseObject extends object> = {
|
|
18
|
-
[Prop in keyof BaseObject]: BaseObject[Prop] extends ReadonlyArray<any> ? AtLeastOneEntryArray<BaseObject[Prop]> : BaseObject[Prop] extends object ? ObjectWithAtLeastSingleEntryArrays<BaseObject[Prop]> : BaseObject[Prop];
|
|
19
|
-
};
|
|
20
|
-
export type NestedBoolean<MatchObject extends object> = Partial<{
|
|
21
|
-
[Prop in keyof MatchObject]: MatchObject[Prop] extends object ? NestedBoolean<MatchObject[Prop]> | boolean : boolean;
|
|
22
|
-
}>;
|
|
23
|
-
/**
|
|
24
|
-
* Asserts that the first input, testThisOne, matches the object shape of the second input,
|
|
25
|
-
* compareToThisOne. Does not compare exact values of properties, only types.
|
|
26
|
-
*
|
|
27
|
-
* To allow the test input, the first input, to have additional keys that the compare input, the
|
|
28
|
-
* second input, does not have, pass in a third argument set to true.
|
|
29
|
-
*
|
|
30
|
-
* This function REQUIRES a generic to be assigned to it: it cannot infer it from the inputs.
|
|
31
|
-
*
|
|
32
|
-
* The compare input, the second input, is required to have at least one entry in every array value
|
|
33
|
-
* that exists. If more array values are present, they will be considered other possible types for
|
|
34
|
-
* entries in that array.
|
|
35
|
-
*/
|
|
36
|
-
export declare function assertMatchesObjectShape<MatchThisGeneric extends object = never>(testThisOne: unknown, compareToThisOne: NoInfer<ObjectWithAtLeastSingleEntryArrays<MatchThisGeneric>>, allowExtraProps?: boolean, noCheckInnerValueOfTheseKeys?: NestedBoolean<typeof compareToThisOne>): asserts testThisOne is MatchThisGeneric;
|
|
37
|
-
//# sourceMappingURL=matches-object-shape.d.ts.map
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { UnionToIntersection } from 'type-fest';
|
|
2
|
-
import { PropertyValueType } from './object';
|
|
3
|
-
export type NestedSequentialKeys<ObjectGeneric extends object> = PropertyValueType<{
|
|
4
|
-
[Prop in keyof ObjectGeneric]: NonNullable<ObjectGeneric[Prop]> extends object ? [Prop, ...(NestedSequentialKeys<NonNullable<ObjectGeneric[Prop]>> | [])] : [Prop];
|
|
5
|
-
}>;
|
|
6
|
-
export type NestedKeys<ObjectGeneric extends object> = UnionToIntersection<Extract<PropertyValueType<ObjectGeneric>, object>> extends object ? [
|
|
7
|
-
keyof ObjectGeneric,
|
|
8
|
-
...(NestedKeys<UnionToIntersection<Extract<PropertyValueType<ObjectGeneric>, object>>> | [])
|
|
9
|
-
] : [keyof ObjectGeneric];
|
|
10
|
-
export type NestedValue<ObjectGeneric extends object, NestedKeysGeneric extends NestedSequentialKeys<ObjectGeneric>> = NestedKeysGeneric extends readonly [infer FirstEntry, ...infer FollowingEntries] ? FirstEntry extends keyof ObjectGeneric ? FollowingEntries extends never[] ? ObjectGeneric[FirstEntry] : ObjectGeneric[FirstEntry] extends object ? FollowingEntries extends NestedSequentialKeys<ObjectGeneric[FirstEntry]> ? NestedValue<ObjectGeneric[FirstEntry], FollowingEntries> : never : never : never : never;
|
|
11
|
-
export declare function getValueFromNestedKeys<ObjectGeneric extends object, KeysGeneric extends NestedSequentialKeys<ObjectGeneric>>(inputObject: ObjectGeneric, nestedKeys: KeysGeneric): NestedValue<ObjectGeneric, KeysGeneric> | undefined;
|
|
12
|
-
//# sourceMappingURL=nested-keys.d.ts.map
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export declare function isKeyof<ObjectGeneric>(key: PropertyKey, object: ObjectGeneric): key is keyof ObjectGeneric;
|
|
2
|
-
export declare function getObjectTypedKeys<ObjectGeneric extends unknown>(input: ObjectGeneric): Array<keyof ObjectGeneric>;
|
|
3
|
-
export declare function getObjectTypedValues<ObjectGeneric extends unknown>(input: ObjectGeneric): ObjectGeneric[keyof ObjectGeneric][];
|
|
4
|
-
export declare function getEntriesSortedByKey(input: object): [string, unknown][];
|
|
5
|
-
export declare function typedObjectFromEntries<KeyType extends PropertyKey, ValueType>(entries: ReadonlyArray<Readonly<[KeyType, ValueType]>>): Record<KeyType, ValueType>;
|
|
6
|
-
//# sourceMappingURL=object-entries.d.ts.map
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { JsonCompatibleValue } from '../json-compatible';
|
|
2
|
-
export type PartialAndNullable<T extends object> = {
|
|
3
|
-
[Prop in keyof T]?: T[Prop] | null | undefined;
|
|
4
|
-
};
|
|
5
|
-
export type PartialAndUndefined<T extends object> = {
|
|
6
|
-
[Prop in keyof T]?: T[Prop] | undefined;
|
|
7
|
-
};
|
|
8
|
-
export declare function isObject(input: any): input is NonNullable<object>;
|
|
9
|
-
export declare function areJsonEqual(a: Readonly<JsonCompatibleValue | undefined>, b: Readonly<JsonCompatibleValue | undefined>): boolean;
|
|
10
|
-
/** The input here must be serializable otherwise JSON parsing errors will be thrown */
|
|
11
|
-
export declare function copyThroughJson<T>(input: T): T;
|
|
12
|
-
export type PropertyValueType<T> = T[keyof T];
|
|
13
|
-
//# sourceMappingURL=object.d.ts.map
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { UnionToIntersection } from 'type-fest';
|
|
2
|
-
import { NestedKeys } from './nested-keys';
|
|
3
|
-
type InnerPickDeep<OriginalObjectGeneric extends object, DeepKeys extends any[]> = UnionToIntersection<DeepKeys extends [infer CurrentLevelPick, ...infer RemainingKeys] ? {
|
|
4
|
-
[CurrentProp in Extract<CurrentLevelPick, keyof OriginalObjectGeneric>]: OriginalObjectGeneric[CurrentProp] extends object ? InnerPickDeep<OriginalObjectGeneric[CurrentProp], RemainingKeys> : OriginalObjectGeneric[CurrentProp];
|
|
5
|
-
} : DeepKeys extends [infer CurrentLevelPick] ? CurrentLevelPick extends keyof OriginalObjectGeneric ? Pick<OriginalObjectGeneric, CurrentLevelPick> : never : never>;
|
|
6
|
-
export type PickDeep<OriginalObjectGeneric extends object, DeepKeys extends NestedKeys<OriginalObjectGeneric>> = InnerPickDeep<OriginalObjectGeneric, DeepKeys>;
|
|
7
|
-
export {};
|
|
8
|
-
//# sourceMappingURL=pick-deep.d.ts.map
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { RequiredBy } from '../type';
|
|
2
|
-
type ExtractValue<KeyGeneric extends PropertyKey, ParentGeneric> = KeyGeneric extends keyof ParentGeneric ? RequiredBy<ParentGeneric, KeyGeneric>[KeyGeneric] : KeyGeneric extends keyof Extract<ParentGeneric, Record<KeyGeneric, any>> ? RequiredBy<Extract<ParentGeneric, Record<KeyGeneric, any>>, KeyGeneric>[KeyGeneric] : never;
|
|
3
|
-
type CombinedParentValue<KeyGeneric extends PropertyKey, ParentGeneric> = ExtractValue<KeyGeneric, ParentGeneric> extends never ? unknown : ExtractValue<KeyGeneric, ParentGeneric>;
|
|
4
|
-
type CombineTypeWithKey<KeyGeneric extends PropertyKey, ParentGeneric> = ParentGeneric & Record<KeyGeneric, CombinedParentValue<KeyGeneric, ParentGeneric>>;
|
|
5
|
-
export declare function typedHasProperty<KeyGeneric extends PropertyKey, ParentGeneric>(inputObject: ParentGeneric, inputKey: KeyGeneric): inputObject is CombineTypeWithKey<KeyGeneric, ParentGeneric>;
|
|
6
|
-
export declare function typedHasProperties<KeyGeneric extends PropertyKey, ParentGeneric>(inputObject: ParentGeneric, inputKeys: ReadonlyArray<KeyGeneric>): inputObject is CombineTypeWithKey<KeyGeneric, ParentGeneric>;
|
|
7
|
-
export {};
|
|
8
|
-
//# sourceMappingURL=typed-has-property.d.ts.map
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
export declare function wait(delayMs: number): Promise<void>;
|
|
2
|
-
export declare function waitValue<ResolutionValue>(delayMs: number, returnValue: ResolutionValue): Promise<ResolutionValue>;
|
|
3
|
-
export declare function isPromiseLike<T>(input: T | unknown): input is T extends PromiseLike<infer ValueType> ? PromiseLike<ValueType> : PromiseLike<unknown>;
|
|
4
|
-
export type UnPromise<T> = T extends PromiseLike<infer PromiseType> ? Awaited<PromiseType> : T;
|
|
5
|
-
export type MaybePromise<T> = Promise<UnPromise<T>> | UnPromise<T>;
|
|
6
|
-
export declare class PromiseTimeoutError extends Error {
|
|
7
|
-
readonly durationMs: number;
|
|
8
|
-
readonly message: string;
|
|
9
|
-
readonly name = "PromiseTimeoutError";
|
|
10
|
-
constructor(durationMs: number, message?: string);
|
|
11
|
-
}
|
|
12
|
-
export declare function wrapPromiseInTimeout<PromiseValueType>(durationMs: number, originalPromise: PromiseLike<PromiseValueType>): Promise<PromiseValueType>;
|
|
13
|
-
/** A promise which can be resolved or rejected by external code. */
|
|
14
|
-
export type DeferredPromiseWrapper<T> = {
|
|
15
|
-
promise: Promise<T>;
|
|
16
|
-
resolve: (value: T | PromiseLike<T>) => void;
|
|
17
|
-
reject: (reason?: any) => void;
|
|
18
|
-
isSettled: () => boolean;
|
|
19
|
-
};
|
|
20
|
-
export declare function createDeferredPromiseWrapper<T = void>(): DeferredPromiseWrapper<T>;
|
|
21
|
-
export type WaitForConditionInputs = {
|
|
22
|
-
conditionCallback: () => boolean | Promise<boolean>;
|
|
23
|
-
timeoutMs?: number;
|
|
24
|
-
intervalMs?: number;
|
|
25
|
-
timeoutMessage?: string;
|
|
26
|
-
};
|
|
27
|
-
export declare function waitForCondition({ conditionCallback, timeoutMs, intervalMs, timeoutMessage, }: WaitForConditionInputs): Promise<void>;
|
|
28
|
-
//# sourceMappingURL=promise.d.ts.map
|