complete-common 2.20.0 → 2.21.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/assert.d.ts.map +1 -1
- package/dist/functions/object.d.cts +10 -4
- package/dist/functions/object.d.mts +10 -4
- package/dist/functions/object.d.ts +10 -4
- package/dist/functions/object.d.ts.map +1 -1
- package/dist/functions/set.d.cts +2 -2
- package/dist/functions/set.d.mts +2 -2
- package/dist/functions/set.d.ts +2 -2
- package/dist/functions/set.d.ts.map +1 -1
- package/dist/functions/string.d.cts +2 -0
- package/dist/functions/string.d.mts +2 -0
- package/dist/functions/string.d.ts +2 -0
- package/dist/functions/string.d.ts.map +1 -1
- package/dist/functions/types.d.ts.map +1 -1
- package/dist/index.cjs +8 -0
- package/dist/index.d.cts +1 -0
- package/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +8 -1
- package/dist/interfaces/SemanticVersion.d.cts +1 -0
- package/dist/interfaces/SemanticVersion.d.mts +1 -0
- package/dist/interfaces/SemanticVersion.d.ts +1 -0
- package/dist/interfaces/SemanticVersion.d.ts.map +1 -1
- package/dist/types/ReadonlyRecord.d.cts +1 -1
- package/dist/types/ReadonlyRecord.d.mts +1 -1
- package/dist/types/ReadonlyRecord.d.ts +1 -1
- package/dist/types/ReadonlyRecord.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/functions/array.ts +1 -1
- package/src/functions/assert.ts +4 -0
- package/src/functions/object.ts +23 -5
- package/src/functions/set.ts +2 -2
- package/src/functions/string.ts +2 -0
- package/src/functions/types.ts +2 -0
- package/src/index.ts +1 -0
- package/src/interfaces/SemanticVersion.ts +1 -0
- package/src/types/ReadonlyRecord.ts +1 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assert.d.ts","sourceRoot":"","sources":["../../src/functions/assert.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ass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M,CAAC,GAC1B;IACE,0EAA0E;CAC3E,GACD,CAAC,MAAM,CAAC,GACX,OAAO,CAAC,KAAK,IAAI,CAAC,GAAG,MAAM,CAI7B;AAED,kGAAkG;AAClG,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,OAAO,EACd,GAAG,EAAE,MAAM,GACV,OAAO,CAAC,KAAK,IAAI,MAAM,CAMzB"}
|
|
@@ -18,12 +18,12 @@ export declare function getWidenedObjectValue<T extends Record<string, unknown>>
|
|
|
18
18
|
*
|
|
19
19
|
* This is efficient such that it avoids converting the object values into an array.
|
|
20
20
|
*/
|
|
21
|
-
export declare function objectFilter<K extends
|
|
21
|
+
export declare function objectFilter<K extends PropertyKey, V>(object: ReadonlyRecord<K, V>, predicate: (value: V) => boolean): readonly V[];
|
|
22
22
|
/**
|
|
23
23
|
* Helper function to map the values in an object to another object with new values. Similar to the
|
|
24
24
|
* `Array.map` method, but works for objects.
|
|
25
25
|
*/
|
|
26
|
-
export declare function objectMap<K extends
|
|
26
|
+
export declare function objectMap<K extends PropertyKey, V, U>(object: Record<K, V>, callback: (key: K, value: V) => U): ReadonlyRecord<K, U>;
|
|
27
27
|
/**
|
|
28
28
|
* Helper function to convert an object to a `Map`.
|
|
29
29
|
*
|
|
@@ -35,12 +35,18 @@ export declare function objectMap<K extends number | string | symbol, V, U>(obje
|
|
|
35
35
|
* Note that the converted map will only have string keys, due to the nature of JavaScript objects
|
|
36
36
|
* only having string keys under the hood.
|
|
37
37
|
*/
|
|
38
|
-
export declare function objectToMap<K extends
|
|
38
|
+
export declare function objectToMap<K extends PropertyKey, V>(object: Record<K, V>): ReadonlyMap<K, V>;
|
|
39
39
|
/**
|
|
40
40
|
* Helper function to convert an object to a reverse map.
|
|
41
41
|
*
|
|
42
42
|
* Note that the converted map will only have string keys, due to the nature of JavaScript objects
|
|
43
43
|
* only having string keys under the hood.
|
|
44
44
|
*/
|
|
45
|
-
export declare function objectToReverseMap<K extends
|
|
45
|
+
export declare function objectToReverseMap<K extends PropertyKey, V extends PropertyKey>(object: Record<K, V>): ReadonlyMap<V, K>;
|
|
46
|
+
/**
|
|
47
|
+
* Helper function to reverse the keys and values of an object.
|
|
48
|
+
*
|
|
49
|
+
* @throws If the object has duplicate values.
|
|
50
|
+
*/
|
|
51
|
+
export declare function reverseObject<K extends PropertyKey, V extends PropertyKey>(obj: Record<K, V>): ReadonlyRecord<V, K>;
|
|
46
52
|
//# sourceMappingURL=object.d.ts.map
|
|
@@ -18,12 +18,12 @@ export declare function getWidenedObjectValue<T extends Record<string, unknown>>
|
|
|
18
18
|
*
|
|
19
19
|
* This is efficient such that it avoids converting the object values into an array.
|
|
20
20
|
*/
|
|
21
|
-
export declare function objectFilter<K extends
|
|
21
|
+
export declare function objectFilter<K extends PropertyKey, V>(object: ReadonlyRecord<K, V>, predicate: (value: V) => boolean): readonly V[];
|
|
22
22
|
/**
|
|
23
23
|
* Helper function to map the values in an object to another object with new values. Similar to the
|
|
24
24
|
* `Array.map` method, but works for objects.
|
|
25
25
|
*/
|
|
26
|
-
export declare function objectMap<K extends
|
|
26
|
+
export declare function objectMap<K extends PropertyKey, V, U>(object: Record<K, V>, callback: (key: K, value: V) => U): ReadonlyRecord<K, U>;
|
|
27
27
|
/**
|
|
28
28
|
* Helper function to convert an object to a `Map`.
|
|
29
29
|
*
|
|
@@ -35,12 +35,18 @@ export declare function objectMap<K extends number | string | symbol, V, U>(obje
|
|
|
35
35
|
* Note that the converted map will only have string keys, due to the nature of JavaScript objects
|
|
36
36
|
* only having string keys under the hood.
|
|
37
37
|
*/
|
|
38
|
-
export declare function objectToMap<K extends
|
|
38
|
+
export declare function objectToMap<K extends PropertyKey, V>(object: Record<K, V>): ReadonlyMap<K, V>;
|
|
39
39
|
/**
|
|
40
40
|
* Helper function to convert an object to a reverse map.
|
|
41
41
|
*
|
|
42
42
|
* Note that the converted map will only have string keys, due to the nature of JavaScript objects
|
|
43
43
|
* only having string keys under the hood.
|
|
44
44
|
*/
|
|
45
|
-
export declare function objectToReverseMap<K extends
|
|
45
|
+
export declare function objectToReverseMap<K extends PropertyKey, V extends PropertyKey>(object: Record<K, V>): ReadonlyMap<V, K>;
|
|
46
|
+
/**
|
|
47
|
+
* Helper function to reverse the keys and values of an object.
|
|
48
|
+
*
|
|
49
|
+
* @throws If the object has duplicate values.
|
|
50
|
+
*/
|
|
51
|
+
export declare function reverseObject<K extends PropertyKey, V extends PropertyKey>(obj: Record<K, V>): ReadonlyRecord<V, K>;
|
|
46
52
|
//# sourceMappingURL=object.d.ts.map
|
|
@@ -18,12 +18,12 @@ export declare function getWidenedObjectValue<T extends Record<string, unknown>>
|
|
|
18
18
|
*
|
|
19
19
|
* This is efficient such that it avoids converting the object values into an array.
|
|
20
20
|
*/
|
|
21
|
-
export declare function objectFilter<K extends
|
|
21
|
+
export declare function objectFilter<K extends PropertyKey, V>(object: ReadonlyRecord<K, V>, predicate: (value: V) => boolean): readonly V[];
|
|
22
22
|
/**
|
|
23
23
|
* Helper function to map the values in an object to another object with new values. Similar to the
|
|
24
24
|
* `Array.map` method, but works for objects.
|
|
25
25
|
*/
|
|
26
|
-
export declare function objectMap<K extends
|
|
26
|
+
export declare function objectMap<K extends PropertyKey, V, U>(object: Record<K, V>, callback: (key: K, value: V) => U): ReadonlyRecord<K, U>;
|
|
27
27
|
/**
|
|
28
28
|
* Helper function to convert an object to a `Map`.
|
|
29
29
|
*
|
|
@@ -35,12 +35,18 @@ export declare function objectMap<K extends number | string | symbol, V, U>(obje
|
|
|
35
35
|
* Note that the converted map will only have string keys, due to the nature of JavaScript objects
|
|
36
36
|
* only having string keys under the hood.
|
|
37
37
|
*/
|
|
38
|
-
export declare function objectToMap<K extends
|
|
38
|
+
export declare function objectToMap<K extends PropertyKey, V>(object: Record<K, V>): ReadonlyMap<K, V>;
|
|
39
39
|
/**
|
|
40
40
|
* Helper function to convert an object to a reverse map.
|
|
41
41
|
*
|
|
42
42
|
* Note that the converted map will only have string keys, due to the nature of JavaScript objects
|
|
43
43
|
* only having string keys under the hood.
|
|
44
44
|
*/
|
|
45
|
-
export declare function objectToReverseMap<K extends
|
|
45
|
+
export declare function objectToReverseMap<K extends PropertyKey, V extends PropertyKey>(object: Record<K, V>): ReadonlyMap<V, K>;
|
|
46
|
+
/**
|
|
47
|
+
* Helper function to reverse the keys and values of an object.
|
|
48
|
+
*
|
|
49
|
+
* @throws If the object has duplicate values.
|
|
50
|
+
*/
|
|
51
|
+
export declare function reverseObject<K extends PropertyKey, V extends PropertyKey>(obj: Record<K, V>): ReadonlyRecord<V, K>;
|
|
46
52
|
//# sourceMappingURL=object.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"object.d.ts","sourceRoot":"","sources":["../../src/functions/object.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAE7D;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACrE,MAAM,EAAE,CAAC,EACT,GAAG,EAAE,YAAY,CAAC,MAAM,CAAC,CAAC,GACzB,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,SAAS,CAGxB;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,CAAC,SAAS,
|
|
1
|
+
{"version":3,"file":"object.d.ts","sourceRoot":"","sources":["../../src/functions/object.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAE7D;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACrE,MAAM,EAAE,CAAC,EACT,GAAG,EAAE,YAAY,CAAC,MAAM,CAAC,CAAC,GACzB,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,SAAS,CAGxB;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,CAAC,SAAS,WAAW,EAAE,CAAC,EACnD,MAAM,EAAE,cAAc,CAAC,CAAC,EAAE,CAAC,CAAC,EAC5B,SAAS,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,OAAO,GAC/B,SAAS,CAAC,EAAE,CAad;AAED;;;GAGG;AACH,wBAAgB,SAAS,CAAC,CAAC,SAAS,WAAW,EAAE,CAAC,EAAE,CAAC,EACnD,MAAM,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,EACpB,QAAQ,EAAE,CAAC,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,KAAK,CAAC,GAChC,cAAc,CAAC,CAAC,EAAE,CAAC,CAAC,CAOtB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,WAAW,CAAC,CAAC,SAAS,WAAW,EAAE,CAAC,EAClD,MAAM,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,GACnB,WAAW,CAAC,CAAC,EAAE,CAAC,CAAC,CAQnB;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAChC,CAAC,SAAS,WAAW,EACrB,CAAC,SAAS,WAAW,EACrB,MAAM,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,EAAE,CAAC,CAAC,CAQzC;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,CAAC,SAAS,WAAW,EAAE,CAAC,SAAS,WAAW,EACxE,GAAG,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,GAChB,cAAc,CAAC,CAAC,EAAE,CAAC,CAAC,CAStB"}
|
package/dist/functions/set.d.cts
CHANGED
|
@@ -20,9 +20,9 @@ export declare function combineSets<T>(...sets: ReadonlyArray<ReadonlySet<T>>):
|
|
|
20
20
|
/** Helper function to copy a set. (You can also use a Set constructor to accomplish this task.) */
|
|
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
|
-
export declare function objectKeysToSet<K extends
|
|
23
|
+
export declare function objectKeysToSet<K extends PropertyKey, V>(object: Record<K, V>): ReadonlySet<K>;
|
|
24
24
|
/** Helper function to convert the values of an object to a set. */
|
|
25
|
-
export declare function objectValuesToSet<K extends
|
|
25
|
+
export declare function objectValuesToSet<K extends PropertyKey, V>(object: Record<K, V>): ReadonlySet<V>;
|
|
26
26
|
/**
|
|
27
27
|
* Helper function to add one or more elements to a set at once without having to repeatedly call
|
|
28
28
|
* the `Set.add` method.
|
package/dist/functions/set.d.mts
CHANGED
|
@@ -20,9 +20,9 @@ export declare function combineSets<T>(...sets: ReadonlyArray<ReadonlySet<T>>):
|
|
|
20
20
|
/** Helper function to copy a set. (You can also use a Set constructor to accomplish this task.) */
|
|
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
|
-
export declare function objectKeysToSet<K extends
|
|
23
|
+
export declare function objectKeysToSet<K extends PropertyKey, V>(object: Record<K, V>): ReadonlySet<K>;
|
|
24
24
|
/** Helper function to convert the values of an object to a set. */
|
|
25
|
-
export declare function objectValuesToSet<K extends
|
|
25
|
+
export declare function objectValuesToSet<K extends PropertyKey, V>(object: Record<K, V>): ReadonlySet<V>;
|
|
26
26
|
/**
|
|
27
27
|
* Helper function to add one or more elements to a set at once without having to repeatedly call
|
|
28
28
|
* the `Set.add` method.
|
package/dist/functions/set.d.ts
CHANGED
|
@@ -20,9 +20,9 @@ export declare function combineSets<T>(...sets: ReadonlyArray<ReadonlySet<T>>):
|
|
|
20
20
|
/** Helper function to copy a set. (You can also use a Set constructor to accomplish this task.) */
|
|
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
|
-
export declare function objectKeysToSet<K extends
|
|
23
|
+
export declare function objectKeysToSet<K extends PropertyKey, V>(object: Record<K, V>): ReadonlySet<K>;
|
|
24
24
|
/** Helper function to convert the values of an object to a set. */
|
|
25
|
-
export declare function objectValuesToSet<K extends
|
|
25
|
+
export declare function objectValuesToSet<K extends PropertyKey, V>(object: Record<K, V>): ReadonlySet<V>;
|
|
26
26
|
/**
|
|
27
27
|
* Helper function to add one or more elements to a set at once without having to repeatedly call
|
|
28
28
|
* the `Set.add` method.
|
|
@@ -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,CAAC,CAAC,EACf,GAAG,SAAS,EAAE,aAAa,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,GAC1C,IAAI,CAMN;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAC3B,GAAG,IAAI,EAAE,aAAa,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,GACrC,WAAW,CAAC,CAAC,CAAC,CAShB;AAED,mGAAmG;AACnG,wBAAgB,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,CAOjE;AAED,iEAAiE;AACjE,wBAAgB,eAAe,CAAC,CAAC,SAAS,
|
|
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,CAAC,CAAC,EACf,GAAG,SAAS,EAAE,aAAa,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,GAC1C,IAAI,CAMN;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAC3B,GAAG,IAAI,EAAE,aAAa,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,GACrC,WAAW,CAAC,CAAC,CAAC,CAShB;AAED,mGAAmG;AACnG,wBAAgB,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,CAOjE;AAED,iEAAiE;AACjE,wBAAgB,eAAe,CAAC,CAAC,SAAS,WAAW,EAAE,CAAC,EACtD,MAAM,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,GACnB,WAAW,CAAC,CAAC,CAAC,CAQhB;AAED,mEAAmE;AACnE,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,WAAW,EAAE,CAAC,EACxD,MAAM,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,GACnB,WAAW,CAAC,CAAC,CAAC,CAQhB;AAED;;;;;GAKG;AAEH,wBAAgB,MAAM,CAAC,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,QAAQ,EAAE,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"}
|
|
@@ -112,6 +112,8 @@ export declare function removeWhitespace(string: string): string;
|
|
|
112
112
|
/**
|
|
113
113
|
* Helper function to check if a semantic version is equal to or greater than a second semantic
|
|
114
114
|
* version.
|
|
115
|
+
*
|
|
116
|
+
* @throws If either the version or minimum version are not valid semantic versions.
|
|
115
117
|
*/
|
|
116
118
|
export declare function satisfiesSemanticVersion(version: string, minimumVersion: string): boolean;
|
|
117
119
|
/** Helper function to convert a string from TitleCase (PascalCase) to kebab-case. */
|
|
@@ -112,6 +112,8 @@ export declare function removeWhitespace(string: string): string;
|
|
|
112
112
|
/**
|
|
113
113
|
* Helper function to check if a semantic version is equal to or greater than a second semantic
|
|
114
114
|
* version.
|
|
115
|
+
*
|
|
116
|
+
* @throws If either the version or minimum version are not valid semantic versions.
|
|
115
117
|
*/
|
|
116
118
|
export declare function satisfiesSemanticVersion(version: string, minimumVersion: string): boolean;
|
|
117
119
|
/** Helper function to convert a string from TitleCase (PascalCase) to kebab-case. */
|
|
@@ -112,6 +112,8 @@ export declare function removeWhitespace(string: string): string;
|
|
|
112
112
|
/**
|
|
113
113
|
* Helper function to check if a semantic version is equal to or greater than a second semantic
|
|
114
114
|
* version.
|
|
115
|
+
*
|
|
116
|
+
* @throws If either the version or minimum version are not valid semantic versions.
|
|
115
117
|
*/
|
|
116
118
|
export declare function satisfiesSemanticVersion(version: string, minimumVersion: string): boolean;
|
|
117
119
|
/** Helper function to convert a string from TitleCase (PascalCase) to kebab-case. */
|
|
@@ -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,MAAM,EAAE,MAAM,GAAG,OAAO,CA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,EAAE,OAAO,GAChB,QAAQ,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/functions/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;GAKG;AACH,wBAAgB,QAAQ,CACtB,QAAQ,EAAE,OAAO,GAChB,QAAQ,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAQrC"}
|
package/dist/index.cjs
CHANGED
|
@@ -350,6 +350,13 @@ function objectToReverseMap(object) {
|
|
|
350
350
|
}
|
|
351
351
|
return map;
|
|
352
352
|
}
|
|
353
|
+
function reverseObject(obj) {
|
|
354
|
+
const reversed = {};
|
|
355
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
356
|
+
reversed[value] = key;
|
|
357
|
+
}
|
|
358
|
+
return reversed;
|
|
359
|
+
}
|
|
353
360
|
|
|
354
361
|
function addSetsToSet(mainSet, ...setsToAdd) {
|
|
355
362
|
for (const set of setsToAdd) {
|
|
@@ -745,6 +752,7 @@ exports.removeLinesMatching = removeLinesMatching;
|
|
|
745
752
|
exports.removeNonPrintableCharacters = removeNonPrintableCharacters;
|
|
746
753
|
exports.removeWhitespace = removeWhitespace;
|
|
747
754
|
exports.repeat = repeat;
|
|
755
|
+
exports.reverseObject = reverseObject;
|
|
748
756
|
exports.satisfiesSemanticVersion = satisfiesSemanticVersion;
|
|
749
757
|
exports.setAdd = setAdd;
|
|
750
758
|
exports.setHas = setHas;
|
package/dist/index.d.cts
CHANGED
|
@@ -13,6 +13,7 @@ export * from "./functions/time.js";
|
|
|
13
13
|
export * from "./functions/tuple.js";
|
|
14
14
|
export * from "./functions/types.js";
|
|
15
15
|
export * from "./functions/utils.js";
|
|
16
|
+
export type * from "./interfaces/SemanticVersion.js";
|
|
16
17
|
export type * from "./types/AddSubtract.js";
|
|
17
18
|
export type * from "./types/CompositionTypeSatisfiesEnum.js";
|
|
18
19
|
export type * from "./types/ERange.js";
|
package/dist/index.d.mts
CHANGED
|
@@ -13,6 +13,7 @@ export * from "./functions/time.js";
|
|
|
13
13
|
export * from "./functions/tuple.js";
|
|
14
14
|
export * from "./functions/types.js";
|
|
15
15
|
export * from "./functions/utils.js";
|
|
16
|
+
export type * from "./interfaces/SemanticVersion.js";
|
|
16
17
|
export type * from "./types/AddSubtract.js";
|
|
17
18
|
export type * from "./types/CompositionTypeSatisfiesEnum.js";
|
|
18
19
|
export type * from "./types/ERange.js";
|
package/dist/index.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ export * from "./functions/time.js";
|
|
|
13
13
|
export * from "./functions/tuple.js";
|
|
14
14
|
export * from "./functions/types.js";
|
|
15
15
|
export * from "./functions/utils.js";
|
|
16
|
+
export type * from "./interfaces/SemanticVersion.js";
|
|
16
17
|
export type * from "./types/AddSubtract.js";
|
|
17
18
|
export type * from "./types/CompositionTypeSatisfiesEnum.js";
|
|
18
19
|
export type * from "./types/ERange.js";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,mBAAmB,wBAAwB,CAAC;AAC5C,mBAAmB,yCAAyC,CAAC;AAC7D,mBAAmB,mBAAmB,CAAC;AACvC,mBAAmB,sBAAsB,CA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AC7C,mBAAmB,sBAAsB,CAAC"}
|
package/dist/index.mjs
CHANGED
|
@@ -348,6 +348,13 @@ function objectToReverseMap(object) {
|
|
|
348
348
|
}
|
|
349
349
|
return map;
|
|
350
350
|
}
|
|
351
|
+
function reverseObject(obj) {
|
|
352
|
+
const reversed = {};
|
|
353
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
354
|
+
reversed[value] = key;
|
|
355
|
+
}
|
|
356
|
+
return reversed;
|
|
357
|
+
}
|
|
351
358
|
|
|
352
359
|
function addSetsToSet(mainSet, ...setsToAdd) {
|
|
353
360
|
for (const set of setsToAdd) {
|
|
@@ -655,4 +662,4 @@ function* tupleKeys(tuple) {
|
|
|
655
662
|
|
|
656
663
|
const ReadonlyMap = Map;
|
|
657
664
|
|
|
658
|
-
export { HOUR_IN_MILLISECONDS, MINUTE_IN_MILLISECONDS, ReadonlyMap, ReadonlySet, SECOND_IN_MILLISECONDS, addSetsToSet, arrayCopyTwoDimensional, arrayEquals, arrayRemove, arrayRemoveAllInPlace, arrayRemoveInPlace, assertArray, assertArrayBoolean, assertArrayNumber, assertArrayObject, assertArrayString, assertBoolean, assertDefined, assertEnumValue, assertInteger, assertIs, assertNotNull, assertNumber, assertObject, assertString, assertStringNotEmpty, capitalizeFirstLetter, clamp, combineSets, copySet, eRange, emptyArray, escapeHTMLCharacters, filterAsync, filterMap, filterMapAsync, getElapsedSeconds, getEnumEntries, getEnumKeys, getEnumValues, getNumConsecutiveDiacritics, getRandomArrayElement, getRandomArrayIndex, getRandomInt, getWidenedObjectValue, hasDiacritic, hasEmoji, hasWhitespace, iRange, includes, includesAny, interfaceSatisfiesEnum, isASCII, isArray, isArrayBoolean, isArrayNumber, isArrayObject, isArrayString, isEnumValue, isFirstLetterCapitalized, isKebabCase, isKeyOf, isLowerCase, isObject, isSemanticVersion, isUpperCase, kebabCaseToCamelCase, kebabCaseToPascalCase, mapAsync, mapFilter, mapFind, newArray, noop, normalizeString, objectFilter, objectKeysToSet, objectMap, objectToMap, objectToReverseMap, objectValuesToSet, parseFloatSafe, parseIntSafe, parseSemanticVersion, removeLinesBetweenMarkers, removeLinesMatching, removeNonPrintableCharacters, removeWhitespace, repeat, satisfiesSemanticVersion, setAdd, setHas, sortCaseInsensitive, sumArray, titleCaseToKebabCase, todo, trimPrefix, trimSuffix, truncateString, tupleEntries, tupleKeys };
|
|
665
|
+
export { HOUR_IN_MILLISECONDS, MINUTE_IN_MILLISECONDS, ReadonlyMap, ReadonlySet, SECOND_IN_MILLISECONDS, addSetsToSet, arrayCopyTwoDimensional, arrayEquals, arrayRemove, arrayRemoveAllInPlace, arrayRemoveInPlace, assertArray, assertArrayBoolean, assertArrayNumber, assertArrayObject, assertArrayString, assertBoolean, assertDefined, assertEnumValue, assertInteger, assertIs, assertNotNull, assertNumber, assertObject, assertString, assertStringNotEmpty, capitalizeFirstLetter, clamp, combineSets, copySet, eRange, emptyArray, escapeHTMLCharacters, filterAsync, filterMap, filterMapAsync, getElapsedSeconds, getEnumEntries, getEnumKeys, getEnumValues, getNumConsecutiveDiacritics, getRandomArrayElement, getRandomArrayIndex, getRandomInt, getWidenedObjectValue, hasDiacritic, hasEmoji, hasWhitespace, iRange, includes, includesAny, interfaceSatisfiesEnum, isASCII, isArray, isArrayBoolean, isArrayNumber, isArrayObject, isArrayString, isEnumValue, isFirstLetterCapitalized, isKebabCase, isKeyOf, isLowerCase, isObject, isSemanticVersion, isUpperCase, kebabCaseToCamelCase, kebabCaseToPascalCase, mapAsync, mapFilter, mapFind, newArray, noop, normalizeString, objectFilter, objectKeysToSet, objectMap, objectToMap, objectToReverseMap, objectValuesToSet, parseFloatSafe, parseIntSafe, parseSemanticVersion, removeLinesBetweenMarkers, removeLinesMatching, removeNonPrintableCharacters, removeWhitespace, repeat, reverseObject, satisfiesSemanticVersion, setAdd, setHas, sortCaseInsensitive, sumArray, titleCaseToKebabCase, todo, trimPrefix, trimSuffix, truncateString, tupleEntries, tupleKeys };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SemanticVersion.d.ts","sourceRoot":"","sources":["../../src/interfaces/SemanticVersion.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,eAAe;IAC9B,uDAAuD;IACvD,YAAY,EAAE,MAAM,CAAC;IAErB,wDAAwD;IACxD,YAAY,EAAE,MAAM,CAAC;IAErB,uDAAuD;IACvD,YAAY,EAAE,MAAM,CAAC;CACtB"}
|
|
1
|
+
{"version":3,"file":"SemanticVersion.d.ts","sourceRoot":"","sources":["../../src/interfaces/SemanticVersion.ts"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,MAAM,WAAW,eAAe;IAC9B,uDAAuD;IACvD,YAAY,EAAE,MAAM,CAAC;IAErB,wDAAwD;IACxD,YAAY,EAAE,MAAM,CAAC;IAErB,uDAAuD;IACvD,YAAY,EAAE,MAAM,CAAC;CACtB"}
|
|
@@ -3,5 +3,5 @@
|
|
|
3
3
|
*
|
|
4
4
|
* This is the same thing as `Readonly<Record<K, V>>`.
|
|
5
5
|
*/
|
|
6
|
-
export type ReadonlyRecord<K extends
|
|
6
|
+
export type ReadonlyRecord<K extends PropertyKey, V> = Readonly<Record<K, V>>;
|
|
7
7
|
//# sourceMappingURL=ReadonlyRecord.d.ts.map
|
|
@@ -3,5 +3,5 @@
|
|
|
3
3
|
*
|
|
4
4
|
* This is the same thing as `Readonly<Record<K, V>>`.
|
|
5
5
|
*/
|
|
6
|
-
export type ReadonlyRecord<K extends
|
|
6
|
+
export type ReadonlyRecord<K extends PropertyKey, V> = Readonly<Record<K, V>>;
|
|
7
7
|
//# sourceMappingURL=ReadonlyRecord.d.ts.map
|
|
@@ -3,5 +3,5 @@
|
|
|
3
3
|
*
|
|
4
4
|
* This is the same thing as `Readonly<Record<K, V>>`.
|
|
5
5
|
*/
|
|
6
|
-
export type ReadonlyRecord<K extends
|
|
6
|
+
export type ReadonlyRecord<K extends PropertyKey, V> = Readonly<Record<K, V>>;
|
|
7
7
|
//# sourceMappingURL=ReadonlyRecord.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ReadonlyRecord.d.ts","sourceRoot":"","sources":["../../src/types/ReadonlyRecord.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,MAAM,cAAc,CAAC,CAAC,SAAS,
|
|
1
|
+
{"version":3,"file":"ReadonlyRecord.d.ts","sourceRoot":"","sources":["../../src/types/ReadonlyRecord.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,MAAM,cAAc,CAAC,CAAC,SAAS,WAAW,EAAE,CAAC,IAAI,QAAQ,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "complete-common",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.21.0",
|
|
4
4
|
"description": "Helper functions for TypeScript projects.",
|
|
5
5
|
"homepage": "https://complete-ts.github.io/",
|
|
6
6
|
"bugs": {
|
|
@@ -32,12 +32,12 @@
|
|
|
32
32
|
"test": "bun test"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"@types/node": "25.
|
|
36
|
-
"complete-node": "16.
|
|
35
|
+
"@types/node": "25.4.0",
|
|
36
|
+
"complete-node": "16.3.1",
|
|
37
37
|
"eslint-plugin-sort-exports": "0.9.1",
|
|
38
38
|
"typedoc": "0.28.17",
|
|
39
|
+
"typedoc-plugin-markdown": "4.10.0",
|
|
39
40
|
"typescript": "5.9.3",
|
|
40
|
-
"typescript-eslint": "8.56.1",
|
|
41
41
|
"unbuild": "3.6.1"
|
|
42
42
|
}
|
|
43
43
|
}
|
package/src/functions/array.ts
CHANGED
|
@@ -305,7 +305,7 @@ export function includesAny<T>(
|
|
|
305
305
|
|
|
306
306
|
/** A wrapper around `Array.isArray` that narrows to `unknown[]` instead of `any[]`. */
|
|
307
307
|
export function isArray(variable: unknown): variable is unknown[] {
|
|
308
|
-
return Array.isArray(variable);
|
|
308
|
+
return Array.isArray(variable); // eslint-disable-line complete/prefer-is-array
|
|
309
309
|
}
|
|
310
310
|
|
|
311
311
|
/** Helper function to check every value of an array to see if it is a boolean. */
|
package/src/functions/assert.ts
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
// We intentionally do not use the `isArray` helper function to avoid circular imports. (The
|
|
2
|
+
// improved return type is not needed for these assertion functions.)
|
|
3
|
+
/* eslint-disable complete/prefer-is-array */
|
|
4
|
+
|
|
1
5
|
/**
|
|
2
6
|
* Helper functions that have to do with asserting.
|
|
3
7
|
*
|
package/src/functions/object.ts
CHANGED
|
@@ -27,7 +27,7 @@ export function getWidenedObjectValue<T extends Record<string, unknown>>(
|
|
|
27
27
|
*
|
|
28
28
|
* This is efficient such that it avoids converting the object values into an array.
|
|
29
29
|
*/
|
|
30
|
-
export function objectFilter<K extends
|
|
30
|
+
export function objectFilter<K extends PropertyKey, V>(
|
|
31
31
|
object: ReadonlyRecord<K, V>,
|
|
32
32
|
predicate: (value: V) => boolean,
|
|
33
33
|
): readonly V[] {
|
|
@@ -49,7 +49,7 @@ export function objectFilter<K extends number | string | symbol, V>(
|
|
|
49
49
|
* Helper function to map the values in an object to another object with new values. Similar to the
|
|
50
50
|
* `Array.map` method, but works for objects.
|
|
51
51
|
*/
|
|
52
|
-
export function objectMap<K extends
|
|
52
|
+
export function objectMap<K extends PropertyKey, V, U>(
|
|
53
53
|
object: Record<K, V>,
|
|
54
54
|
callback: (key: K, value: V) => U,
|
|
55
55
|
): ReadonlyRecord<K, U> {
|
|
@@ -72,7 +72,7 @@ export function objectMap<K extends number | string | symbol, V, U>(
|
|
|
72
72
|
* Note that the converted map will only have string keys, due to the nature of JavaScript objects
|
|
73
73
|
* only having string keys under the hood.
|
|
74
74
|
*/
|
|
75
|
-
export function objectToMap<K extends
|
|
75
|
+
export function objectToMap<K extends PropertyKey, V>(
|
|
76
76
|
object: Record<K, V>,
|
|
77
77
|
): ReadonlyMap<K, V> {
|
|
78
78
|
const map = new Map<K, V>();
|
|
@@ -91,8 +91,8 @@ export function objectToMap<K extends number | string | symbol, V>(
|
|
|
91
91
|
* only having string keys under the hood.
|
|
92
92
|
*/
|
|
93
93
|
export function objectToReverseMap<
|
|
94
|
-
K extends
|
|
95
|
-
V extends
|
|
94
|
+
K extends PropertyKey,
|
|
95
|
+
V extends PropertyKey,
|
|
96
96
|
>(object: Record<K, V>): ReadonlyMap<V, K> {
|
|
97
97
|
const map = new Map<V, K>();
|
|
98
98
|
|
|
@@ -102,3 +102,21 @@ export function objectToReverseMap<
|
|
|
102
102
|
|
|
103
103
|
return map;
|
|
104
104
|
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Helper function to reverse the keys and values of an object.
|
|
108
|
+
*
|
|
109
|
+
* @throws If the object has duplicate values.
|
|
110
|
+
*/
|
|
111
|
+
export function reverseObject<K extends PropertyKey, V extends PropertyKey>(
|
|
112
|
+
obj: Record<K, V>,
|
|
113
|
+
): ReadonlyRecord<V, K> {
|
|
114
|
+
const reversed: Partial<Record<V, K>> = {};
|
|
115
|
+
|
|
116
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
117
|
+
// Type assertions are required because `Object.entries` widens the key type to a string.
|
|
118
|
+
reversed[value as V] = key as K;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
return reversed as ReadonlyRecord<V, K>;
|
|
122
|
+
}
|
package/src/functions/set.ts
CHANGED
|
@@ -52,7 +52,7 @@ export function copySet<T>(oldSet: ReadonlySet<T>): ReadonlySet<T> {
|
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
/** Helper function to convert the keys of an object to a set. */
|
|
55
|
-
export function objectKeysToSet<K extends
|
|
55
|
+
export function objectKeysToSet<K extends PropertyKey, V>(
|
|
56
56
|
object: Record<K, V>,
|
|
57
57
|
): ReadonlySet<K> {
|
|
58
58
|
const set = new Set<K>();
|
|
@@ -65,7 +65,7 @@ export function objectKeysToSet<K extends number | string | symbol, V>(
|
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
/** Helper function to convert the values of an object to a set. */
|
|
68
|
-
export function objectValuesToSet<K extends
|
|
68
|
+
export function objectValuesToSet<K extends PropertyKey, V>(
|
|
69
69
|
object: Record<K, V>,
|
|
70
70
|
): ReadonlySet<V> {
|
|
71
71
|
const set = new Set<V>();
|
package/src/functions/string.ts
CHANGED
|
@@ -312,6 +312,8 @@ export function removeWhitespace(string: string): string {
|
|
|
312
312
|
/**
|
|
313
313
|
* Helper function to check if a semantic version is equal to or greater than a second semantic
|
|
314
314
|
* version.
|
|
315
|
+
*
|
|
316
|
+
* @throws If either the version or minimum version are not valid semantic versions.
|
|
315
317
|
*/
|
|
316
318
|
export function satisfiesSemanticVersion(
|
|
317
319
|
version: string,
|
package/src/functions/types.ts
CHANGED
package/src/index.ts
CHANGED
|
@@ -13,6 +13,7 @@ export * from "./functions/time.js";
|
|
|
13
13
|
export * from "./functions/tuple.js";
|
|
14
14
|
export * from "./functions/types.js";
|
|
15
15
|
export * from "./functions/utils.js";
|
|
16
|
+
export type * from "./interfaces/SemanticVersion.js";
|
|
16
17
|
export type * from "./types/AddSubtract.js";
|
|
17
18
|
export type * from "./types/CompositionTypeSatisfiesEnum.js";
|
|
18
19
|
export type * from "./types/ERange.js";
|