complete-common 2.28.0 → 2.30.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/functions/array.d.ts.map +1 -1
- package/dist/functions/assert.d.cts +4 -2
- package/dist/functions/assert.d.mts +4 -2
- package/dist/functions/assert.d.ts +4 -2
- package/dist/functions/assert.d.ts.map +1 -1
- package/dist/functions/enums.d.cts +2 -2
- package/dist/functions/enums.d.mts +2 -2
- package/dist/functions/enums.d.ts +2 -2
- package/dist/functions/set.d.cts +1 -1
- package/dist/functions/set.d.mts +1 -1
- package/dist/functions/set.d.ts +1 -1
- package/dist/functions/set.d.ts.map +1 -1
- package/dist/functions/sort.d.ts.map +1 -1
- package/dist/functions/string.d.ts.map +1 -1
- package/dist/functions/tuple.d.cts +2 -2
- package/dist/functions/tuple.d.mts +2 -2
- package/dist/functions/tuple.d.ts +2 -2
- package/dist/functions/types.d.cts +1 -1
- package/dist/functions/types.d.mts +1 -1
- package/dist/functions/types.d.ts +1 -1
- package/dist/functions/utils.d.cts +2 -4
- package/dist/functions/utils.d.mts +2 -4
- package/dist/functions/utils.d.ts +2 -4
- package/dist/functions/utils.d.ts.map +1 -1
- package/dist/index.cjs +42 -42
- package/dist/index.d.cts +2 -0
- package/dist/index.d.mts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +42 -43
- package/dist/types/Expect.d.cts +6 -0
- package/dist/types/Expect.d.mts +6 -0
- package/dist/types/Expect.d.ts +6 -0
- package/dist/types/Expect.d.ts.map +1 -0
- package/dist/types/KeysMatch.d.cts +25 -0
- package/dist/types/KeysMatch.d.mts +25 -0
- package/dist/types/KeysMatch.d.ts +25 -0
- package/dist/types/KeysMatch.d.ts.map +1 -0
- package/package.json +4 -4
- package/src/functions/array.ts +2 -8
- package/src/functions/assert.ts +16 -4
- package/src/functions/enums.ts +2 -2
- package/src/functions/object.ts +1 -1
- package/src/functions/set.ts +2 -7
- package/src/functions/sort.ts +1 -3
- package/src/functions/string.ts +28 -23
- package/src/functions/tuple.ts +2 -2
- package/src/functions/types.ts +1 -1
- package/src/functions/utils.ts +13 -11
- package/src/index.ts +2 -0
- package/src/types/Expect.ts +5 -0
- package/src/types/KeysMatch.ts +28 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"array.d.ts","sourceRoot":"","sources":["../../src/functions/array.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAK7D;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,CAAC,EACvC,KAAK,EAAE,aAAa,CAAC,SAAS,CAAC,EAAE,CAAC,GACjC,aAAa,CAAC,SAAS,CAAC,EAAE,CAAC,
|
|
1
|
+
{"version":3,"file":"array.d.ts","sourceRoot":"","sources":["../../src/functions/array.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAK7D;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,CAAC,EACvC,KAAK,EAAE,aAAa,CAAC,SAAS,CAAC,EAAE,CAAC,GACjC,aAAa,CAAC,SAAS,CAAC,EAAE,CAAC,CAE7B;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAC3B,MAAM,EAAE,SAAS,CAAC,EAAE,EACpB,MAAM,EAAE,SAAS,CAAC,EAAE,GACnB,OAAO,CAST;AAED;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAC3B,aAAa,EAAE,SAAS,CAAC,EAAE,EAC3B,GAAG,gBAAgB,EAAE,SAAS,CAAC,EAAE,GAChC,SAAS,CAAC,EAAE,CAWd;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,qBAAqB,CAAC,CAAC,EAErC,KAAK,EAAE,CAAC,EAAE,EACV,GAAG,gBAAgB,EAAE,SAAS,CAAC,EAAE,GACh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C,CAKvB;AAED,qFAAqF;AACrF,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,GAAG,SAAS,CAAC,EAAE,CAElE;AAED,+DAA+D;AAC/D,wBAAgB,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,CAEzD;AAED;;;GAGG;AACH,wBAAgB,MAAM,CAAC,CAAC,EAAE,KAAK,EAAE,SAAS,CAAC,EAAE,GAAG,SAAS,CAAC,EAAE,CAO3D"}
|
|
@@ -36,7 +36,7 @@ export declare function assertArrayNumber<T>(value: T, ...[msg]: [T] extends [re
|
|
|
36
36
|
] : [string]): asserts value is T & number[];
|
|
37
37
|
/**
|
|
38
38
|
* Helper function to throw an error if the provided value is not an array with every element being
|
|
39
|
-
* an object (i.e
|
|
39
|
+
* an object (i.e., a TypeScript record).
|
|
40
40
|
*/
|
|
41
41
|
export declare function assertArrayObject<T>(value: T, ...[msg]: [T] extends [ReadonlyArray<Record<string, unknown>>] ? [
|
|
42
42
|
"The assertion is useless because the provided value is already an object array."
|
|
@@ -92,7 +92,7 @@ export declare function assertNumber<T>(value: T, ...[msg]: [T] extends [number]
|
|
|
92
92
|
"The assertion is useless because the provided value is already a number."
|
|
93
93
|
] : [string]): asserts value is T & number;
|
|
94
94
|
/**
|
|
95
|
-
* Helper function to throw an error if the provided value is not an object (i.e
|
|
95
|
+
* Helper function to throw an error if the provided value is not an object (i.e., a TypeScript
|
|
96
96
|
* record).
|
|
97
97
|
*
|
|
98
98
|
* This is useful to have TypeScript narrow a `Record<string, unknown> | undefined` value to
|
|
@@ -103,6 +103,8 @@ export declare function assertNumber<T>(value: T, ...[msg]: [T] extends [number]
|
|
|
103
103
|
export declare function assertObject<T>(value: T, ...[msg]: [T] extends [Record<string, unknown>] ? [
|
|
104
104
|
"The assertion is useless because the provided value is already an object."
|
|
105
105
|
] : [string]): asserts value is T & Record<string, unknown>;
|
|
106
|
+
/** Helper function to throw an error if the provided value is not a positive integer. */
|
|
107
|
+
export declare function assertPositiveInteger(value: unknown, msg: string): asserts value is number;
|
|
106
108
|
/** Helper function to throw an error if the provided value is not a string. */
|
|
107
109
|
export declare function assertString<T>(value: T, ...[msg]: [T] extends [string] ? [
|
|
108
110
|
"The assertion is useless because the provided value is already a string."
|
|
@@ -36,7 +36,7 @@ export declare function assertArrayNumber<T>(value: T, ...[msg]: [T] extends [re
|
|
|
36
36
|
] : [string]): asserts value is T & number[];
|
|
37
37
|
/**
|
|
38
38
|
* Helper function to throw an error if the provided value is not an array with every element being
|
|
39
|
-
* an object (i.e
|
|
39
|
+
* an object (i.e., a TypeScript record).
|
|
40
40
|
*/
|
|
41
41
|
export declare function assertArrayObject<T>(value: T, ...[msg]: [T] extends [ReadonlyArray<Record<string, unknown>>] ? [
|
|
42
42
|
"The assertion is useless because the provided value is already an object array."
|
|
@@ -92,7 +92,7 @@ export declare function assertNumber<T>(value: T, ...[msg]: [T] extends [number]
|
|
|
92
92
|
"The assertion is useless because the provided value is already a number."
|
|
93
93
|
] : [string]): asserts value is T & number;
|
|
94
94
|
/**
|
|
95
|
-
* Helper function to throw an error if the provided value is not an object (i.e
|
|
95
|
+
* Helper function to throw an error if the provided value is not an object (i.e., a TypeScript
|
|
96
96
|
* record).
|
|
97
97
|
*
|
|
98
98
|
* This is useful to have TypeScript narrow a `Record<string, unknown> | undefined` value to
|
|
@@ -103,6 +103,8 @@ export declare function assertNumber<T>(value: T, ...[msg]: [T] extends [number]
|
|
|
103
103
|
export declare function assertObject<T>(value: T, ...[msg]: [T] extends [Record<string, unknown>] ? [
|
|
104
104
|
"The assertion is useless because the provided value is already an object."
|
|
105
105
|
] : [string]): asserts value is T & Record<string, unknown>;
|
|
106
|
+
/** Helper function to throw an error if the provided value is not a positive integer. */
|
|
107
|
+
export declare function assertPositiveInteger(value: unknown, msg: string): asserts value is number;
|
|
106
108
|
/** Helper function to throw an error if the provided value is not a string. */
|
|
107
109
|
export declare function assertString<T>(value: T, ...[msg]: [T] extends [string] ? [
|
|
108
110
|
"The assertion is useless because the provided value is already a string."
|
|
@@ -36,7 +36,7 @@ export declare function assertArrayNumber<T>(value: T, ...[msg]: [T] extends [re
|
|
|
36
36
|
] : [string]): asserts value is T & number[];
|
|
37
37
|
/**
|
|
38
38
|
* Helper function to throw an error if the provided value is not an array with every element being
|
|
39
|
-
* an object (i.e
|
|
39
|
+
* an object (i.e., a TypeScript record).
|
|
40
40
|
*/
|
|
41
41
|
export declare function assertArrayObject<T>(value: T, ...[msg]: [T] extends [ReadonlyArray<Record<string, unknown>>] ? [
|
|
42
42
|
"The assertion is useless because the provided value is already an object array."
|
|
@@ -92,7 +92,7 @@ export declare function assertNumber<T>(value: T, ...[msg]: [T] extends [number]
|
|
|
92
92
|
"The assertion is useless because the provided value is already a number."
|
|
93
93
|
] : [string]): asserts value is T & number;
|
|
94
94
|
/**
|
|
95
|
-
* Helper function to throw an error if the provided value is not an object (i.e
|
|
95
|
+
* Helper function to throw an error if the provided value is not an object (i.e., a TypeScript
|
|
96
96
|
* record).
|
|
97
97
|
*
|
|
98
98
|
* This is useful to have TypeScript narrow a `Record<string, unknown> | undefined` value to
|
|
@@ -103,6 +103,8 @@ export declare function assertNumber<T>(value: T, ...[msg]: [T] extends [number]
|
|
|
103
103
|
export declare function assertObject<T>(value: T, ...[msg]: [T] extends [Record<string, unknown>] ? [
|
|
104
104
|
"The assertion is useless because the provided value is already an object."
|
|
105
105
|
] : [string]): asserts value is T & Record<string, unknown>;
|
|
106
|
+
/** Helper function to throw an error if the provided value is not a positive integer. */
|
|
107
|
+
export declare function assertPositiveInteger(value: unknown, msg: string): asserts value is number;
|
|
106
108
|
/** Helper function to throw an error if the provided value is not a string. */
|
|
107
109
|
export declare function assertString<T>(value: T, ...[msg]: [T] extends [string] ? [
|
|
108
110
|
"The assertion is useless because the provided value is already a string."
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assert.d.ts","sourceRoot":"","sources":["../../src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O,EACd,GAAG,EAAE,MAAM,GACV,OAAO,CAAC,KAAK,IAAI,MAAM,CAMzB"}
|
|
@@ -33,7 +33,7 @@ export declare function getEnumKeys(transpiledEnum: TranspiledEnum): readonly st
|
|
|
33
33
|
export declare function getEnumValues<T extends TranspiledEnum>(transpiledEnum: T): ReadonlyArray<T[keyof T]>;
|
|
34
34
|
/**
|
|
35
35
|
* Helper function to validate that an interface contains all of the keys of an enum. You must
|
|
36
|
-
* specify both generic parameters in order for this to work properly (i.e
|
|
36
|
+
* specify both generic parameters in order for this to work properly (i.e., the interface and then
|
|
37
37
|
* the enum).
|
|
38
38
|
*
|
|
39
39
|
* For example:
|
|
@@ -54,7 +54,7 @@ export declare function getEnumValues<T extends TranspiledEnum>(transpiledEnum:
|
|
|
54
54
|
* interfaceSatisfiesEnum<MyEnumToType, MyEnum>();
|
|
55
55
|
* ```
|
|
56
56
|
*
|
|
57
|
-
* This function is only meant to be used with interfaces (i.e
|
|
57
|
+
* This function is only meant to be used with interfaces (i.e., types that will not exist at
|
|
58
58
|
* run-time). If you are generating an object that will contain all of the keys of an enum, use the
|
|
59
59
|
* `satisfies` operator with the `Record` type instead.
|
|
60
60
|
*/
|
|
@@ -33,7 +33,7 @@ export declare function getEnumKeys(transpiledEnum: TranspiledEnum): readonly st
|
|
|
33
33
|
export declare function getEnumValues<T extends TranspiledEnum>(transpiledEnum: T): ReadonlyArray<T[keyof T]>;
|
|
34
34
|
/**
|
|
35
35
|
* Helper function to validate that an interface contains all of the keys of an enum. You must
|
|
36
|
-
* specify both generic parameters in order for this to work properly (i.e
|
|
36
|
+
* specify both generic parameters in order for this to work properly (i.e., the interface and then
|
|
37
37
|
* the enum).
|
|
38
38
|
*
|
|
39
39
|
* For example:
|
|
@@ -54,7 +54,7 @@ export declare function getEnumValues<T extends TranspiledEnum>(transpiledEnum:
|
|
|
54
54
|
* interfaceSatisfiesEnum<MyEnumToType, MyEnum>();
|
|
55
55
|
* ```
|
|
56
56
|
*
|
|
57
|
-
* This function is only meant to be used with interfaces (i.e
|
|
57
|
+
* This function is only meant to be used with interfaces (i.e., types that will not exist at
|
|
58
58
|
* run-time). If you are generating an object that will contain all of the keys of an enum, use the
|
|
59
59
|
* `satisfies` operator with the `Record` type instead.
|
|
60
60
|
*/
|
|
@@ -33,7 +33,7 @@ export declare function getEnumKeys(transpiledEnum: TranspiledEnum): readonly st
|
|
|
33
33
|
export declare function getEnumValues<T extends TranspiledEnum>(transpiledEnum: T): ReadonlyArray<T[keyof T]>;
|
|
34
34
|
/**
|
|
35
35
|
* Helper function to validate that an interface contains all of the keys of an enum. You must
|
|
36
|
-
* specify both generic parameters in order for this to work properly (i.e
|
|
36
|
+
* specify both generic parameters in order for this to work properly (i.e., the interface and then
|
|
37
37
|
* the enum).
|
|
38
38
|
*
|
|
39
39
|
* For example:
|
|
@@ -54,7 +54,7 @@ export declare function getEnumValues<T extends TranspiledEnum>(transpiledEnum:
|
|
|
54
54
|
* interfaceSatisfiesEnum<MyEnumToType, MyEnum>();
|
|
55
55
|
* ```
|
|
56
56
|
*
|
|
57
|
-
* This function is only meant to be used with interfaces (i.e
|
|
57
|
+
* This function is only meant to be used with interfaces (i.e., types that will not exist at
|
|
58
58
|
* run-time). If you are generating an object that will contain all of the keys of an enum, use the
|
|
59
59
|
* `satisfies` operator with the `Record` type instead.
|
|
60
60
|
*/
|
package/dist/functions/set.d.cts
CHANGED
|
@@ -17,7 +17,7 @@ export declare function addSetsToSet<T>(mainSet: Set<T>, ...setsToAdd: ReadonlyA
|
|
|
17
17
|
* This function is variadic, meaning that you can specify N sets.
|
|
18
18
|
*/
|
|
19
19
|
export declare function combineSets<T>(...sets: ReadonlyArray<ReadonlySet<T>>): ReadonlySet<T>;
|
|
20
|
-
/** Helper function to copy a set. (
|
|
20
|
+
/** Helper function to copy a set. (Under the hood, this simply calls the `Set` constructor.) */
|
|
21
21
|
export declare function copySet<T>(oldSet: ReadonlySet<T>): ReadonlySet<T>;
|
|
22
22
|
/** Helper function to convert the keys of an object to a set. */
|
|
23
23
|
export declare function objectKeysToSet<K extends PropertyKey, V>(object: Record<K, V>): ReadonlySet<K>;
|
package/dist/functions/set.d.mts
CHANGED
|
@@ -17,7 +17,7 @@ export declare function addSetsToSet<T>(mainSet: Set<T>, ...setsToAdd: ReadonlyA
|
|
|
17
17
|
* This function is variadic, meaning that you can specify N sets.
|
|
18
18
|
*/
|
|
19
19
|
export declare function combineSets<T>(...sets: ReadonlyArray<ReadonlySet<T>>): ReadonlySet<T>;
|
|
20
|
-
/** Helper function to copy a set. (
|
|
20
|
+
/** Helper function to copy a set. (Under the hood, this simply calls the `Set` constructor.) */
|
|
21
21
|
export declare function copySet<T>(oldSet: ReadonlySet<T>): ReadonlySet<T>;
|
|
22
22
|
/** Helper function to convert the keys of an object to a set. */
|
|
23
23
|
export declare function objectKeysToSet<K extends PropertyKey, V>(object: Record<K, V>): ReadonlySet<K>;
|
package/dist/functions/set.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ export declare function addSetsToSet<T>(mainSet: Set<T>, ...setsToAdd: ReadonlyA
|
|
|
17
17
|
* This function is variadic, meaning that you can specify N sets.
|
|
18
18
|
*/
|
|
19
19
|
export declare function combineSets<T>(...sets: ReadonlyArray<ReadonlySet<T>>): ReadonlySet<T>;
|
|
20
|
-
/** Helper function to copy a set. (
|
|
20
|
+
/** Helper function to copy a set. (Under the hood, this simply calls the `Set` constructor.) */
|
|
21
21
|
export declare function copySet<T>(oldSet: ReadonlySet<T>): ReadonlySet<T>;
|
|
22
22
|
/** Helper function to convert the keys of an object to a set. */
|
|
23
23
|
export declare function objectKeysToSet<K extends PropertyKey, V>(object: Record<K, V>): ReadonlySet<K>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"set.d.ts","sourceRoot":"","sources":["../../src/functions/set.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAE5B,OAAO,EAAE,GAAG,CAAC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AAE,SAAS,CAAC,EAAE,GAAG,IAAI,CAItE;AAED;;;;;;GAMG;AACH,wBAAgB,MAAM,CAAC,CAAC,EACtB,GAAG,EAAE,WAAW,CAAC,CAAC,CAAC,EACnB,GAAG,QAAQ,EAAE,SAAS,CAAC,EAAE,GACxB,OAAO,CAET"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sort.d.ts","sourceRoot":"","sources":["../../src/functions/sort.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,SAAS,MAAM,EAAE,GACvB,SAAS,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"sort.d.ts","sourceRoot":"","sources":["../../src/functions/sort.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,SAAS,MAAM,EAAE,GACvB,SAAS,MAAM,EAAE,CAOnB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"string.d.ts","sourceRoot":"","sources":["../../src/functions/string.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AA8BxE,kEAAkE;AAClE,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAU5D;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAO3D;AAED;;;;;GAKG;AACH,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAqBlE;AAED,6EAA6E;AAC7E,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAOpD;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAEhD;AAED,0FAA0F;AAC1F,wBAAgB,aAAa,CAAC,MAA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,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAMxE"}
|
|
@@ -10,14 +10,14 @@ type TupleKey<T extends readonly unknown[]> = {
|
|
|
10
10
|
type TupleValue<T extends readonly unknown[]> = T[0];
|
|
11
11
|
type TupleEntry<T extends readonly unknown[]> = [TupleKey<T>, TupleValue<T>];
|
|
12
12
|
/**
|
|
13
|
-
* Helper function to get the entries (i.e
|
|
13
|
+
* Helper function to get the entries (i.e., indexes and values) of a tuple in a type-safe way.
|
|
14
14
|
*
|
|
15
15
|
* This is useful because the vanilla `Array.entries` method will always have the keys be of type
|
|
16
16
|
* `number`.
|
|
17
17
|
*/
|
|
18
18
|
export declare function tupleEntries<T extends readonly unknown[]>(tuple: T): Generator<TupleEntry<T>>;
|
|
19
19
|
/**
|
|
20
|
-
* Helper function to get the keys (i.e
|
|
20
|
+
* Helper function to get the keys (i.e., indexes) of a tuple in a type-safe way.
|
|
21
21
|
*
|
|
22
22
|
* This is useful because the vanilla `Array.keys` method will always have the keys be of type
|
|
23
23
|
* `number`.
|
|
@@ -10,14 +10,14 @@ type TupleKey<T extends readonly unknown[]> = {
|
|
|
10
10
|
type TupleValue<T extends readonly unknown[]> = T[0];
|
|
11
11
|
type TupleEntry<T extends readonly unknown[]> = [TupleKey<T>, TupleValue<T>];
|
|
12
12
|
/**
|
|
13
|
-
* Helper function to get the entries (i.e
|
|
13
|
+
* Helper function to get the entries (i.e., indexes and values) of a tuple in a type-safe way.
|
|
14
14
|
*
|
|
15
15
|
* This is useful because the vanilla `Array.entries` method will always have the keys be of type
|
|
16
16
|
* `number`.
|
|
17
17
|
*/
|
|
18
18
|
export declare function tupleEntries<T extends readonly unknown[]>(tuple: T): Generator<TupleEntry<T>>;
|
|
19
19
|
/**
|
|
20
|
-
* Helper function to get the keys (i.e
|
|
20
|
+
* Helper function to get the keys (i.e., indexes) of a tuple in a type-safe way.
|
|
21
21
|
*
|
|
22
22
|
* This is useful because the vanilla `Array.keys` method will always have the keys be of type
|
|
23
23
|
* `number`.
|
|
@@ -10,14 +10,14 @@ type TupleKey<T extends readonly unknown[]> = {
|
|
|
10
10
|
type TupleValue<T extends readonly unknown[]> = T[0];
|
|
11
11
|
type TupleEntry<T extends readonly unknown[]> = [TupleKey<T>, TupleValue<T>];
|
|
12
12
|
/**
|
|
13
|
-
* Helper function to get the entries (i.e
|
|
13
|
+
* Helper function to get the entries (i.e., indexes and values) of a tuple in a type-safe way.
|
|
14
14
|
*
|
|
15
15
|
* This is useful because the vanilla `Array.entries` method will always have the keys be of type
|
|
16
16
|
* `number`.
|
|
17
17
|
*/
|
|
18
18
|
export declare function tupleEntries<T extends readonly unknown[]>(tuple: T): Generator<TupleEntry<T>>;
|
|
19
19
|
/**
|
|
20
|
-
* Helper function to get the keys (i.e
|
|
20
|
+
* Helper function to get the keys (i.e., indexes) of a tuple in a type-safe way.
|
|
21
21
|
*
|
|
22
22
|
* This is useful because the vanilla `Array.keys` method will always have the keys be of type
|
|
23
23
|
* `number`.
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* @module
|
|
5
5
|
*/
|
|
6
6
|
/**
|
|
7
|
-
* Helper function to narrow an unknown value to an object (i.e
|
|
7
|
+
* Helper function to narrow an unknown value to an object (i.e., a TypeScript record).
|
|
8
8
|
*
|
|
9
9
|
* Under the hood, this checks for `typeof variable === "object"`, `variable !== null`, and
|
|
10
10
|
* `!Array.isArray(variable)`.
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* @module
|
|
5
5
|
*/
|
|
6
6
|
/**
|
|
7
|
-
* Helper function to narrow an unknown value to an object (i.e
|
|
7
|
+
* Helper function to narrow an unknown value to an object (i.e., a TypeScript record).
|
|
8
8
|
*
|
|
9
9
|
* Under the hood, this checks for `typeof variable === "object"`, `variable !== null`, and
|
|
10
10
|
* `!Array.isArray(variable)`.
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* @module
|
|
5
5
|
*/
|
|
6
6
|
/**
|
|
7
|
-
* Helper function to narrow an unknown value to an object (i.e
|
|
7
|
+
* Helper function to narrow an unknown value to an object (i.e., a TypeScript record).
|
|
8
8
|
*
|
|
9
9
|
* Under the hood, this checks for `typeof variable === "object"`, `variable !== null`, and
|
|
10
10
|
* `!Array.isArray(variable)`.
|
|
@@ -73,10 +73,8 @@ export declare function noop(): void;
|
|
|
73
73
|
* - `undefined` is returned instead of `Number.NaN`, which is helpful in conjunction with
|
|
74
74
|
* TypeScript type narrowing patterns.
|
|
75
75
|
* - Strings that are a mixture of numbers and letters will result in undefined instead of the part
|
|
76
|
-
* of the string that is the number. (e.g
|
|
76
|
+
* of the string that is the number. (e.g., "1a" --> undefined instead of "1a" --> 1)
|
|
77
77
|
* - Non-strings will result in undefined instead of being coerced to a number.
|
|
78
|
-
*
|
|
79
|
-
* @param string A string to convert to an integer.
|
|
80
78
|
*/
|
|
81
79
|
export declare function parseFloatSafe(string: string): number | undefined;
|
|
82
80
|
/**
|
|
@@ -85,7 +83,7 @@ export declare function parseFloatSafe(string: string): number | undefined;
|
|
|
85
83
|
* - `undefined` is returned instead of `Number.NaN`, which is helpful in conjunction with
|
|
86
84
|
* TypeScript type narrowing patterns.
|
|
87
85
|
* - Strings that are a mixture of numbers and letters will result in undefined instead of the part
|
|
88
|
-
* of the string that is the number. (e.g
|
|
86
|
+
* of the string that is the number. (e.g., "1a" --> undefined instead of "1a" --> 1)
|
|
89
87
|
* - Non-strings will result in undefined instead of being coerced to a number.
|
|
90
88
|
*
|
|
91
89
|
* If you have to use a radix other than 10, use the vanilla `Number.parseInt` function instead,
|
|
@@ -73,10 +73,8 @@ export declare function noop(): void;
|
|
|
73
73
|
* - `undefined` is returned instead of `Number.NaN`, which is helpful in conjunction with
|
|
74
74
|
* TypeScript type narrowing patterns.
|
|
75
75
|
* - Strings that are a mixture of numbers and letters will result in undefined instead of the part
|
|
76
|
-
* of the string that is the number. (e.g
|
|
76
|
+
* of the string that is the number. (e.g., "1a" --> undefined instead of "1a" --> 1)
|
|
77
77
|
* - Non-strings will result in undefined instead of being coerced to a number.
|
|
78
|
-
*
|
|
79
|
-
* @param string A string to convert to an integer.
|
|
80
78
|
*/
|
|
81
79
|
export declare function parseFloatSafe(string: string): number | undefined;
|
|
82
80
|
/**
|
|
@@ -85,7 +83,7 @@ export declare function parseFloatSafe(string: string): number | undefined;
|
|
|
85
83
|
* - `undefined` is returned instead of `Number.NaN`, which is helpful in conjunction with
|
|
86
84
|
* TypeScript type narrowing patterns.
|
|
87
85
|
* - Strings that are a mixture of numbers and letters will result in undefined instead of the part
|
|
88
|
-
* of the string that is the number. (e.g
|
|
86
|
+
* of the string that is the number. (e.g., "1a" --> undefined instead of "1a" --> 1)
|
|
89
87
|
* - Non-strings will result in undefined instead of being coerced to a number.
|
|
90
88
|
*
|
|
91
89
|
* If you have to use a radix other than 10, use the vanilla `Number.parseInt` function instead,
|
|
@@ -73,10 +73,8 @@ export declare function noop(): void;
|
|
|
73
73
|
* - `undefined` is returned instead of `Number.NaN`, which is helpful in conjunction with
|
|
74
74
|
* TypeScript type narrowing patterns.
|
|
75
75
|
* - Strings that are a mixture of numbers and letters will result in undefined instead of the part
|
|
76
|
-
* of the string that is the number. (e.g
|
|
76
|
+
* of the string that is the number. (e.g., "1a" --> undefined instead of "1a" --> 1)
|
|
77
77
|
* - Non-strings will result in undefined instead of being coerced to a number.
|
|
78
|
-
*
|
|
79
|
-
* @param string A string to convert to an integer.
|
|
80
78
|
*/
|
|
81
79
|
export declare function parseFloatSafe(string: string): number | undefined;
|
|
82
80
|
/**
|
|
@@ -85,7 +83,7 @@ export declare function parseFloatSafe(string: string): number | undefined;
|
|
|
85
83
|
* - `undefined` is returned instead of `Number.NaN`, which is helpful in conjunction with
|
|
86
84
|
* TypeScript type narrowing patterns.
|
|
87
85
|
* - Strings that are a mixture of numbers and letters will result in undefined instead of the part
|
|
88
|
-
* of the string that is the number. (e.g
|
|
86
|
+
* of the string that is the number. (e.g., "1a" --> undefined instead of "1a" --> 1)
|
|
89
87
|
* - Non-strings will result in undefined instead of being coerced to a number.
|
|
90
88
|
*
|
|
91
89
|
* If you have to use a radix other than 10, use the vanilla `Number.parseInt` function instead,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/functions/utils.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAQH;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAiB,MAAM,CACrB,KAAK,EAAE,MAAM,EACb,GAAG,CAAC,EAAE,MAAM,EACZ,SAAS,SAAI,GACZ,SAAS,CAAC,MAAM,CAAC,CASnB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAiB,MAAM,CACrB,KAAK,EAAE,MAAM,EACb,GAAG,CAAC,EAAE,MAAM,EACZ,SAAS,SAAI,GACZ,SAAS,CAAC,MAAM,CAAC,CAQnB;AAED,yDAAyD;AACzD,wBAAgB,OAAO,CAAC,CAAC,SAAS,MAAM,EACtC,GAAG,EAAE,WAAW,EAChB,MAAM,EAAE,CAAC,GACR,GAAG,IAAI,MAAM,CAAC,CAEhB;AAED;;;GAGG;AAEH,wBAAgB,IAAI,IAAI,IAAI,CAAG;AAE/B
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/functions/utils.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAQH;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAiB,MAAM,CACrB,KAAK,EAAE,MAAM,EACb,GAAG,CAAC,EAAE,MAAM,EACZ,SAAS,SAAI,GACZ,SAAS,CAAC,MAAM,CAAC,CASnB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAiB,MAAM,CACrB,KAAK,EAAE,MAAM,EACb,GAAG,CAAC,EAAE,MAAM,EACZ,SAAS,SAAI,GACZ,SAAS,CAAC,MAAM,CAAC,CAQnB;AAED,yDAAyD;AACzD,wBAAgB,OAAO,CAAC,CAAC,SAAS,MAAM,EACtC,GAAG,EAAE,WAAW,EAChB,MAAM,EAAE,CAAC,GACR,GAAG,IAAI,MAAM,CAAC,CAEhB;AAED;;;GAGG;AAEH,wBAAgB,IAAI,IAAI,IAAI,CAAG;AAE/B;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAgBjE;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAgB/D;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI,GAAG,IAAI,CAInE;AAED;;;;;;;;;;;;;;GAcG;AAEH,wBAAgB,IAAI,CAAC,GAAG,IAAI,EAAE,SAAS,OAAO,EAAE,GAAG,IAAI,CAAG"}
|
package/dist/index.cjs
CHANGED
|
@@ -102,7 +102,7 @@ function assertEnumValue(value, transpiledEnum, msg, set) {
|
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
104
|
function assertInteger(value, msg) {
|
|
105
|
-
if (!Number.
|
|
105
|
+
if (!Number.isSafeInteger(value)) {
|
|
106
106
|
throw new TypeError(msg);
|
|
107
107
|
}
|
|
108
108
|
}
|
|
@@ -126,6 +126,11 @@ function assertObject(value, ...[msg]) {
|
|
|
126
126
|
throw new TypeError(msg);
|
|
127
127
|
}
|
|
128
128
|
}
|
|
129
|
+
function assertPositiveInteger(value, msg) {
|
|
130
|
+
if (!Number.isSafeInteger(value) || value <= 0) {
|
|
131
|
+
throw new TypeError(msg);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
129
134
|
function assertString(value, ...[msg]) {
|
|
130
135
|
if (typeof value !== "string") {
|
|
131
136
|
throw new TypeError(msg);
|
|
@@ -156,11 +161,7 @@ function getRandomInt(min, max, exceptions = []) {
|
|
|
156
161
|
}
|
|
157
162
|
|
|
158
163
|
function arrayCopyTwoDimensional(array) {
|
|
159
|
-
|
|
160
|
-
for (const subArray of array) {
|
|
161
|
-
copiedArray.push([...subArray]);
|
|
162
|
-
}
|
|
163
|
-
return copiedArray;
|
|
164
|
+
return Array.from(array, (subArray) => [...subArray]);
|
|
164
165
|
}
|
|
165
166
|
function arrayEquals(array1, array2) {
|
|
166
167
|
if (array1.length !== array2.length) {
|
|
@@ -207,7 +208,7 @@ function arrayRemoveInPlace(array, ...elementsToRemove) {
|
|
|
207
208
|
return removedElements;
|
|
208
209
|
}
|
|
209
210
|
function emptyArray(array) {
|
|
210
|
-
array.
|
|
211
|
+
array.length = 0;
|
|
211
212
|
}
|
|
212
213
|
async function filterAsync(array, predicate) {
|
|
213
214
|
const results = await Promise.all(
|
|
@@ -394,11 +395,7 @@ function combineSets(...sets) {
|
|
|
394
395
|
return newSet;
|
|
395
396
|
}
|
|
396
397
|
function copySet(oldSet) {
|
|
397
|
-
|
|
398
|
-
for (const value of oldSet) {
|
|
399
|
-
newSet.add(value);
|
|
400
|
-
}
|
|
401
|
-
return newSet;
|
|
398
|
+
return new Set(oldSet);
|
|
402
399
|
}
|
|
403
400
|
function objectKeysToSet(object) {
|
|
404
401
|
const set = /* @__PURE__ */ new Set();
|
|
@@ -426,15 +423,13 @@ function setHas(set, ...elements) {
|
|
|
426
423
|
function sortCaseInsensitive(array) {
|
|
427
424
|
const newArray = [...array];
|
|
428
425
|
newArray.sort(
|
|
429
|
-
(a, b) => a.localeCompare(b, void 0, {
|
|
430
|
-
sensitivity: "base"
|
|
431
|
-
})
|
|
426
|
+
(a, b) => a.localeCompare(b, void 0, { sensitivity: "base" })
|
|
432
427
|
);
|
|
433
428
|
return newArray;
|
|
434
429
|
}
|
|
435
430
|
|
|
436
|
-
const FLOAT_REGEX =
|
|
437
|
-
const INTEGER_REGEX = /^-?\d
|
|
431
|
+
const FLOAT_REGEX = /^-?(?:\d+(?:\.\d+)?|\.\d+)$/v;
|
|
432
|
+
const INTEGER_REGEX = /^-?\d+$/v;
|
|
438
433
|
function* eRange(start, end, increment = 1) {
|
|
439
434
|
if (end === void 0) {
|
|
440
435
|
yield* eRange(0, start, increment);
|
|
@@ -453,7 +448,7 @@ function* iRange(start, end, increment = 1) {
|
|
|
453
448
|
yield* eRange(start, exclusiveEnd, increment);
|
|
454
449
|
}
|
|
455
450
|
function isKeyOf(key, target) {
|
|
456
|
-
return key
|
|
451
|
+
return Object.hasOwn(target, key);
|
|
457
452
|
}
|
|
458
453
|
function noop() {
|
|
459
454
|
}
|
|
@@ -462,10 +457,10 @@ function parseFloatSafe(string) {
|
|
|
462
457
|
return void 0;
|
|
463
458
|
}
|
|
464
459
|
const trimmedString = string.trim();
|
|
465
|
-
if (FLOAT_REGEX.
|
|
460
|
+
if (!FLOAT_REGEX.test(trimmedString)) {
|
|
466
461
|
return void 0;
|
|
467
462
|
}
|
|
468
|
-
const number = Number
|
|
463
|
+
const number = Number(trimmedString);
|
|
469
464
|
return Number.isNaN(number) ? void 0 : number;
|
|
470
465
|
}
|
|
471
466
|
function parseIntSafe(string) {
|
|
@@ -473,10 +468,10 @@ function parseIntSafe(string) {
|
|
|
473
468
|
return void 0;
|
|
474
469
|
}
|
|
475
470
|
const trimmedString = string.trim();
|
|
476
|
-
if (INTEGER_REGEX.
|
|
471
|
+
if (!INTEGER_REGEX.test(trimmedString)) {
|
|
477
472
|
return void 0;
|
|
478
473
|
}
|
|
479
|
-
const number =
|
|
474
|
+
const number = Math.trunc(Number(trimmedString));
|
|
480
475
|
return Number.isNaN(number) ? void 0 : number;
|
|
481
476
|
}
|
|
482
477
|
function repeat(num, func) {
|
|
@@ -487,17 +482,17 @@ function repeat(num, func) {
|
|
|
487
482
|
function todo(...args) {
|
|
488
483
|
}
|
|
489
484
|
|
|
490
|
-
const ASCII_REGEX =
|
|
491
|
-
const DIACRITIC_REGEX = /\p{Diacritic}/
|
|
492
|
-
const
|
|
493
|
-
const
|
|
494
|
-
const KEBAB_CASE_REGEX = /^[\da-z]+(?:-[\da-z]+)
|
|
495
|
-
const SEMANTIC_VERSION_REGEX = /^v*(?<major>\d+)\.(?<minor>\d+)\.(?<patch>\d+)
|
|
496
|
-
const WHITESPACE_REGEX = /\s
|
|
497
|
-
const WHITESPACE_GLOBAL_REGEX = /\s/
|
|
498
|
-
const TITLE_CASE_BOUNDARY_REGEX = /(?<=[\da-z])(?=[A-Z])/
|
|
499
|
-
const UPPERCASE_REGEX = /^[A-Z]
|
|
500
|
-
const LOWERCASE_REGEX = /^[a-z]
|
|
485
|
+
const ASCII_REGEX = /^\p{ASCII}*$/v;
|
|
486
|
+
const DIACRITIC_REGEX = /\p{Diacritic}/v;
|
|
487
|
+
const FIRST_LETTER_CAPITALIZED_REGEX = /^\p{Lu}/v;
|
|
488
|
+
const EMOJI_REGEX = /\p{Extended_Pictographic}|[#*0-9]\u{FE0F}?\u{20E3}/v;
|
|
489
|
+
const KEBAB_CASE_REGEX = /^[\da-z]+(?:-[\da-z]+)*$/v;
|
|
490
|
+
const SEMANTIC_VERSION_REGEX = /^v*(?<major>\d+)\.(?<minor>\d+)\.(?<patch>\d+)/v;
|
|
491
|
+
const WHITESPACE_REGEX = /\s/v;
|
|
492
|
+
const WHITESPACE_GLOBAL_REGEX = /\s/gv;
|
|
493
|
+
const TITLE_CASE_BOUNDARY_REGEX = /(?<=[\da-z])(?=[A-Z])/gv;
|
|
494
|
+
const UPPERCASE_REGEX = /^[A-Z]*$/v;
|
|
495
|
+
const LOWERCASE_REGEX = /^[a-z]*$/v;
|
|
501
496
|
function capitalizeFirstLetter(string) {
|
|
502
497
|
if (string === "") {
|
|
503
498
|
return string;
|
|
@@ -555,8 +550,8 @@ function isUpperCase(string) {
|
|
|
555
550
|
return UPPERCASE_REGEX.test(string);
|
|
556
551
|
}
|
|
557
552
|
function kebabCaseToCamelCase(string) {
|
|
558
|
-
return string.replaceAll(/-./
|
|
559
|
-
const firstLetterOfWord = match
|
|
553
|
+
return string.replaceAll(/-./gv, (match) => {
|
|
554
|
+
const firstLetterOfWord = match.at(1);
|
|
560
555
|
return firstLetterOfWord === void 0 ? "" : firstLetterOfWord.toUpperCase();
|
|
561
556
|
});
|
|
562
557
|
}
|
|
@@ -568,14 +563,14 @@ function normalizeString(string) {
|
|
|
568
563
|
let sanitizedString = string;
|
|
569
564
|
sanitizedString = removeNonPrintableCharacters(sanitizedString);
|
|
570
565
|
sanitizedString = sanitizedString.replaceAll("\n\r", "\n");
|
|
571
|
-
sanitizedString = sanitizedString.replaceAll(/\p{Zl}/
|
|
572
|
-
sanitizedString = sanitizedString.replaceAll(/\p{Zp}/
|
|
573
|
-
sanitizedString = sanitizedString.replaceAll(/\p{Zs}/
|
|
566
|
+
sanitizedString = sanitizedString.replaceAll(/\p{Zl}/gv, "\n");
|
|
567
|
+
sanitizedString = sanitizedString.replaceAll(/\p{Zp}/gv, "\n");
|
|
568
|
+
sanitizedString = sanitizedString.replaceAll(/\p{Zs}/gv, " ");
|
|
574
569
|
sanitizedString = sanitizedString.trim();
|
|
575
570
|
return sanitizedString;
|
|
576
571
|
}
|
|
577
572
|
function parseSemanticVersion(versionString) {
|
|
578
|
-
const match =
|
|
573
|
+
const match = SEMANTIC_VERSION_REGEX.exec(versionString);
|
|
579
574
|
if (match === null || match.groups === void 0) {
|
|
580
575
|
return void 0;
|
|
581
576
|
}
|
|
@@ -589,7 +584,11 @@ function parseSemanticVersion(versionString) {
|
|
|
589
584
|
if (majorVersion === void 0 || minorVersion === void 0 || patchVersion === void 0) {
|
|
590
585
|
return void 0;
|
|
591
586
|
}
|
|
592
|
-
return {
|
|
587
|
+
return {
|
|
588
|
+
majorVersion,
|
|
589
|
+
minorVersion,
|
|
590
|
+
patchVersion
|
|
591
|
+
};
|
|
593
592
|
}
|
|
594
593
|
function removeLinesBetweenMarkers(string, marker) {
|
|
595
594
|
const lines = string.split("\n");
|
|
@@ -616,7 +615,7 @@ function removeLinesMatching(string, match) {
|
|
|
616
615
|
return newLines.join("\n");
|
|
617
616
|
}
|
|
618
617
|
function removeNonPrintableCharacters(string) {
|
|
619
|
-
return string.replaceAll(/\p{C}/
|
|
618
|
+
return string.replaceAll(/\p{C}/gv, "");
|
|
620
619
|
}
|
|
621
620
|
function removeWhitespace(string) {
|
|
622
621
|
return string.replaceAll(WHITESPACE_GLOBAL_REGEX, "");
|
|
@@ -641,7 +640,7 @@ function satisfiesSemanticVersion(version, minimumVersion) {
|
|
|
641
640
|
return majorVersion > minimumMajorVersion || majorVersion === minimumMajorVersion && minorVersion > minimumMinorVersion || majorVersion === minimumMajorVersion && minorVersion === minimumMinorVersion && patchVersion >= minimumPatchVersion;
|
|
642
641
|
}
|
|
643
642
|
function titleCaseToKebabCase(string) {
|
|
644
|
-
return string.replaceAll(TITLE_CASE_BOUNDARY_REGEX, "-").replaceAll(/ +/
|
|
643
|
+
return string.replaceAll(TITLE_CASE_BOUNDARY_REGEX, "-").replaceAll(/ +/gv, "-").toLowerCase();
|
|
645
644
|
}
|
|
646
645
|
function trimPrefix(string, prefix, trimAll = false) {
|
|
647
646
|
if (trimAll) {
|
|
@@ -709,6 +708,7 @@ exports.assertIs = assertIs;
|
|
|
709
708
|
exports.assertNotNull = assertNotNull;
|
|
710
709
|
exports.assertNumber = assertNumber;
|
|
711
710
|
exports.assertObject = assertObject;
|
|
711
|
+
exports.assertPositiveInteger = assertPositiveInteger;
|
|
712
712
|
exports.assertString = assertString;
|
|
713
713
|
exports.assertStringNotEmpty = assertStringNotEmpty;
|
|
714
714
|
exports.capitalizeFirstLetter = capitalizeFirstLetter;
|
package/dist/index.d.cts
CHANGED
|
@@ -17,8 +17,10 @@ export type * from "./interfaces/SemanticVersion.js";
|
|
|
17
17
|
export type * from "./types/AddSubtract.js";
|
|
18
18
|
export type * from "./types/CompositionTypeSatisfiesEnum.js";
|
|
19
19
|
export type * from "./types/ERange.js";
|
|
20
|
+
export type * from "./types/Expect.js";
|
|
20
21
|
export type * from "./types/Immutable.js";
|
|
21
22
|
export type * from "./types/IRange.js";
|
|
23
|
+
export type * from "./types/KeysMatch.js";
|
|
22
24
|
export type * from "./types/NaturalNumbersLessThan.js";
|
|
23
25
|
export type * from "./types/NaturalNumbersLessThanOrEqualTo.js";
|
|
24
26
|
export type * from "./types/ObjectValues.js";
|
package/dist/index.d.mts
CHANGED
|
@@ -17,8 +17,10 @@ export type * from "./interfaces/SemanticVersion.js";
|
|
|
17
17
|
export type * from "./types/AddSubtract.js";
|
|
18
18
|
export type * from "./types/CompositionTypeSatisfiesEnum.js";
|
|
19
19
|
export type * from "./types/ERange.js";
|
|
20
|
+
export type * from "./types/Expect.js";
|
|
20
21
|
export type * from "./types/Immutable.js";
|
|
21
22
|
export type * from "./types/IRange.js";
|
|
23
|
+
export type * from "./types/KeysMatch.js";
|
|
22
24
|
export type * from "./types/NaturalNumbersLessThan.js";
|
|
23
25
|
export type * from "./types/NaturalNumbersLessThanOrEqualTo.js";
|
|
24
26
|
export type * from "./types/ObjectValues.js";
|