complete-common 2.19.0 → 2.20.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.cts +1 -1
- package/dist/functions/array.d.mts +1 -1
- package/dist/functions/array.d.ts +1 -1
- package/dist/functions/array.d.ts.map +1 -1
- package/dist/functions/string.d.cts +7 -8
- package/dist/functions/string.d.mts +7 -8
- package/dist/functions/string.d.ts +7 -8
- package/dist/functions/string.d.ts.map +1 -1
- package/dist/index.cjs +20 -0
- package/dist/index.mjs +20 -1
- package/dist/interfaces/SemanticVersion.d.cts +9 -0
- package/dist/interfaces/SemanticVersion.d.mts +9 -0
- package/dist/interfaces/SemanticVersion.d.ts +9 -0
- package/dist/interfaces/SemanticVersion.d.ts.map +1 -0
- package/package.json +1 -1
- package/src/functions/array.ts +3 -1
- package/src/functions/string.ts +43 -12
- package/src/interfaces/SemanticVersion.ts +10 -0
|
@@ -135,7 +135,7 @@ export declare function isArrayBoolean(variable: unknown): variable is boolean[]
|
|
|
135
135
|
/** Helper function to check every value of an array to see if it is a number. */
|
|
136
136
|
export declare function isArrayNumber(variable: unknown): variable is number[];
|
|
137
137
|
/** Helper function to check every value of an array to see if it is an object. */
|
|
138
|
-
export declare function isArrayObject(variable: unknown): variable is string
|
|
138
|
+
export declare function isArrayObject(variable: unknown): variable is Array<Record<string, unknown>>;
|
|
139
139
|
/** Helper function to check every value of an array to see if it is a string. */
|
|
140
140
|
export declare function isArrayString(variable: unknown): variable is string[];
|
|
141
141
|
/**
|
|
@@ -135,7 +135,7 @@ export declare function isArrayBoolean(variable: unknown): variable is boolean[]
|
|
|
135
135
|
/** Helper function to check every value of an array to see if it is a number. */
|
|
136
136
|
export declare function isArrayNumber(variable: unknown): variable is number[];
|
|
137
137
|
/** Helper function to check every value of an array to see if it is an object. */
|
|
138
|
-
export declare function isArrayObject(variable: unknown): variable is string
|
|
138
|
+
export declare function isArrayObject(variable: unknown): variable is Array<Record<string, unknown>>;
|
|
139
139
|
/** Helper function to check every value of an array to see if it is a string. */
|
|
140
140
|
export declare function isArrayString(variable: unknown): variable is string[];
|
|
141
141
|
/**
|
|
@@ -135,7 +135,7 @@ export declare function isArrayBoolean(variable: unknown): variable is boolean[]
|
|
|
135
135
|
/** Helper function to check every value of an array to see if it is a number. */
|
|
136
136
|
export declare function isArrayNumber(variable: unknown): variable is number[];
|
|
137
137
|
/** Helper function to check every value of an array to see if it is an object. */
|
|
138
|
-
export declare function isArrayObject(variable: unknown): variable is string
|
|
138
|
+
export declare function isArrayObject(variable: unknown): variable is Array<Record<string, unknown>>;
|
|
139
139
|
/** Helper function to check every value of an array to see if it is a string. */
|
|
140
140
|
export declare function isArrayString(variable: unknown): variable is string[];
|
|
141
141
|
/**
|
|
@@ -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,CAQ7B;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,GA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H,wBAAsB,QAAQ,CAAC,CAAC,EAAE,CAAC,EACjC,KAAK,EAAE,SAAS,CAAC,EAAE,EACnB,QAAQ,EAAE,CAAC,OAAO,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,CAAC,EAAE,KAAK,OAAO,CAAC,CAAC,CAAC,GACvE,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC,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"}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @module
|
|
5
5
|
*/
|
|
6
|
+
import type { SemanticVersion } from "../interfaces/SemanticVersion.js";
|
|
6
7
|
/** Helper function to capitalize the first letter of a string. */
|
|
7
8
|
export declare function capitalizeFirstLetter(string: string): string;
|
|
8
9
|
/**
|
|
@@ -73,14 +74,7 @@ export declare function normalizeString(string: string): string;
|
|
|
73
74
|
*
|
|
74
75
|
* @see https://semver.org/
|
|
75
76
|
*/
|
|
76
|
-
export declare function parseSemanticVersion(versionString: string):
|
|
77
|
-
/** The first number inside of the semantic version. */
|
|
78
|
-
majorVersion: number;
|
|
79
|
-
/** The second number inside of the semantic version. */
|
|
80
|
-
minorVersion: number;
|
|
81
|
-
/** The third number inside of the semantic version. */
|
|
82
|
-
patchVersion: number;
|
|
83
|
-
} | undefined;
|
|
77
|
+
export declare function parseSemanticVersion(versionString: string): SemanticVersion | undefined;
|
|
84
78
|
/**
|
|
85
79
|
* Helper function to remove lines from a multi-line string. This function looks for a "-start" and
|
|
86
80
|
* a "-end" suffix after the marker. Lines with markets will be completely removed from the output.
|
|
@@ -115,6 +109,11 @@ export declare function removeLinesMatching(string: string, match: string): stri
|
|
|
115
109
|
export declare function removeNonPrintableCharacters(string: string): string;
|
|
116
110
|
/** Helper function to remove all whitespace characters from a string. */
|
|
117
111
|
export declare function removeWhitespace(string: string): string;
|
|
112
|
+
/**
|
|
113
|
+
* Helper function to check if a semantic version is equal to or greater than a second semantic
|
|
114
|
+
* version.
|
|
115
|
+
*/
|
|
116
|
+
export declare function satisfiesSemanticVersion(version: string, minimumVersion: string): boolean;
|
|
118
117
|
/** Helper function to convert a string from TitleCase (PascalCase) to kebab-case. */
|
|
119
118
|
export declare function titleCaseToKebabCase(string: string): string;
|
|
120
119
|
/**
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @module
|
|
5
5
|
*/
|
|
6
|
+
import type { SemanticVersion } from "../interfaces/SemanticVersion.js";
|
|
6
7
|
/** Helper function to capitalize the first letter of a string. */
|
|
7
8
|
export declare function capitalizeFirstLetter(string: string): string;
|
|
8
9
|
/**
|
|
@@ -73,14 +74,7 @@ export declare function normalizeString(string: string): string;
|
|
|
73
74
|
*
|
|
74
75
|
* @see https://semver.org/
|
|
75
76
|
*/
|
|
76
|
-
export declare function parseSemanticVersion(versionString: string):
|
|
77
|
-
/** The first number inside of the semantic version. */
|
|
78
|
-
majorVersion: number;
|
|
79
|
-
/** The second number inside of the semantic version. */
|
|
80
|
-
minorVersion: number;
|
|
81
|
-
/** The third number inside of the semantic version. */
|
|
82
|
-
patchVersion: number;
|
|
83
|
-
} | undefined;
|
|
77
|
+
export declare function parseSemanticVersion(versionString: string): SemanticVersion | undefined;
|
|
84
78
|
/**
|
|
85
79
|
* Helper function to remove lines from a multi-line string. This function looks for a "-start" and
|
|
86
80
|
* a "-end" suffix after the marker. Lines with markets will be completely removed from the output.
|
|
@@ -115,6 +109,11 @@ export declare function removeLinesMatching(string: string, match: string): stri
|
|
|
115
109
|
export declare function removeNonPrintableCharacters(string: string): string;
|
|
116
110
|
/** Helper function to remove all whitespace characters from a string. */
|
|
117
111
|
export declare function removeWhitespace(string: string): string;
|
|
112
|
+
/**
|
|
113
|
+
* Helper function to check if a semantic version is equal to or greater than a second semantic
|
|
114
|
+
* version.
|
|
115
|
+
*/
|
|
116
|
+
export declare function satisfiesSemanticVersion(version: string, minimumVersion: string): boolean;
|
|
118
117
|
/** Helper function to convert a string from TitleCase (PascalCase) to kebab-case. */
|
|
119
118
|
export declare function titleCaseToKebabCase(string: string): string;
|
|
120
119
|
/**
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @module
|
|
5
5
|
*/
|
|
6
|
+
import type { SemanticVersion } from "../interfaces/SemanticVersion.js";
|
|
6
7
|
/** Helper function to capitalize the first letter of a string. */
|
|
7
8
|
export declare function capitalizeFirstLetter(string: string): string;
|
|
8
9
|
/**
|
|
@@ -73,14 +74,7 @@ export declare function normalizeString(string: string): string;
|
|
|
73
74
|
*
|
|
74
75
|
* @see https://semver.org/
|
|
75
76
|
*/
|
|
76
|
-
export declare function parseSemanticVersion(versionString: string):
|
|
77
|
-
/** The first number inside of the semantic version. */
|
|
78
|
-
majorVersion: number;
|
|
79
|
-
/** The second number inside of the semantic version. */
|
|
80
|
-
minorVersion: number;
|
|
81
|
-
/** The third number inside of the semantic version. */
|
|
82
|
-
patchVersion: number;
|
|
83
|
-
} | undefined;
|
|
77
|
+
export declare function parseSemanticVersion(versionString: string): SemanticVersion | undefined;
|
|
84
78
|
/**
|
|
85
79
|
* Helper function to remove lines from a multi-line string. This function looks for a "-start" and
|
|
86
80
|
* a "-end" suffix after the marker. Lines with markets will be completely removed from the output.
|
|
@@ -115,6 +109,11 @@ export declare function removeLinesMatching(string: string, match: string): stri
|
|
|
115
109
|
export declare function removeNonPrintableCharacters(string: string): string;
|
|
116
110
|
/** Helper function to remove all whitespace characters from a string. */
|
|
117
111
|
export declare function removeWhitespace(string: string): string;
|
|
112
|
+
/**
|
|
113
|
+
* Helper function to check if a semantic version is equal to or greater than a second semantic
|
|
114
|
+
* version.
|
|
115
|
+
*/
|
|
116
|
+
export declare function satisfiesSemanticVersion(version: string, minimumVersion: string): boolean;
|
|
118
117
|
/** Helper function to convert a string from TitleCase (PascalCase) to kebab-case. */
|
|
119
118
|
export declare function titleCaseToKebabCase(string: string): string;
|
|
120
119
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"string.d.ts","sourceRoot":"","sources":["../../src/functions/string.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
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,CAErD;AAED,+EAA+E;AAC/E,wBAAgB,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAE5C;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAEhE;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAEnD;AAED,+FAA+F;AAC/F,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAEnD;AAED;;;;GAIG;AACH,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M,EAAE,MAAM,GAAG,MAAM,CAOjE;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAMxE"}
|
package/dist/index.cjs
CHANGED
|
@@ -595,6 +595,25 @@ function removeNonPrintableCharacters(string) {
|
|
|
595
595
|
function removeWhitespace(string) {
|
|
596
596
|
return string.replaceAll(WHITESPACE_GLOBAL_REGEX, "");
|
|
597
597
|
}
|
|
598
|
+
function satisfiesSemanticVersion(version, minimumVersion) {
|
|
599
|
+
const semanticVersion = parseSemanticVersion(version);
|
|
600
|
+
assertDefined(
|
|
601
|
+
semanticVersion,
|
|
602
|
+
`The following version is not a semantic version: ${version}`
|
|
603
|
+
);
|
|
604
|
+
const { majorVersion, minorVersion, patchVersion } = semanticVersion;
|
|
605
|
+
const minimumSemanticVersion = parseSemanticVersion(minimumVersion);
|
|
606
|
+
assertDefined(
|
|
607
|
+
minimumSemanticVersion,
|
|
608
|
+
`The following minimum version is not a semantic version: ${minimumVersion}`
|
|
609
|
+
);
|
|
610
|
+
const {
|
|
611
|
+
majorVersion: minimumMajorVersion,
|
|
612
|
+
minorVersion: minimumMinorVersion,
|
|
613
|
+
patchVersion: minimumPatchVersion
|
|
614
|
+
} = minimumSemanticVersion;
|
|
615
|
+
return majorVersion > minimumMajorVersion || majorVersion === minimumMajorVersion && minorVersion > minimumMinorVersion || majorVersion === minimumMajorVersion && minorVersion === minimumMinorVersion && patchVersion >= minimumPatchVersion;
|
|
616
|
+
}
|
|
598
617
|
function titleCaseToKebabCase(string) {
|
|
599
618
|
return string.replaceAll(TITLE_CASE_BOUNDARY_REGEX, "-").replaceAll(/ +/g, "-").toLowerCase();
|
|
600
619
|
}
|
|
@@ -726,6 +745,7 @@ exports.removeLinesMatching = removeLinesMatching;
|
|
|
726
745
|
exports.removeNonPrintableCharacters = removeNonPrintableCharacters;
|
|
727
746
|
exports.removeWhitespace = removeWhitespace;
|
|
728
747
|
exports.repeat = repeat;
|
|
748
|
+
exports.satisfiesSemanticVersion = satisfiesSemanticVersion;
|
|
729
749
|
exports.setAdd = setAdd;
|
|
730
750
|
exports.setHas = setHas;
|
|
731
751
|
exports.sortCaseInsensitive = sortCaseInsensitive;
|
package/dist/index.mjs
CHANGED
|
@@ -593,6 +593,25 @@ function removeNonPrintableCharacters(string) {
|
|
|
593
593
|
function removeWhitespace(string) {
|
|
594
594
|
return string.replaceAll(WHITESPACE_GLOBAL_REGEX, "");
|
|
595
595
|
}
|
|
596
|
+
function satisfiesSemanticVersion(version, minimumVersion) {
|
|
597
|
+
const semanticVersion = parseSemanticVersion(version);
|
|
598
|
+
assertDefined(
|
|
599
|
+
semanticVersion,
|
|
600
|
+
`The following version is not a semantic version: ${version}`
|
|
601
|
+
);
|
|
602
|
+
const { majorVersion, minorVersion, patchVersion } = semanticVersion;
|
|
603
|
+
const minimumSemanticVersion = parseSemanticVersion(minimumVersion);
|
|
604
|
+
assertDefined(
|
|
605
|
+
minimumSemanticVersion,
|
|
606
|
+
`The following minimum version is not a semantic version: ${minimumVersion}`
|
|
607
|
+
);
|
|
608
|
+
const {
|
|
609
|
+
majorVersion: minimumMajorVersion,
|
|
610
|
+
minorVersion: minimumMinorVersion,
|
|
611
|
+
patchVersion: minimumPatchVersion
|
|
612
|
+
} = minimumSemanticVersion;
|
|
613
|
+
return majorVersion > minimumMajorVersion || majorVersion === minimumMajorVersion && minorVersion > minimumMinorVersion || majorVersion === minimumMajorVersion && minorVersion === minimumMinorVersion && patchVersion >= minimumPatchVersion;
|
|
614
|
+
}
|
|
596
615
|
function titleCaseToKebabCase(string) {
|
|
597
616
|
return string.replaceAll(TITLE_CASE_BOUNDARY_REGEX, "-").replaceAll(/ +/g, "-").toLowerCase();
|
|
598
617
|
}
|
|
@@ -636,4 +655,4 @@ function* tupleKeys(tuple) {
|
|
|
636
655
|
|
|
637
656
|
const ReadonlyMap = Map;
|
|
638
657
|
|
|
639
|
-
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, setAdd, setHas, sortCaseInsensitive, sumArray, titleCaseToKebabCase, todo, trimPrefix, trimSuffix, truncateString, tupleEntries, tupleKeys };
|
|
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 };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface SemanticVersion {
|
|
2
|
+
/** The first number inside of the semantic version. */
|
|
3
|
+
majorVersion: number;
|
|
4
|
+
/** The second number inside of the semantic version. */
|
|
5
|
+
minorVersion: number;
|
|
6
|
+
/** The third number inside of the semantic version. */
|
|
7
|
+
patchVersion: number;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=SemanticVersion.d.ts.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface SemanticVersion {
|
|
2
|
+
/** The first number inside of the semantic version. */
|
|
3
|
+
majorVersion: number;
|
|
4
|
+
/** The second number inside of the semantic version. */
|
|
5
|
+
minorVersion: number;
|
|
6
|
+
/** The third number inside of the semantic version. */
|
|
7
|
+
patchVersion: number;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=SemanticVersion.d.ts.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface SemanticVersion {
|
|
2
|
+
/** The first number inside of the semantic version. */
|
|
3
|
+
majorVersion: number;
|
|
4
|
+
/** The second number inside of the semantic version. */
|
|
5
|
+
minorVersion: number;
|
|
6
|
+
/** The third number inside of the semantic version. */
|
|
7
|
+
patchVersion: number;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=SemanticVersion.d.ts.map
|
|
@@ -0,0 +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"}
|
package/package.json
CHANGED
package/src/functions/array.ts
CHANGED
|
@@ -327,7 +327,9 @@ export function isArrayNumber(variable: unknown): variable is number[] {
|
|
|
327
327
|
}
|
|
328
328
|
|
|
329
329
|
/** Helper function to check every value of an array to see if it is an object. */
|
|
330
|
-
export function isArrayObject(
|
|
330
|
+
export function isArrayObject(
|
|
331
|
+
variable: unknown,
|
|
332
|
+
): variable is Array<Record<string, unknown>> {
|
|
331
333
|
if (!isArray(variable)) {
|
|
332
334
|
return false;
|
|
333
335
|
}
|
package/src/functions/string.ts
CHANGED
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
* @module
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
+
import type { SemanticVersion } from "../interfaces/SemanticVersion.js";
|
|
8
|
+
import { assertDefined } from "./assert.js";
|
|
7
9
|
import { parseIntSafe } from "./utils.js";
|
|
8
10
|
|
|
9
11
|
// When regular expressions are located at the root instead of inside the function, the functions
|
|
@@ -205,18 +207,9 @@ export function normalizeString(string: string): string {
|
|
|
205
207
|
*
|
|
206
208
|
* @see https://semver.org/
|
|
207
209
|
*/
|
|
208
|
-
export function parseSemanticVersion(
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
majorVersion: number;
|
|
212
|
-
|
|
213
|
-
/** The second number inside of the semantic version. */
|
|
214
|
-
minorVersion: number;
|
|
215
|
-
|
|
216
|
-
/** The third number inside of the semantic version. */
|
|
217
|
-
patchVersion: number;
|
|
218
|
-
}
|
|
219
|
-
| undefined {
|
|
210
|
+
export function parseSemanticVersion(
|
|
211
|
+
versionString: string,
|
|
212
|
+
): SemanticVersion | undefined {
|
|
220
213
|
const match = versionString.match(SEMANTIC_VERSION_REGEX);
|
|
221
214
|
if (match === null || match.groups === undefined) {
|
|
222
215
|
return undefined;
|
|
@@ -316,6 +309,44 @@ export function removeWhitespace(string: string): string {
|
|
|
316
309
|
return string.replaceAll(WHITESPACE_GLOBAL_REGEX, "");
|
|
317
310
|
}
|
|
318
311
|
|
|
312
|
+
/**
|
|
313
|
+
* Helper function to check if a semantic version is equal to or greater than a second semantic
|
|
314
|
+
* version.
|
|
315
|
+
*/
|
|
316
|
+
export function satisfiesSemanticVersion(
|
|
317
|
+
version: string,
|
|
318
|
+
minimumVersion: string,
|
|
319
|
+
): boolean {
|
|
320
|
+
const semanticVersion = parseSemanticVersion(version);
|
|
321
|
+
assertDefined(
|
|
322
|
+
semanticVersion,
|
|
323
|
+
`The following version is not a semantic version: ${version}`,
|
|
324
|
+
);
|
|
325
|
+
|
|
326
|
+
const { majorVersion, minorVersion, patchVersion } = semanticVersion;
|
|
327
|
+
|
|
328
|
+
const minimumSemanticVersion = parseSemanticVersion(minimumVersion);
|
|
329
|
+
assertDefined(
|
|
330
|
+
minimumSemanticVersion,
|
|
331
|
+
`The following minimum version is not a semantic version: ${minimumVersion}`,
|
|
332
|
+
);
|
|
333
|
+
|
|
334
|
+
const {
|
|
335
|
+
majorVersion: minimumMajorVersion,
|
|
336
|
+
minorVersion: minimumMinorVersion,
|
|
337
|
+
patchVersion: minimumPatchVersion,
|
|
338
|
+
} = minimumSemanticVersion;
|
|
339
|
+
|
|
340
|
+
return (
|
|
341
|
+
majorVersion > minimumMajorVersion
|
|
342
|
+
|| (majorVersion === minimumMajorVersion
|
|
343
|
+
&& minorVersion > minimumMinorVersion)
|
|
344
|
+
|| (majorVersion === minimumMajorVersion
|
|
345
|
+
&& minorVersion === minimumMinorVersion
|
|
346
|
+
&& patchVersion >= minimumPatchVersion)
|
|
347
|
+
);
|
|
348
|
+
}
|
|
349
|
+
|
|
319
350
|
/** Helper function to convert a string from TitleCase (PascalCase) to kebab-case. */
|
|
320
351
|
export function titleCaseToKebabCase(string: string): string {
|
|
321
352
|
return string
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface SemanticVersion {
|
|
2
|
+
/** The first number inside of the semantic version. */
|
|
3
|
+
majorVersion: number;
|
|
4
|
+
|
|
5
|
+
/** The second number inside of the semantic version. */
|
|
6
|
+
minorVersion: number;
|
|
7
|
+
|
|
8
|
+
/** The third number inside of the semantic version. */
|
|
9
|
+
patchVersion: number;
|
|
10
|
+
}
|