@alextheman/utility 5.23.1 → 5.23.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1942,6 +1942,8 @@ function normaliseIndents(first, ...args) {
1942
1942
  * and another new line`.
1943
1943
  * ```
1944
1944
  *
1945
+ * @category Tagged Template
1946
+ *
1945
1947
  * @param first - The strings from the template to process, or the options to apply.
1946
1948
  * @param args - An array of all interpolations from the template.
1947
1949
  *
package/dist/index.d.cts CHANGED
@@ -1154,6 +1154,8 @@ declare function normaliseIndents(options: NormaliseIndentsOptions): NormaliseIn
1154
1154
  * and another new line`;
1155
1155
  * ```
1156
1156
  *
1157
+ * @category Tagged Template
1158
+ *
1157
1159
  * @template InterpolationsType - The type of the interpolations.
1158
1160
  *
1159
1161
  * @param strings - The strings from the template to process.
@@ -1181,6 +1183,8 @@ declare function normaliseIndents(strings: TemplateStringsArray, ...interpolatio
1181
1183
  * and another new line`.
1182
1184
  * ```
1183
1185
  *
1186
+ * @category Tagged Template
1187
+ *
1184
1188
  * @param first - The strings from the template to process, or the options to apply.
1185
1189
  * @param args - An array of all interpolations from the template.
1186
1190
  *
package/dist/index.d.ts CHANGED
@@ -1154,6 +1154,8 @@ declare function normaliseIndents(options: NormaliseIndentsOptions): NormaliseIn
1154
1154
  * and another new line`;
1155
1155
  * ```
1156
1156
  *
1157
+ * @category Tagged Template
1158
+ *
1157
1159
  * @template InterpolationsType - The type of the interpolations.
1158
1160
  *
1159
1161
  * @param strings - The strings from the template to process.
@@ -1181,6 +1183,8 @@ declare function normaliseIndents(strings: TemplateStringsArray, ...interpolatio
1181
1183
  * and another new line`.
1182
1184
  * ```
1183
1185
  *
1186
+ * @category Tagged Template
1187
+ *
1184
1188
  * @param first - The strings from the template to process, or the options to apply.
1185
1189
  * @param args - An array of all interpolations from the template.
1186
1190
  *
package/dist/index.js CHANGED
@@ -1918,6 +1918,8 @@ function normaliseIndents(first, ...args) {
1918
1918
  * and another new line`.
1919
1919
  * ```
1920
1920
  *
1921
+ * @category Tagged Template
1922
+ *
1921
1923
  * @param first - The strings from the template to process, or the options to apply.
1922
1924
  * @param args - An array of all interpolations from the template.
1923
1925
  *
@@ -244,49 +244,6 @@ var DataError = class DataError extends CodeError {
244
244
  }
245
245
  };
246
246
  //#endregion
247
- //#region src/root/functions/parsers/parseIntStrict.ts
248
- /**
249
- * Converts a string to an integer and throws an error if it cannot be converted.
250
- *
251
- * @category Parsers
252
- *
253
- * @param string - A string to convert into a number.
254
- * @param radix - A value between 2 and 36 that specifies the base of the number in string. If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal. All other strings are considered decimal.
255
- *
256
- * @throws {DataError} If the provided string cannot safely be converted to an integer.
257
- *
258
- * @returns The integer parsed from the input string.
259
- */
260
- function parseIntStrict(string, radix) {
261
- const trimmedString = string.trim();
262
- const maxAllowedAlphabeticalCharacter = radix && radix > 10 && radix <= 36 ? String.fromCharCode(87 + radix - 1) : void 0;
263
- if (!(radix && radix > 10 && radix <= 36 ? new RegExp(`^[+-]?[0-9a-${maxAllowedAlphabeticalCharacter}]+$`, "i") : /^[+-]?\d+$/).test(trimmedString)) throw new DataError(radix ? {
264
- string,
265
- radix
266
- } : { string }, "INTEGER_PARSING_ERROR", `Only numeric values${radix && radix > 10 && radix <= 36 ? ` or character${radix !== 11 ? "s" : ""} A${radix !== 11 ? `-${maxAllowedAlphabeticalCharacter?.toUpperCase()} ` : " "}` : " "}are allowed.`);
267
- if (radix && radix < 10 && [...trimmedString.replace(/^[+-]/, "")].some((character) => {
268
- return parseInt(character) >= radix;
269
- })) throw new DataError({
270
- string,
271
- radix
272
- }, "INTEGER_PARSING_ERROR", "Value contains one or more digits outside of the range of the given radix.");
273
- const parseIntResult = parseInt(trimmedString, radix);
274
- if (isNaN(parseIntResult)) throw new DataError({ string }, "INTEGER_PARSING_ERROR", "Value is not a valid integer.");
275
- return parseIntResult;
276
- }
277
- //#endregion
278
- //#region src/root/functions/parsers/parseVersionType.ts
279
- /**
280
- * Represents the three common software version types.
281
- *
282
- * @category Types
283
- */
284
- const VersionType = {
285
- MAJOR: "major",
286
- MINOR: "minor",
287
- PATCH: "patch"
288
- };
289
- //#endregion
290
247
  //#region src/root/functions/arrayHelpers/range.ts
291
248
  /**
292
249
  * Creates an array of numbers within a given range.
@@ -428,6 +385,49 @@ function paralleliseArrays(firstArray, secondArray) {
428
385
  return outputArray;
429
386
  }
430
387
  //#endregion
388
+ //#region src/root/functions/parsers/parseIntStrict.ts
389
+ /**
390
+ * Converts a string to an integer and throws an error if it cannot be converted.
391
+ *
392
+ * @category Parsers
393
+ *
394
+ * @param string - A string to convert into a number.
395
+ * @param radix - A value between 2 and 36 that specifies the base of the number in string. If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal. All other strings are considered decimal.
396
+ *
397
+ * @throws {DataError} If the provided string cannot safely be converted to an integer.
398
+ *
399
+ * @returns The integer parsed from the input string.
400
+ */
401
+ function parseIntStrict(string, radix) {
402
+ const trimmedString = string.trim();
403
+ const maxAllowedAlphabeticalCharacter = radix && radix > 10 && radix <= 36 ? String.fromCharCode(87 + radix - 1) : void 0;
404
+ if (!(radix && radix > 10 && radix <= 36 ? new RegExp(`^[+-]?[0-9a-${maxAllowedAlphabeticalCharacter}]+$`, "i") : /^[+-]?\d+$/).test(trimmedString)) throw new DataError(radix ? {
405
+ string,
406
+ radix
407
+ } : { string }, "INTEGER_PARSING_ERROR", `Only numeric values${radix && radix > 10 && radix <= 36 ? ` or character${radix !== 11 ? "s" : ""} A${radix !== 11 ? `-${maxAllowedAlphabeticalCharacter?.toUpperCase()} ` : " "}` : " "}are allowed.`);
408
+ if (radix && radix < 10 && [...trimmedString.replace(/^[+-]/, "")].some((character) => {
409
+ return parseInt(character) >= radix;
410
+ })) throw new DataError({
411
+ string,
412
+ radix
413
+ }, "INTEGER_PARSING_ERROR", "Value contains one or more digits outside of the range of the given radix.");
414
+ const parseIntResult = parseInt(trimmedString, radix);
415
+ if (isNaN(parseIntResult)) throw new DataError({ string }, "INTEGER_PARSING_ERROR", "Value is not a valid integer.");
416
+ return parseIntResult;
417
+ }
418
+ //#endregion
419
+ //#region src/root/functions/parsers/parseVersionType.ts
420
+ /**
421
+ * Represents the three common software version types.
422
+ *
423
+ * @category Types
424
+ */
425
+ const VersionType = {
426
+ MAJOR: "major",
427
+ MINOR: "minor",
428
+ PATCH: "patch"
429
+ };
430
+ //#endregion
431
431
  //#region src/root/functions/taggedTemplate/interpolate.ts
432
432
  /**
433
433
  * Returns the result of interpolating a template string when given the strings and interpolations separately.
@@ -219,49 +219,6 @@ var DataError = class DataError extends CodeError {
219
219
  }
220
220
  };
221
221
  //#endregion
222
- //#region src/root/functions/parsers/parseIntStrict.ts
223
- /**
224
- * Converts a string to an integer and throws an error if it cannot be converted.
225
- *
226
- * @category Parsers
227
- *
228
- * @param string - A string to convert into a number.
229
- * @param radix - A value between 2 and 36 that specifies the base of the number in string. If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal. All other strings are considered decimal.
230
- *
231
- * @throws {DataError} If the provided string cannot safely be converted to an integer.
232
- *
233
- * @returns The integer parsed from the input string.
234
- */
235
- function parseIntStrict(string, radix) {
236
- const trimmedString = string.trim();
237
- const maxAllowedAlphabeticalCharacter = radix && radix > 10 && radix <= 36 ? String.fromCharCode(87 + radix - 1) : void 0;
238
- if (!(radix && radix > 10 && radix <= 36 ? new RegExp(`^[+-]?[0-9a-${maxAllowedAlphabeticalCharacter}]+$`, "i") : /^[+-]?\d+$/).test(trimmedString)) throw new DataError(radix ? {
239
- string,
240
- radix
241
- } : { string }, "INTEGER_PARSING_ERROR", `Only numeric values${radix && radix > 10 && radix <= 36 ? ` or character${radix !== 11 ? "s" : ""} A${radix !== 11 ? `-${maxAllowedAlphabeticalCharacter?.toUpperCase()} ` : " "}` : " "}are allowed.`);
242
- if (radix && radix < 10 && [...trimmedString.replace(/^[+-]/, "")].some((character) => {
243
- return parseInt(character) >= radix;
244
- })) throw new DataError({
245
- string,
246
- radix
247
- }, "INTEGER_PARSING_ERROR", "Value contains one or more digits outside of the range of the given radix.");
248
- const parseIntResult = parseInt(trimmedString, radix);
249
- if (isNaN(parseIntResult)) throw new DataError({ string }, "INTEGER_PARSING_ERROR", "Value is not a valid integer.");
250
- return parseIntResult;
251
- }
252
- //#endregion
253
- //#region src/root/functions/parsers/parseVersionType.ts
254
- /**
255
- * Represents the three common software version types.
256
- *
257
- * @category Types
258
- */
259
- const VersionType = {
260
- MAJOR: "major",
261
- MINOR: "minor",
262
- PATCH: "patch"
263
- };
264
- //#endregion
265
222
  //#region src/root/functions/arrayHelpers/range.ts
266
223
  /**
267
224
  * Creates an array of numbers within a given range.
@@ -403,6 +360,49 @@ function paralleliseArrays(firstArray, secondArray) {
403
360
  return outputArray;
404
361
  }
405
362
  //#endregion
363
+ //#region src/root/functions/parsers/parseIntStrict.ts
364
+ /**
365
+ * Converts a string to an integer and throws an error if it cannot be converted.
366
+ *
367
+ * @category Parsers
368
+ *
369
+ * @param string - A string to convert into a number.
370
+ * @param radix - A value between 2 and 36 that specifies the base of the number in string. If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal. All other strings are considered decimal.
371
+ *
372
+ * @throws {DataError} If the provided string cannot safely be converted to an integer.
373
+ *
374
+ * @returns The integer parsed from the input string.
375
+ */
376
+ function parseIntStrict(string, radix) {
377
+ const trimmedString = string.trim();
378
+ const maxAllowedAlphabeticalCharacter = radix && radix > 10 && radix <= 36 ? String.fromCharCode(87 + radix - 1) : void 0;
379
+ if (!(radix && radix > 10 && radix <= 36 ? new RegExp(`^[+-]?[0-9a-${maxAllowedAlphabeticalCharacter}]+$`, "i") : /^[+-]?\d+$/).test(trimmedString)) throw new DataError(radix ? {
380
+ string,
381
+ radix
382
+ } : { string }, "INTEGER_PARSING_ERROR", `Only numeric values${radix && radix > 10 && radix <= 36 ? ` or character${radix !== 11 ? "s" : ""} A${radix !== 11 ? `-${maxAllowedAlphabeticalCharacter?.toUpperCase()} ` : " "}` : " "}are allowed.`);
383
+ if (radix && radix < 10 && [...trimmedString.replace(/^[+-]/, "")].some((character) => {
384
+ return parseInt(character) >= radix;
385
+ })) throw new DataError({
386
+ string,
387
+ radix
388
+ }, "INTEGER_PARSING_ERROR", "Value contains one or more digits outside of the range of the given radix.");
389
+ const parseIntResult = parseInt(trimmedString, radix);
390
+ if (isNaN(parseIntResult)) throw new DataError({ string }, "INTEGER_PARSING_ERROR", "Value is not a valid integer.");
391
+ return parseIntResult;
392
+ }
393
+ //#endregion
394
+ //#region src/root/functions/parsers/parseVersionType.ts
395
+ /**
396
+ * Represents the three common software version types.
397
+ *
398
+ * @category Types
399
+ */
400
+ const VersionType = {
401
+ MAJOR: "major",
402
+ MINOR: "minor",
403
+ PATCH: "patch"
404
+ };
405
+ //#endregion
406
406
  //#region src/root/functions/taggedTemplate/interpolate.ts
407
407
  /**
408
408
  * Returns the result of interpolating a template string when given the strings and interpolations separately.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alextheman/utility",
3
- "version": "5.23.1",
3
+ "version": "5.23.2",
4
4
  "description": "Helpful utility functions.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -40,26 +40,26 @@
40
40
  "execa": "9.6.1"
41
41
  },
42
42
  "devDependencies": {
43
- "@alextheman/eslint-plugin": "5.17.1",
44
- "@types/node": "25.9.3",
45
- "alex-c-line": "2.10.3",
43
+ "@alextheman/eslint-plugin": "5.18.0",
44
+ "@types/node": "26.1.0",
45
+ "alex-c-line": "2.11.3",
46
46
  "cross-env": "10.1.0",
47
47
  "dotenv-cli": "11.0.0",
48
- "eslint": "10.5.0",
49
- "globals": "17.6.0",
48
+ "eslint": "10.6.0",
49
+ "globals": "17.7.0",
50
50
  "husky": "9.1.7",
51
51
  "jsdom": "29.1.1",
52
- "markdownlint-cli2": "0.22.1",
53
- "prettier": "3.8.4",
52
+ "markdownlint-cli2": "0.23.0",
53
+ "prettier": "3.9.4",
54
54
  "tempy": "3.2.0",
55
55
  "tsdown": "0.22.3",
56
- "tsx": "4.22.4",
56
+ "tsx": "4.23.0",
57
57
  "typedoc": "0.28.19",
58
58
  "typedoc-plugin-markdown": "4.12.0",
59
59
  "typedoc-rhineai-theme": "1.2.0",
60
60
  "typescript": "6.0.3",
61
- "typescript-eslint": "8.61.1",
62
- "vite": "8.0.16",
61
+ "typescript-eslint": "8.62.1",
62
+ "vite": "8.1.3",
63
63
  "vitest": "4.1.9",
64
64
  "zod": "4.4.3"
65
65
  },
@@ -82,7 +82,7 @@
82
82
  "format-prettier-javascript": "prettier --write \"./**/*.js\"",
83
83
  "format-prettier-typescript": "prettier --write --parser typescript \"./**/*.ts\"",
84
84
  "format-prettier-yml": "prettier --write \"./**/*.{yml,yaml}\"",
85
- "lint": "pnpm run lint-tsc && pnpm run lint-eslint && pnpm run lint-markdownlint pnpm run lint-prettier && pnpm run lint-pre-release",
85
+ "lint": "pnpm run lint-tsc && pnpm run lint-eslint && pnpm run lint-markdownlint && pnpm run lint-prettier && pnpm run lint-pre-release",
86
86
  "lint-eslint": "eslint \"package.json\" \"{src,tests,configs}/**/*.ts\"",
87
87
  "lint-markdownlint": "bash -o pipefail -c 'pnpm exec markdownlint-cli2 \"**/*.md\" \"!{node_modules,dist}/**\"| grep -v \"^Finding:\"'",
88
88
  "lint-pre-release": "alex-c-line package-json check --rules no-pre-release-dependencies",