@luxass/utils 2.2.1 → 2.2.2

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/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { isNotNull$1 as isNotNull, isNotNullish$1 as isNotNullish, isNotUndefined$1 as isNotUndefined, isTruthy$1 as isTruthy } from "./guards-C19fJmlu.js";
2
2
  import { clamp$1 as clamp } from "./number-C2E_sOOy.js";
3
3
  import { capitalize$1 as capitalize, dedent$1 as dedent, dedentRaw$1 as dedentRaw, formatStr$1 as formatStr, sanitizeIdentifier$1 as sanitizeIdentifier, toCamelCase$1 as toCamelCase, toKebabCase$1 as toKebabCase, toPascalCase$1 as toPascalCase, toSnakeCase$1 as toSnakeCase } from "./string-CBWIJiC0.js";
4
- import { Arrayable, Awaitable, ElementOf, InferArguments, Nullable, Nullish, Prettify, RemoveIndexSignature } from "./types-B3iMkmi_.js";
4
+ import { ElementOf, InferArguments, MaybeArray, MaybePromise, Nullable, Nullish, Prettify, RemoveIndexSignature } from "./types-QETho94V.js";
5
5
 
6
6
  //#region src/common.d.ts
7
7
  declare class InvariantError extends Error {
@@ -20,4 +20,4 @@ declare class InvariantError extends Error {
20
20
  declare function invariant(predicate: unknown, message: string, ...positionals: unknown[]): asserts predicate;
21
21
 
22
22
  //#endregion
23
- export { Arrayable, Awaitable, ElementOf, InferArguments, InvariantError, Nullable, Nullish, Prettify, RemoveIndexSignature, capitalize, clamp, dedent, dedentRaw, formatStr, invariant, isNotNull, isNotNullish, isNotUndefined, isTruthy, sanitizeIdentifier, toCamelCase, toKebabCase, toPascalCase, toSnakeCase };
23
+ export { ElementOf, InferArguments, InvariantError, MaybeArray, MaybePromise, Nullable, Nullish, Prettify, RemoveIndexSignature, capitalize, clamp, dedent, dedentRaw, formatStr, invariant, isNotNull, isNotNullish, isNotUndefined, isTruthy, sanitizeIdentifier, toCamelCase, toKebabCase, toPascalCase, toSnakeCase };
@@ -1,16 +1,4 @@
1
1
  //#region src/types.d.ts
2
- /**
3
- * Whatever type, or Promise of that type
4
- * @param T - Type
5
- * @returns T or Promise<T>
6
- *
7
- * @example
8
- * ```ts
9
- * type A = Awaitable<string>
10
- * // string | Promise<string>
11
- * ```
12
- */
13
- type Awaitable<T> = T | PromiseLike<T>;
14
2
  /**
15
3
  * Whatever type, or null
16
4
  * @param T - Type
@@ -36,9 +24,13 @@ type Nullable<T> = T | null;
36
24
  */
37
25
  type Nullish<T> = T | null | undefined;
38
26
  /**
39
- * Array, or not yet
27
+ * A type that can be an array or a single value.
28
+ */
29
+ type MaybeArray<T> = T | T[];
30
+ /**
31
+ * A type that can be a value or a promise.
40
32
  */
41
- type Arrayable<T> = T | Array<T>;
33
+ type MaybePromise<T> = T | Promise<T>;
42
34
  /**
43
35
  * Infers the element type of an array
44
36
  * @param T - Array type
@@ -92,4 +84,4 @@ type Prettify<T> = { [K in keyof T]: T[K] } & {};
92
84
  type RemoveIndexSignature<T> = { [K in keyof T as {} extends Record<K, 1> ? never : K]: T[K] };
93
85
 
94
86
  //#endregion
95
- export { Arrayable, Awaitable, ElementOf, InferArguments, Nullable, Nullish, Prettify, RemoveIndexSignature };
87
+ export { ElementOf, InferArguments, MaybeArray, MaybePromise, Nullable, Nullish, Prettify, RemoveIndexSignature };
package/dist/types.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { Arrayable, Awaitable, ElementOf, InferArguments, Nullable, Nullish, Prettify, RemoveIndexSignature } from "./types-B3iMkmi_.js";
2
- export { Arrayable, Awaitable, ElementOf, InferArguments, Nullable, Nullish, Prettify, RemoveIndexSignature };
1
+ import { ElementOf, InferArguments, MaybeArray, MaybePromise, Nullable, Nullish, Prettify, RemoveIndexSignature } from "./types-QETho94V.js";
2
+ export { ElementOf, InferArguments, MaybeArray, MaybePromise, Nullable, Nullish, Prettify, RemoveIndexSignature };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@luxass/utils",
3
- "version": "2.2.1",
3
+ "version": "2.2.2",
4
4
  "description": "A collection of utilities for JavaScript/TypeScript",
5
5
  "type": "module",
6
6
  "author": {