toolbox-x 2.4.4 → 2.4.6

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.
Files changed (38) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/{basics-CUzK7wFN.cjs → basics-BGu9ygZK.cjs} +6 -6
  3. package/dist/{basics-KYRpMQNe.mjs → basics-Bd2mj0uG.mjs} +6 -6
  4. package/dist/{basics-BuHQJCNG.d.mts → basics-D64kohDf.d.mts} +13 -4
  5. package/dist/{basics-CLwtIxap.d.cts → basics-lvlgIf5Y.d.cts} +13 -4
  6. package/dist/{case-BmB2aGyp.d.cts → case-Be3-bSPx.d.cts} +1 -1
  7. package/dist/{case-Ce8HJI8I.d.mts → case-q0o80oIc.d.mts} +1 -1
  8. package/dist/change-case.d.cts +1 -1
  9. package/dist/change-case.d.mts +1 -1
  10. package/dist/dom/index.cjs +2 -2
  11. package/dist/dom/index.d.cts +2 -2
  12. package/dist/dom/index.d.mts +2 -2
  13. package/dist/dom/index.mjs +2 -2
  14. package/dist/{form-D_5I437n.d.mts → form-CDTwFDkB.d.mts} +1 -1
  15. package/dist/{form-DhsFvo_D.d.cts → form-cW0-Ichd.d.cts} +1 -1
  16. package/dist/guards/index.cjs +2 -2
  17. package/dist/guards/index.mjs +2 -2
  18. package/dist/hash/index.cjs +1 -1
  19. package/dist/hash/index.d.cts +1 -1
  20. package/dist/hash/index.d.mts +1 -1
  21. package/dist/hash/index.mjs +1 -1
  22. package/dist/index.cjs +3 -3
  23. package/dist/index.d.cts +4 -4
  24. package/dist/index.d.mts +4 -4
  25. package/dist/index.mjs +3 -3
  26. package/dist/{query-iJflCkq1.cjs → query-Bo-_PC3j.cjs} +1 -1
  27. package/dist/{query-B8VPCIKA.mjs → query-CLkSagHs.mjs} +1 -1
  28. package/dist/{query-BMtRmMSC.d.cts → query-Cih_n7VU.d.cts} +1 -1
  29. package/dist/{query-C-r5ZbO-.d.mts → query-DNJK9kPd.d.mts} +1 -1
  30. package/dist/{string-Ok_IMpHP.d.cts → string-Cm9AMOl_.d.cts} +12 -1
  31. package/dist/{string-edtZyJHf.d.mts → string-D7N_U6y2.d.mts} +12 -1
  32. package/dist/types/form.d.cts +1 -1
  33. package/dist/types/form.d.mts +1 -1
  34. package/dist/types/string.d.cts +2 -2
  35. package/dist/types/string.d.mts +2 -2
  36. package/dist/{utils-BxZGABHS.cjs → utils-BzeK3wO9.cjs} +14 -7
  37. package/dist/{utils-DcRr0A7B.mjs → utils-DnyVgO8p.mjs} +14 -7
  38. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -4,6 +4,14 @@ All notable changes to **toolbox-x** will be documented in this file.
4
4
 
5
5
  > Auto-generated from git history using [changelog-maker](https://github.com/nodejs/changelog-maker).
6
6
 
7
+ ## [v2.4.6](https://github.com/nazmul-nhb/toolbox-x/releases/tag/v2.4.6) — 2026-06-28
8
+
9
+ [Compare changes](https://github.com/nazmul-nhb/toolbox-x/compare/v2.4.4...v2.4.6)
10
+
11
+ * \[[`56043d65ef`](https://github.com/nazmul-nhb/toolbox-x/commit/56043d65ef)] - 🔧 update(string): added new signature for `truncateString` with `TruncateOptions` (Nazmul Hassan)
12
+ * \[[`bde1e98b99`](https://github.com/nazmul-nhb/toolbox-x/commit/bde1e98b99)] - 🔧 update(string): updated `MaskOptions` for `maskString` (Nazmul Hassan)
13
+ * \[[`bdeea053f1`](https://github.com/nazmul-nhb/toolbox-x/commit/bdeea053f1)] - 📚 docs: updated CHANGELOG.md for v2.4.4 (github-actions\[bot])
14
+
7
15
  ## [v2.4.4](https://github.com/nazmul-nhb/toolbox-x/releases/tag/v2.4.4) — 2026-06-28
8
16
 
9
17
  [Compare changes](https://github.com/nazmul-nhb/toolbox-x/compare/v2.4.2...v2.4.4)
@@ -15,8 +15,8 @@
15
15
  */
16
16
 
17
17
  const require_primitives = require('./primitives-CBGICrDR.cjs');
18
- const require_utils = require('./utils-BxZGABHS.cjs');
19
18
  const require_specials = require('./specials-DU8u108m.cjs');
19
+ const require_utils = require('./utils-BzeK3wO9.cjs');
20
20
  const require_utilities = require('./utilities-_COSGq1U.cjs');
21
21
 
22
22
  //#region src/string/convert.ts
@@ -34,7 +34,7 @@ const require_utilities = require('./utilities-_COSGq1U.cjs');
34
34
  */
35
35
  const replaceAllInString = (input, find, replace) => {
36
36
  const trimmedString = require_utils.trimString(input);
37
- const regex = require_primitives.isString(find) ? new RegExp(find, "g") : new RegExp(find, find?.flags.includes("g") ? find?.flags : find?.flags + "g");
37
+ const regex = require_primitives.isString(find) ? new RegExp(find, "g") : new RegExp(find, find?.flags.includes("g") ? find?.flags : `${find?.flags}g`);
38
38
  return trimmedString?.replace(regex, replace);
39
39
  };
40
40
  /**
@@ -52,10 +52,10 @@ const slugifyString = (input) => {
52
52
  * @returns The masked string.
53
53
  */
54
54
  const maskString = (input, options) => {
55
- const { start = 1, end = 1, maskCharacter: maskChar = "*" } = options || {};
56
- const trimmedString = require_utils.trimString(input);
57
- if (trimmedString?.length <= start + end) return maskChar?.repeat(trimmedString?.length);
58
- return trimmedString.slice(0, start) + maskChar?.repeat(trimmedString?.length - start - end) + (end > 0 ? trimmedString.slice(-end) : "");
55
+ const { start = 1, end = 1, trim = false, maskCharacter = "*" } = options || {};
56
+ const trimmedString = trim ? require_utils.trimString(input) : input;
57
+ if (trimmedString?.length <= start + end) return maskCharacter?.repeat(trimmedString?.length);
58
+ return trimmedString.slice(0, start) + maskCharacter?.repeat(trimmedString?.length - start - end) + (end > 0 ? trimmedString.slice(-end) : "");
59
59
  };
60
60
  /**
61
61
  * * Reverses a given string.
@@ -15,8 +15,8 @@
15
15
  */
16
16
 
17
17
  import { d as isString, m as isUndefined } from "./primitives-Djsevc69.mjs";
18
- import { $ as trimString, m as stableStringify } from "./utils-DcRr0A7B.mjs";
19
18
  import { b as isFunction, w as isNotEmptyObject } from "./specials-krf7zsqI.mjs";
19
+ import { $ as trimString, m as stableStringify } from "./utils-DnyVgO8p.mjs";
20
20
  import { a as normalizeNumber } from "./utilities-CmPwOkdy.mjs";
21
21
 
22
22
  //#region src/string/convert.ts
@@ -34,7 +34,7 @@ import { a as normalizeNumber } from "./utilities-CmPwOkdy.mjs";
34
34
  */
35
35
  const replaceAllInString = (input, find, replace) => {
36
36
  const trimmedString = trimString(input);
37
- const regex = isString(find) ? new RegExp(find, "g") : new RegExp(find, find?.flags.includes("g") ? find?.flags : find?.flags + "g");
37
+ const regex = isString(find) ? new RegExp(find, "g") : new RegExp(find, find?.flags.includes("g") ? find?.flags : `${find?.flags}g`);
38
38
  return trimmedString?.replace(regex, replace);
39
39
  };
40
40
  /**
@@ -52,10 +52,10 @@ const slugifyString = (input) => {
52
52
  * @returns The masked string.
53
53
  */
54
54
  const maskString = (input, options) => {
55
- const { start = 1, end = 1, maskCharacter: maskChar = "*" } = options || {};
56
- const trimmedString = trimString(input);
57
- if (trimmedString?.length <= start + end) return maskChar?.repeat(trimmedString?.length);
58
- return trimmedString.slice(0, start) + maskChar?.repeat(trimmedString?.length - start - end) + (end > 0 ? trimmedString.slice(-end) : "");
55
+ const { start = 1, end = 1, trim = false, maskCharacter = "*" } = options || {};
56
+ const trimmedString = trim ? trimString(input) : input;
57
+ if (trimmedString?.length <= start + end) return maskCharacter?.repeat(trimmedString?.length);
58
+ return trimmedString.slice(0, start) + maskCharacter?.repeat(trimmedString?.length - start - end) + (end > 0 ? trimmedString.slice(-end) : "");
59
59
  };
60
60
  /**
61
61
  * * Reverses a given string.
@@ -14,17 +14,25 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
- import { z as RandomIdOptions } from "./string-edtZyJHf.mjs";
17
+ import { J as TruncateOptions, z as RandomIdOptions } from "./string-D7N_U6y2.mjs";
18
18
 
19
19
  //#region src/string/basics.d.ts
20
20
  /**
21
21
  * * Utility to truncate a string to a specified length.
22
22
  *
23
23
  * @param str The string to truncate.
24
- * @param maxLength The maximum length of the truncated string.
25
- * @returns Truncated string with ellipsis (`...`) (only if it has more length than `maxLength`).
24
+ * @param maxLength The maximum length of the truncated string. Defaults to `100`.
25
+ * @returns Truncated string with ellipsis (`'...'`) (only if it has more length than `maxLength`).
26
26
  */
27
- declare function truncateString(str: string, maxLength: number): string;
27
+ declare function truncateString(str: string, maxLength?: number): string;
28
+ /**
29
+ * * Utility to truncate a string to a specified length using options.
30
+ *
31
+ * @param str The string to truncate.
32
+ * @param options Options for truncating the string.
33
+ * @returns Truncated string based on the {@link options}.
34
+ */
35
+ declare function truncateString(str: string, options?: TruncateOptions): string;
28
36
  /**
29
37
  * * Generates a random alphanumeric (16 characters long, this length is customizable in the options) ID string composed of an optional `prefix`, `suffix`, a `timestamp`, `caseOption` and a customizable `separator`.
30
38
  *
@@ -32,6 +40,7 @@ declare function truncateString(str: string, maxLength: number): string;
32
40
  * @returns The generated ID string composed of the random alphanumeric string of specified length with optional `timeStamp`, `prefix`, and `suffix`, `caseOption` and `separator`.
33
41
  *
34
42
  * @see {@link https://toolbox-x.nazmul-nhb.dev/docs/utils/hash/uuid uuid} for `uuid` generation
43
+ * @see {@link https://toolbox-x.nazmul-nhb.dev/docs/utils/hash/random-numeric randomHex} for random numeric string generation
35
44
  * @see {@link https://toolbox-x.nazmul-nhb.dev/docs/utils/hash/random-hex randomHex} for random hexadecimal string generation
36
45
  *
37
46
  * @example
@@ -14,17 +14,25 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
- import { z as RandomIdOptions } from "./string-Ok_IMpHP.cjs";
17
+ import { J as TruncateOptions, z as RandomIdOptions } from "./string-Cm9AMOl_.cjs";
18
18
 
19
19
  //#region src/string/basics.d.ts
20
20
  /**
21
21
  * * Utility to truncate a string to a specified length.
22
22
  *
23
23
  * @param str The string to truncate.
24
- * @param maxLength The maximum length of the truncated string.
25
- * @returns Truncated string with ellipsis (`...`) (only if it has more length than `maxLength`).
24
+ * @param maxLength The maximum length of the truncated string. Defaults to `100`.
25
+ * @returns Truncated string with ellipsis (`'...'`) (only if it has more length than `maxLength`).
26
26
  */
27
- declare function truncateString(str: string, maxLength: number): string;
27
+ declare function truncateString(str: string, maxLength?: number): string;
28
+ /**
29
+ * * Utility to truncate a string to a specified length using options.
30
+ *
31
+ * @param str The string to truncate.
32
+ * @param options Options for truncating the string.
33
+ * @returns Truncated string based on the {@link options}.
34
+ */
35
+ declare function truncateString(str: string, options?: TruncateOptions): string;
28
36
  /**
29
37
  * * Generates a random alphanumeric (16 characters long, this length is customizable in the options) ID string composed of an optional `prefix`, `suffix`, a `timestamp`, `caseOption` and a customizable `separator`.
30
38
  *
@@ -32,6 +40,7 @@ declare function truncateString(str: string, maxLength: number): string;
32
40
  * @returns The generated ID string composed of the random alphanumeric string of specified length with optional `timeStamp`, `prefix`, and `suffix`, `caseOption` and `separator`.
33
41
  *
34
42
  * @see {@link https://toolbox-x.nazmul-nhb.dev/docs/utils/hash/uuid uuid} for `uuid` generation
43
+ * @see {@link https://toolbox-x.nazmul-nhb.dev/docs/utils/hash/random-numeric randomHex} for random numeric string generation
35
44
  * @see {@link https://toolbox-x.nazmul-nhb.dev/docs/utils/hash/random-hex randomHex} for random hexadecimal string generation
36
45
  *
37
46
  * @example
@@ -14,7 +14,7 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
- import { F as PascalCase, G as TitleCase, H as SnakeCase, I as PascalSnakeCase, K as TrainCase, L as PathCase, N as KebabCase, V as SentenceCase, W as StringCaseOptions, g as CaseFormat, h as CapitalizeOptions, k as DotCase, m as CamelCase, u as $WidenEmpty, v as ConstantCase } from "./string-Ok_IMpHP.cjs";
17
+ import { F as PascalCase, G as TitleCase, H as SnakeCase, I as PascalSnakeCase, K as TrainCase, L as PathCase, N as KebabCase, V as SentenceCase, W as StringCaseOptions, g as CaseFormat, h as CapitalizeOptions, k as DotCase, m as CamelCase, u as $WidenEmpty, v as ConstantCase } from "./string-Cm9AMOl_.cjs";
18
18
 
19
19
  //#region src/string/case.d.ts
20
20
  /**
@@ -14,7 +14,7 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
- import { F as PascalCase, G as TitleCase, H as SnakeCase, I as PascalSnakeCase, K as TrainCase, L as PathCase, N as KebabCase, V as SentenceCase, W as StringCaseOptions, g as CaseFormat, h as CapitalizeOptions, k as DotCase, m as CamelCase, u as $WidenEmpty, v as ConstantCase } from "./string-edtZyJHf.mjs";
17
+ import { F as PascalCase, G as TitleCase, H as SnakeCase, I as PascalSnakeCase, K as TrainCase, L as PathCase, N as KebabCase, V as SentenceCase, W as StringCaseOptions, g as CaseFormat, h as CapitalizeOptions, k as DotCase, m as CamelCase, u as $WidenEmpty, v as ConstantCase } from "./string-D7N_U6y2.mjs";
18
18
 
19
19
  //#region src/string/case.d.ts
20
20
  /**
@@ -14,5 +14,5 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
- import { a as toDotCase, c as toPascalSnakeCase, d as toSnakeCase, f as toTitleCase, i as toConstantCase, l as toPathCase, n as convertStringCase, o as toKebabCase, p as toTrainCase, r as toCamelCase, s as toPascalCase, t as capitalizeString, u as toSentenceCase } from "./case-BmB2aGyp.cjs";
17
+ import { a as toDotCase, c as toPascalSnakeCase, d as toSnakeCase, f as toTitleCase, i as toConstantCase, l as toPathCase, n as convertStringCase, o as toKebabCase, p as toTrainCase, r as toCamelCase, s as toPascalCase, t as capitalizeString, u as toSentenceCase } from "./case-Be3-bSPx.cjs";
18
18
  export { capitalizeString, convertStringCase, toCamelCase, toConstantCase, toDotCase, toKebabCase, toPascalCase, toPascalSnakeCase, toPathCase, toSentenceCase, toSnakeCase, toTitleCase, toTrainCase };
@@ -14,5 +14,5 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
- import { a as toDotCase, c as toPascalSnakeCase, d as toSnakeCase, f as toTitleCase, i as toConstantCase, l as toPathCase, n as convertStringCase, o as toKebabCase, p as toTrainCase, r as toCamelCase, s as toPascalCase, t as capitalizeString, u as toSentenceCase } from "./case-Ce8HJI8I.mjs";
17
+ import { a as toDotCase, c as toPascalSnakeCase, d as toSnakeCase, f as toTitleCase, i as toConstantCase, l as toPathCase, n as convertStringCase, o as toKebabCase, p as toTrainCase, r as toCamelCase, s as toPascalCase, t as capitalizeString, u as toSentenceCase } from "./case-q0o80oIc.mjs";
18
18
  export { capitalizeString, convertStringCase, toCamelCase, toConstantCase, toDotCase, toKebabCase, toPascalCase, toPascalSnakeCase, toPathCase, toSentenceCase, toSnakeCase, toTitleCase, toTrainCase };
@@ -16,10 +16,10 @@
16
16
 
17
17
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
18
18
  const require_primitives = require('../primitives-CBGICrDR.cjs');
19
- const require_utils = require('../utils-BxZGABHS.cjs');
20
19
  const require_specials = require('../specials-DU8u108m.cjs');
20
+ const require_utils = require('../utils-BzeK3wO9.cjs');
21
21
  const require_guards = require('../guards-DalSfIxV.cjs');
22
- const require_query = require('../query-iJflCkq1.cjs');
22
+ const require_query = require('../query-Bo-_PC3j.cjs');
23
23
 
24
24
  //#region src/dom/storage.ts
25
25
  /**
@@ -15,8 +15,8 @@
15
15
  */
16
16
 
17
17
  import { J as Deserializer, ft as Serializer, y as GenericObject } from "../object-DyVg8BFt.cjs";
18
- import { a as updateQueryParam, i as parseQueryStringLiteral, n as getQueryParams, r as parseQueryString, t as generateQueryParams } from "../query-BMtRmMSC.cjs";
19
- import { a as OriginFileObj, i as FormDataConfigs, o as ParsedFormData, r as FileUpload, s as SerializedForm, t as CustomFile } from "../form-DhsFvo_D.cjs";
18
+ import { a as updateQueryParam, i as parseQueryStringLiteral, n as getQueryParams, r as parseQueryString, t as generateQueryParams } from "../query-Cih_n7VU.cjs";
19
+ import { a as OriginFileObj, i as FormDataConfigs, o as ParsedFormData, r as FileUpload, s as SerializedForm, t as CustomFile } from "../form-cW0-Ichd.cjs";
20
20
 
21
21
  //#region src/dom/storage.d.ts
22
22
  /**
@@ -15,8 +15,8 @@
15
15
  */
16
16
 
17
17
  import { J as Deserializer, ft as Serializer, y as GenericObject } from "../object-DyVg8BFt.mjs";
18
- import { a as updateQueryParam, i as parseQueryStringLiteral, n as getQueryParams, r as parseQueryString, t as generateQueryParams } from "../query-C-r5ZbO-.mjs";
19
- import { a as OriginFileObj, i as FormDataConfigs, o as ParsedFormData, r as FileUpload, s as SerializedForm, t as CustomFile } from "../form-D_5I437n.mjs";
18
+ import { a as updateQueryParam, i as parseQueryStringLiteral, n as getQueryParams, r as parseQueryString, t as generateQueryParams } from "../query-DNJK9kPd.mjs";
19
+ import { a as OriginFileObj, i as FormDataConfigs, o as ParsedFormData, r as FileUpload, s as SerializedForm, t as CustomFile } from "../form-CDTwFDkB.mjs";
20
20
 
21
21
  //#region src/dom/storage.d.ts
22
22
  /**
@@ -15,10 +15,10 @@
15
15
  */
16
16
 
17
17
  import { a as isNonEmptyString, d as isString } from "../primitives-Djsevc69.mjs";
18
- import { $ as trimString } from "../utils-DcRr0A7B.mjs";
19
18
  import { j as isValidArray, v as isEmptyObject, w as isNotEmptyObject } from "../specials-krf7zsqI.mjs";
19
+ import { $ as trimString } from "../utils-DnyVgO8p.mjs";
20
20
  import { t as isDateLike } from "../guards-CyOZsZ1r.mjs";
21
- import { C as isValidFormData, S as isOriginFileObj, _ as isCustomFileArray, a as updateQueryParam, b as isFileOrBlob, g as isCustomFile, i as parseQueryStringLiteral, m as parseObjectValues, n as getQueryParams, r as parseQueryString, t as generateQueryParams, v as isFileArray, x as isFileUpload, y as isFileList } from "../query-B8VPCIKA.mjs";
21
+ import { C as isValidFormData, S as isOriginFileObj, _ as isCustomFileArray, a as updateQueryParam, b as isFileOrBlob, g as isCustomFile, i as parseQueryStringLiteral, m as parseObjectValues, n as getQueryParams, r as parseQueryString, t as generateQueryParams, v as isFileArray, x as isFileUpload, y as isFileList } from "../query-CLkSagHs.mjs";
22
22
 
23
23
  //#region src/dom/storage.ts
24
24
  /**
@@ -15,7 +15,7 @@
15
15
  */
16
16
 
17
17
  import { S as KeyForObject, T as NestedKeyString, ai as RequireExactly, at as NormalPrimitive, u as DotNotationKey, x as KeyForArray } from "./object-DyVg8BFt.mjs";
18
- import { R as QueryString } from "./string-edtZyJHf.mjs";
18
+ import { R as QueryString } from "./string-D7N_U6y2.mjs";
19
19
  import { f as TypeOrArray } from "./array-CbAKXvhH.mjs";
20
20
 
21
21
  //#region src/types/form.d.ts
@@ -15,7 +15,7 @@
15
15
  */
16
16
 
17
17
  import { S as KeyForObject, T as NestedKeyString, ai as RequireExactly, at as NormalPrimitive, u as DotNotationKey, x as KeyForArray } from "./object-DyVg8BFt.cjs";
18
- import { R as QueryString } from "./string-Ok_IMpHP.cjs";
18
+ import { R as QueryString } from "./string-Cm9AMOl_.cjs";
19
19
  import { f as TypeOrArray } from "./array-EVkwcL_k.cjs";
20
20
 
21
21
  //#region src/types/form.d.ts
@@ -16,9 +16,9 @@
16
16
 
17
17
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
18
18
  const require_primitives = require('../primitives-CBGICrDR.cjs');
19
- const require_utils = require('../utils-BxZGABHS.cjs');
20
19
  const require_specials = require('../specials-DU8u108m.cjs');
21
- const require_basics = require('../basics-CUzK7wFN.cjs');
20
+ const require_utils = require('../utils-BzeK3wO9.cjs');
21
+ const require_basics = require('../basics-BGu9ygZK.cjs');
22
22
  const require_guards = require('../guards-CrfVwk0-.cjs');
23
23
  const require_guards$1 = require('../guards-DalSfIxV.cjs');
24
24
 
@@ -15,9 +15,9 @@
15
15
  */
16
16
 
17
17
  import { a as isNonEmptyString, c as isNumber, d as isString, f as isSymbol, i as isInteger, l as isPositiveInteger, m as isUndefined, n as isBoolean, o as isNormalPrimitive, p as isTruthy, r as isFalsy, s as isNull, t as isBigInt, u as isPrimitive } from "../primitives-Djsevc69.mjs";
18
- import { C as isUUIDv2, D as isUUIDv6, E as isUUIDv5, O as isUUIDv7, S as isUUIDv1, T as isUUIDv4, f as isDeepEqual, k as isUUIDv8, w as isUUIDv3 } from "../utils-DcRr0A7B.mjs";
19
18
  import { A as isSet, C as isMethodDescriptor, D as isPromise, E as isObjectWithKeys, O as isRegExp, S as isMap, T as isObject, _ as isDate, a as isEmail, b as isFunction, c as isHexString, d as isNumericString, f as isPhoneNumber, g as isArrayOfType, h as isArray, i as isDateString, j as isValidArray, k as isReturningPromise, l as isIPAddress, m as isUUID, n as isBinaryString, o as isEmailArray, p as isURL, r as isBrowser, s as isEnvironment, t as isBase64, u as isNode, v as isEmptyObject, w as isNotEmptyObject, x as isJSON, y as isError } from "../specials-krf7zsqI.mjs";
20
- import { C as isOdd, S as isMultiple, b as isEven, d as isCamelCase, f as isEmojiOnly, g as isSnakeCase, h as isPascalCase, i as isInvalidOrEmptyArray, m as isPalindrome, p as isKebabCase, v as isPrime, w as isPerfectSquare, x as isFibonacci, y as areInvalidNumbers } from "../basics-KYRpMQNe.mjs";
19
+ import { C as isUUIDv2, D as isUUIDv6, E as isUUIDv5, O as isUUIDv7, S as isUUIDv1, T as isUUIDv4, f as isDeepEqual, k as isUUIDv8, w as isUUIDv3 } from "../utils-DnyVgO8p.mjs";
20
+ import { C as isOdd, S as isMultiple, b as isEven, d as isCamelCase, f as isEmojiOnly, g as isSnakeCase, h as isPascalCase, i as isInvalidOrEmptyArray, m as isPalindrome, p as isKebabCase, v as isPrime, w as isPerfectSquare, x as isFibonacci, y as areInvalidNumbers } from "../basics-Bd2mj0uG.mjs";
21
21
  import { a as isHex8, i as isHex6, n as isHSL, o as isRGB, r as isHSLA, s as isRGBA, t as isCSSColor } from "../guards-CNG9gnvL.mjs";
22
22
  import { a as isValidTime, i as isTimeWithUnit, n as isLeapYear, o as isValidTimeZoneId, r as isNativeTimeZoneId, s as isValidUTCOffset, t as isDateLike } from "../guards-CyOZsZ1r.mjs";
23
23
 
@@ -16,8 +16,8 @@
16
16
 
17
17
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
18
18
  const require_primitives = require('../primitives-CBGICrDR.cjs');
19
- const require_utils = require('../utils-BxZGABHS.cjs');
20
19
  const require_specials = require('../specials-DU8u108m.cjs');
20
+ const require_utils = require('../utils-BzeK3wO9.cjs');
21
21
  const require_parse = require('../parse-Dz186-PH.cjs');
22
22
 
23
23
  //#region src/hash/Cipher.ts
@@ -17,7 +17,7 @@
17
17
  import { nt as Maybe, y as GenericObject } from "../object-DyVg8BFt.cjs";
18
18
  import { _ as VerifiedToken, d as SignetPayload, l as SignOptions, p as TokenString, s as DecodedToken, v as VerifyOptions } from "../hash-DHawpylk.cjs";
19
19
  import { a as isUUIDv4, c as isUUIDv7, i as isUUIDv3, l as isUUIDv8, n as isUUIDv1, o as isUUIDv5, r as isUUIDv2, s as isUUIDv6, t as decodeUUID, u as uuid, w as isUUID } from "../uuid-CMNRM9NO.cjs";
20
- import { t as generateRandomID } from "../basics-CLwtIxap.cjs";
20
+ import { t as generateRandomID } from "../basics-lvlgIf5Y.cjs";
21
21
 
22
22
  //#region src/hash/Cipher.d.ts
23
23
  /**
@@ -17,7 +17,7 @@
17
17
  import { nt as Maybe, y as GenericObject } from "../object-DyVg8BFt.mjs";
18
18
  import { _ as VerifiedToken, d as SignetPayload, l as SignOptions, p as TokenString, s as DecodedToken, v as VerifyOptions } from "../hash-2mygGWLk.mjs";
19
19
  import { a as isUUIDv4, c as isUUIDv7, i as isUUIDv3, l as isUUIDv8, n as isUUIDv1, o as isUUIDv5, r as isUUIDv2, s as isUUIDv6, t as decodeUUID, u as uuid, w as isUUID } from "../uuid-DvQsIl9p.mjs";
20
- import { t as generateRandomID } from "../basics-BuHQJCNG.mjs";
20
+ import { t as generateRandomID } from "../basics-D64kohDf.mjs";
21
21
 
22
22
  //#region src/hash/Cipher.d.ts
23
23
  /**
@@ -15,8 +15,8 @@
15
15
  */
16
16
 
17
17
  import { a as isNonEmptyString } from "../primitives-Djsevc69.mjs";
18
- import { A as uuid, B as bytesToUtf8, C as isUUIDv2, D as isUUIDv6, E as isUUIDv5, F as _padStartWith0, G as randomAlphaNumeric, H as hexToBytes, I as _splitByCharLength, J as randomNumeric, K as randomBytes, L as base64ToBytes, M as sha1, N as sha256, O as isUUIDv7, P as _constantTimeEquals, Q as generateRandomID, R as bytesToBase64, S as isUUIDv1, T as isUUIDv4, U as hmacSha256, V as concatBytes, W as intTo4BytesBE, X as uint8To32ArrayBE, Y as sha256Bytes, Z as utf8ToBytes, h as stripJsonEdgeGarbage, j as md5, k as isUUIDv8, m as stableStringify, q as randomHex, w as isUUIDv3, x as decodeUUID, z as bytesToHex } from "../utils-DcRr0A7B.mjs";
19
18
  import { c as isHexString, m as isUUID, n as isBinaryString, t as isBase64, w as isNotEmptyObject } from "../specials-krf7zsqI.mjs";
19
+ import { A as uuid, B as bytesToUtf8, C as isUUIDv2, D as isUUIDv6, E as isUUIDv5, F as _padStartWith0, G as randomAlphaNumeric, H as hexToBytes, I as _splitByCharLength, J as randomNumeric, K as randomBytes, L as base64ToBytes, M as sha1, N as sha256, O as isUUIDv7, P as _constantTimeEquals, Q as generateRandomID, R as bytesToBase64, S as isUUIDv1, T as isUUIDv4, U as hmacSha256, V as concatBytes, W as intTo4BytesBE, X as uint8To32ArrayBE, Y as sha256Bytes, Z as utf8ToBytes, h as stripJsonEdgeGarbage, j as md5, k as isUUIDv8, m as stableStringify, q as randomHex, w as isUUIDv3, x as decodeUUID, z as bytesToHex } from "../utils-DnyVgO8p.mjs";
20
20
  import { c as _toSeconds, s as _secToDate, t as parseMSec } from "../parse-CsTFudDu.mjs";
21
21
 
22
22
  //#region src/hash/Cipher.ts
package/dist/index.cjs CHANGED
@@ -19,11 +19,11 @@ const require_primitives = require('./primitives-CBGICrDR.cjs');
19
19
  const require_case = require('./case-Bd7QLHYw.cjs');
20
20
  const require_constants = require('./constants-B3nc8psr.cjs');
21
21
  const require_countries = require('./countries-C0x58zVg.cjs');
22
- const require_utils = require('./utils-BxZGABHS.cjs');
23
22
  const require_specials = require('./specials-DU8u108m.cjs');
24
- const require_basics = require('./basics-CUzK7wFN.cjs');
23
+ const require_utils = require('./utils-BzeK3wO9.cjs');
24
+ const require_basics = require('./basics-BGu9ygZK.cjs');
25
25
  const require_utilities = require('./utilities-_COSGq1U.cjs');
26
- const require_query = require('./query-iJflCkq1.cjs');
26
+ const require_query = require('./query-Bo-_PC3j.cjs');
27
27
 
28
28
  //#region src/string/anagram.ts
29
29
  /** `WeakMap` to cache user provided dictionary array */
package/dist/index.d.cts CHANGED
@@ -15,12 +15,12 @@
15
15
  */
16
16
 
17
17
  import { $n as NumberType, Bn as DecimalOptions, D as NumericDotKey, E as NestedPrimitiveKey, F as SanitizeOptions, I as SanitizedData, In as BnDigitResult, Ln as ConvertOptions, O as ObjectEntry, Q as FlattenPartial, Rn as ConvertedDecimal, Un as FrankFurterCurrency, V as BasicPrimitive, Xn as LocaleCode, Zn as LooseRomanNumeral, a as ConvertObjectOptions, ar as RomanCapital, c as DeepKeys, ci as Tuple, ct as Numeric, g as FlattenDotValue, ir as RangedNumbers, k as Objects, lt as OwnKeys, nr as RandomNumberOptions, nt as Maybe, o as ConvertedObject, p as ExpandAll, pi as Unit, rr as RangeOptions, s as CountryDetails, tr as PercentageOptions, u as DotNotationKey, ut as PartialOrRequired, v as FlattenLeafValue, w as MergeAll, y as GenericObject, z as Any, zn as CurrencyCode } from "./object-DyVg8BFt.cjs";
18
- import { D as DiffResult, P as MaskOptions, _ as CharDiffResult, p as AnagramOptions } from "./string-Ok_IMpHP.cjs";
19
- import { n as convertStringCase, t as capitalizeString } from "./case-BmB2aGyp.cjs";
20
- import { i as parseQueryStringLiteral, r as parseQueryString, t as generateQueryParams } from "./query-BMtRmMSC.cjs";
18
+ import { D as DiffResult, P as MaskOptions, _ as CharDiffResult, p as AnagramOptions } from "./string-Cm9AMOl_.cjs";
19
+ import { n as convertStringCase, t as capitalizeString } from "./case-Be3-bSPx.cjs";
20
+ import { i as parseQueryStringLiteral, r as parseQueryString, t as generateQueryParams } from "./query-Cih_n7VU.cjs";
21
21
  import { c as OrderOption, l as SortByOption, n as FindOptions, s as OptionsConfig, t as FieldValue, u as SortNature } from "./array-EVkwcL_k.cjs";
22
22
  import { C as shuffleArray, S as isInvalidOrEmptyArray, _ as findPrimeNumbers, a as deepParsePrimitives, b as flattenArray, c as getInstanceGetterNames, d as getStaticMethodNames, f as isDeepEqual, g as throttleAction, h as stripJsonEdgeGarbage, i as debounceAction, l as getInstanceMethodNames, m as stableStringify, n as countInstanceMethods, o as definePrototypeMethod, p as parseJSON, r as countStaticMethods, s as getClassDetails, t as convertArrayToString, u as getStaticGetterNames, v as isPrime, x as getLastArrayElement, y as filterArrayOfObjects } from "./index-D00Uqm9S.cjs";
23
- import { n as trimString, r as truncateString, t as generateRandomID } from "./basics-CLwtIxap.cjs";
23
+ import { n as trimString, r as truncateString, t as generateRandomID } from "./basics-lvlgIf5Y.cjs";
24
24
 
25
25
  //#region src/string/anagram.d.ts
26
26
  /**
package/dist/index.d.mts CHANGED
@@ -15,12 +15,12 @@
15
15
  */
16
16
 
17
17
  import { $n as NumberType, Bn as DecimalOptions, D as NumericDotKey, E as NestedPrimitiveKey, F as SanitizeOptions, I as SanitizedData, In as BnDigitResult, Ln as ConvertOptions, O as ObjectEntry, Q as FlattenPartial, Rn as ConvertedDecimal, Un as FrankFurterCurrency, V as BasicPrimitive, Xn as LocaleCode, Zn as LooseRomanNumeral, a as ConvertObjectOptions, ar as RomanCapital, c as DeepKeys, ci as Tuple, ct as Numeric, g as FlattenDotValue, ir as RangedNumbers, k as Objects, lt as OwnKeys, nr as RandomNumberOptions, nt as Maybe, o as ConvertedObject, p as ExpandAll, pi as Unit, rr as RangeOptions, s as CountryDetails, tr as PercentageOptions, u as DotNotationKey, ut as PartialOrRequired, v as FlattenLeafValue, w as MergeAll, y as GenericObject, z as Any, zn as CurrencyCode } from "./object-DyVg8BFt.mjs";
18
- import { D as DiffResult, P as MaskOptions, _ as CharDiffResult, p as AnagramOptions } from "./string-edtZyJHf.mjs";
19
- import { n as convertStringCase, t as capitalizeString } from "./case-Ce8HJI8I.mjs";
20
- import { i as parseQueryStringLiteral, r as parseQueryString, t as generateQueryParams } from "./query-C-r5ZbO-.mjs";
18
+ import { D as DiffResult, P as MaskOptions, _ as CharDiffResult, p as AnagramOptions } from "./string-D7N_U6y2.mjs";
19
+ import { n as convertStringCase, t as capitalizeString } from "./case-q0o80oIc.mjs";
20
+ import { i as parseQueryStringLiteral, r as parseQueryString, t as generateQueryParams } from "./query-DNJK9kPd.mjs";
21
21
  import { c as OrderOption, l as SortByOption, n as FindOptions, s as OptionsConfig, t as FieldValue, u as SortNature } from "./array-CbAKXvhH.mjs";
22
22
  import { C as shuffleArray, S as isInvalidOrEmptyArray, _ as findPrimeNumbers, a as deepParsePrimitives, b as flattenArray, c as getInstanceGetterNames, d as getStaticMethodNames, f as isDeepEqual, g as throttleAction, h as stripJsonEdgeGarbage, i as debounceAction, l as getInstanceMethodNames, m as stableStringify, n as countInstanceMethods, o as definePrototypeMethod, p as parseJSON, r as countStaticMethods, s as getClassDetails, t as convertArrayToString, u as getStaticGetterNames, v as isPrime, x as getLastArrayElement, y as filterArrayOfObjects } from "./index-BbBnKdBb.mjs";
23
- import { n as trimString, r as truncateString, t as generateRandomID } from "./basics-BuHQJCNG.mjs";
23
+ import { n as trimString, r as truncateString, t as generateRandomID } from "./basics-D64kohDf.mjs";
24
24
 
25
25
  //#region src/string/anagram.d.ts
26
26
  /**
package/dist/index.mjs CHANGED
@@ -18,11 +18,11 @@ import { a as isNonEmptyString, c as isNumber, d as isString, i as isInteger, m
18
18
  import { n as convertStringCase, t as capitalizeString } from "./case-DBC4Rj0h.mjs";
19
19
  import { c as ORDINAL_UNDER_TEEN, d as TENS, f as THOUSANDS, l as PREFIX_MULTIPLIERS, o as ONES, s as ORDINAL_TO_CARDINAL, t as BN_DIGITS, u as TEENS } from "./constants-ZyfpysiQ.mjs";
20
20
  import { t as COUNTRIES } from "./countries-CMxHxKiK.mjs";
21
- import { $ as trimString, Q as generateRandomID, _ as naturalSort, a as deepParsePrimitives, b as _resolveNestedKey, c as getInstanceGetterNames, d as getStaticMethodNames, et as truncateString, f as isDeepEqual, g as throttleAction, h as stripJsonEdgeGarbage, i as debounceAction, l as getInstanceMethodNames, m as stableStringify, n as countInstanceMethods, o as definePrototypeMethod, p as parseJSON, r as countStaticMethods, s as getClassDetails, t as convertArrayToString, u as getStaticGetterNames, v as sortAnArray, y as _getNumericProp } from "./utils-DcRr0A7B.mjs";
22
21
  import { T as isObject, b as isFunction, d as isNumericString, j as isValidArray } from "./specials-krf7zsqI.mjs";
23
- import { A as replaceAllInString, C as isOdd, D as formatUnitWithPlural, E as extractURLs, M as slugifyString, O as maskString, T as extractEmails, _ as findPrimeNumbers, a as shuffleArray, b as isEven, c as extractObjectEntries, i as isInvalidOrEmptyArray, j as reverseString, k as normalizeString, l as extractObjectKeys, n as flattenArray, o as cloneObject, r as getLastArrayElement, s as countObjectFields, t as filterArrayOfObjects, u as extractObjectKeysDeep, v as isPrime, y as areInvalidNumbers } from "./basics-KYRpMQNe.mjs";
22
+ import { $ as trimString, Q as generateRandomID, _ as naturalSort, a as deepParsePrimitives, b as _resolveNestedKey, c as getInstanceGetterNames, d as getStaticMethodNames, et as truncateString, f as isDeepEqual, g as throttleAction, h as stripJsonEdgeGarbage, i as debounceAction, l as getInstanceMethodNames, m as stableStringify, n as countInstanceMethods, o as definePrototypeMethod, p as parseJSON, r as countStaticMethods, s as getClassDetails, t as convertArrayToString, u as getStaticGetterNames, v as sortAnArray, y as _getNumericProp } from "./utils-DnyVgO8p.mjs";
23
+ import { A as replaceAllInString, C as isOdd, D as formatUnitWithPlural, E as extractURLs, M as slugifyString, O as maskString, T as extractEmails, _ as findPrimeNumbers, a as shuffleArray, b as isEven, c as extractObjectEntries, i as isInvalidOrEmptyArray, j as reverseString, k as normalizeString, l as extractObjectKeys, n as flattenArray, o as cloneObject, r as getLastArrayElement, s as countObjectFields, t as filterArrayOfObjects, u as extractObjectKeysDeep, v as isPrime, y as areInvalidNumbers } from "./basics-Bd2mj0uG.mjs";
24
24
  import { a as normalizeNumber, i as getRandomFloat, n as formatCurrency, o as roundToNearest, r as getOrdinal, t as clampNumber } from "./utilities-CmPwOkdy.mjs";
25
- import { c as extractUpdatedFields, d as mergeAndFlattenObjects, f as mergeObjects, h as sanitizeData, i as parseQueryStringLiteral, l as flattenObjectDotNotation, m as parseObjectValues, o as extractNewFields, p as parseJsonToObject, r as parseQueryString, s as extractUpdatedAndNewFields, t as generateQueryParams, u as flattenObjectKeyValue } from "./query-B8VPCIKA.mjs";
25
+ import { c as extractUpdatedFields, d as mergeAndFlattenObjects, f as mergeObjects, h as sanitizeData, i as parseQueryStringLiteral, l as flattenObjectDotNotation, m as parseObjectValues, o as extractNewFields, p as parseJsonToObject, r as parseQueryString, s as extractUpdatedAndNewFields, t as generateQueryParams, u as flattenObjectKeyValue } from "./query-CLkSagHs.mjs";
26
26
 
27
27
  //#region src/string/anagram.ts
28
28
  /** `WeakMap` to cache user provided dictionary array */
@@ -15,8 +15,8 @@
15
15
  */
16
16
 
17
17
  const require_primitives = require('./primitives-CBGICrDR.cjs');
18
- const require_utils = require('./utils-BxZGABHS.cjs');
19
18
  const require_specials = require('./specials-DU8u108m.cjs');
19
+ const require_utils = require('./utils-BzeK3wO9.cjs');
20
20
  const require_guards = require('./guards-DalSfIxV.cjs');
21
21
 
22
22
  //#region src/form/guards.ts
@@ -15,8 +15,8 @@
15
15
  */
16
16
 
17
17
  import { d as isString } from "./primitives-Djsevc69.mjs";
18
- import { $ as trimString, a as deepParsePrimitives, f as isDeepEqual } from "./utils-DcRr0A7B.mjs";
19
18
  import { E as isObjectWithKeys, T as isObject, g as isArrayOfType, j as isValidArray, v as isEmptyObject, w as isNotEmptyObject } from "./specials-krf7zsqI.mjs";
19
+ import { $ as trimString, a as deepParsePrimitives, f as isDeepEqual } from "./utils-DnyVgO8p.mjs";
20
20
  import { t as isDateLike } from "./guards-CyOZsZ1r.mjs";
21
21
 
22
22
  //#region src/form/guards.ts
@@ -15,7 +15,7 @@
15
15
  */
16
16
 
17
17
  import { M as ParsedQueryGeneric, N as QueryObject, j as ParsedQuery } from "./object-DyVg8BFt.cjs";
18
- import { R as QueryString } from "./string-Ok_IMpHP.cjs";
18
+ import { R as QueryString } from "./string-Cm9AMOl_.cjs";
19
19
 
20
20
  //#region src/dom/query.d.ts
21
21
  /**
@@ -15,7 +15,7 @@
15
15
  */
16
16
 
17
17
  import { M as ParsedQueryGeneric, N as QueryObject, j as ParsedQuery } from "./object-DyVg8BFt.mjs";
18
- import { R as QueryString } from "./string-edtZyJHf.mjs";
18
+ import { R as QueryString } from "./string-D7N_U6y2.mjs";
19
19
 
20
20
  //#region src/dom/query.d.ts
21
21
  /**
@@ -109,6 +109,17 @@ interface MaskOptions {
109
109
  end?: number;
110
110
  /** Character to use for masking. Defaults to `*`. */
111
111
  maskCharacter?: string;
112
+ /** Whether to trim all whitespace characters before masking. Defaults to `false`. */
113
+ trim?: boolean;
114
+ }
115
+ /** Options for truncating a string */
116
+ interface TruncateOptions {
117
+ /** The maximum length of the truncated string. Defaults to `100`. */
118
+ maxLength?: number;
119
+ /** The string to append to the truncated string. Defaults to `'...'`. */
120
+ suffix?: string;
121
+ /** Whether to trim all whitespace characters from the string before truncating. Defaults to `false`. */
122
+ trim?: boolean;
112
123
  }
113
124
  /** Formatted query string as `?${string}` = `?key=value&...` or empty string. */
114
125
  type QueryString = `?${string}` | '';
@@ -282,4 +293,4 @@ interface CharDiffResult {
282
293
  modified: HighlightedText[];
283
294
  }
284
295
  //#endregion
285
- export { HighlightedText as A, RemovedDiffLine as B, CountryShortISO as C, DiffResult as D, DiffLineType as E, PascalCase as F, TitleCase as G, SnakeCase as H, PascalSnakeCase as I, UnchangedOrModifiedDiffLine as J, TrainCase as K, PathCase as L, IsAlphabet as M, KebabCase as N, DiffStats as O, MaskOptions as P, QueryString as R, CountryName as S, DiffLineDetails as T, SpecialCharacter as U, SentenceCase as V, StringCaseOptions as W, CharDiffResult as _, $NormalizeString as a, CountryCode as b, $TrimRight as c, AddedDiffLine as d, Alphabet as f, CaseFormat as g, CapitalizeOptions as h, $LowercaseWords as i, Includes as j, DotCase as k, $UppercaseWords as l, CamelCase as m, $EnsureString as n, $TitleCaseWords as o, AnagramOptions as p, Trim as q, $LowerCaseWord as r, $TrimLeft as s, $CapitalizeWords as t, $WidenEmpty as u, ConstantCase as v, DiffLine as w, CountryISO as x, Country as y, RandomIdOptions as z };
296
+ export { HighlightedText as A, RemovedDiffLine as B, CountryShortISO as C, DiffResult as D, DiffLineType as E, PascalCase as F, TitleCase as G, SnakeCase as H, PascalSnakeCase as I, TruncateOptions as J, TrainCase as K, PathCase as L, IsAlphabet as M, KebabCase as N, DiffStats as O, MaskOptions as P, QueryString as R, CountryName as S, DiffLineDetails as T, SpecialCharacter as U, SentenceCase as V, StringCaseOptions as W, UnchangedOrModifiedDiffLine as Y, CharDiffResult as _, $NormalizeString as a, CountryCode as b, $TrimRight as c, AddedDiffLine as d, Alphabet as f, CaseFormat as g, CapitalizeOptions as h, $LowercaseWords as i, Includes as j, DotCase as k, $UppercaseWords as l, CamelCase as m, $EnsureString as n, $TitleCaseWords as o, AnagramOptions as p, Trim as q, $LowerCaseWord as r, $TrimLeft as s, $CapitalizeWords as t, $WidenEmpty as u, ConstantCase as v, DiffLine as w, CountryISO as x, Country as y, RandomIdOptions as z };
@@ -109,6 +109,17 @@ interface MaskOptions {
109
109
  end?: number;
110
110
  /** Character to use for masking. Defaults to `*`. */
111
111
  maskCharacter?: string;
112
+ /** Whether to trim all whitespace characters before masking. Defaults to `false`. */
113
+ trim?: boolean;
114
+ }
115
+ /** Options for truncating a string */
116
+ interface TruncateOptions {
117
+ /** The maximum length of the truncated string. Defaults to `100`. */
118
+ maxLength?: number;
119
+ /** The string to append to the truncated string. Defaults to `'...'`. */
120
+ suffix?: string;
121
+ /** Whether to trim all whitespace characters from the string before truncating. Defaults to `false`. */
122
+ trim?: boolean;
112
123
  }
113
124
  /** Formatted query string as `?${string}` = `?key=value&...` or empty string. */
114
125
  type QueryString = `?${string}` | '';
@@ -282,4 +293,4 @@ interface CharDiffResult {
282
293
  modified: HighlightedText[];
283
294
  }
284
295
  //#endregion
285
- export { HighlightedText as A, RemovedDiffLine as B, CountryShortISO as C, DiffResult as D, DiffLineType as E, PascalCase as F, TitleCase as G, SnakeCase as H, PascalSnakeCase as I, UnchangedOrModifiedDiffLine as J, TrainCase as K, PathCase as L, IsAlphabet as M, KebabCase as N, DiffStats as O, MaskOptions as P, QueryString as R, CountryName as S, DiffLineDetails as T, SpecialCharacter as U, SentenceCase as V, StringCaseOptions as W, CharDiffResult as _, $NormalizeString as a, CountryCode as b, $TrimRight as c, AddedDiffLine as d, Alphabet as f, CaseFormat as g, CapitalizeOptions as h, $LowercaseWords as i, Includes as j, DotCase as k, $UppercaseWords as l, CamelCase as m, $EnsureString as n, $TitleCaseWords as o, AnagramOptions as p, Trim as q, $LowerCaseWord as r, $TrimLeft as s, $CapitalizeWords as t, $WidenEmpty as u, ConstantCase as v, DiffLine as w, CountryISO as x, Country as y, RandomIdOptions as z };
296
+ export { HighlightedText as A, RemovedDiffLine as B, CountryShortISO as C, DiffResult as D, DiffLineType as E, PascalCase as F, TitleCase as G, SnakeCase as H, PascalSnakeCase as I, TruncateOptions as J, TrainCase as K, PathCase as L, IsAlphabet as M, KebabCase as N, DiffStats as O, MaskOptions as P, QueryString as R, CountryName as S, DiffLineDetails as T, SpecialCharacter as U, SentenceCase as V, StringCaseOptions as W, UnchangedOrModifiedDiffLine as Y, CharDiffResult as _, $NormalizeString as a, CountryCode as b, $TrimRight as c, AddedDiffLine as d, Alphabet as f, CaseFormat as g, CapitalizeOptions as h, $LowercaseWords as i, Includes as j, DotCase as k, $UppercaseWords as l, CamelCase as m, $EnsureString as n, $TitleCaseWords as o, AnagramOptions as p, Trim as q, $LowerCaseWord as r, $TrimLeft as s, $CapitalizeWords as t, $WidenEmpty as u, ConstantCase as v, DiffLine as w, CountryISO as x, Country as y, RandomIdOptions as z };
@@ -14,5 +14,5 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
- import { a as OriginFileObj, i as FormDataConfigs, n as FileError, o as ParsedFormData, r as FileUpload, s as SerializedForm, t as CustomFile } from "../form-DhsFvo_D.cjs";
17
+ import { a as OriginFileObj, i as FormDataConfigs, n as FileError, o as ParsedFormData, r as FileUpload, s as SerializedForm, t as CustomFile } from "../form-cW0-Ichd.cjs";
18
18
  export { CustomFile, FileError, FileUpload, FormDataConfigs, OriginFileObj, ParsedFormData, SerializedForm };
@@ -14,5 +14,5 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
- import { a as OriginFileObj, i as FormDataConfigs, n as FileError, o as ParsedFormData, r as FileUpload, s as SerializedForm, t as CustomFile } from "../form-D_5I437n.mjs";
17
+ import { a as OriginFileObj, i as FormDataConfigs, n as FileError, o as ParsedFormData, r as FileUpload, s as SerializedForm, t as CustomFile } from "../form-CDTwFDkB.mjs";
18
18
  export { CustomFile, FileError, FileUpload, FormDataConfigs, OriginFileObj, ParsedFormData, SerializedForm };
@@ -14,5 +14,5 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
- import { A as HighlightedText, B as RemovedDiffLine, C as CountryShortISO, D as DiffResult, E as DiffLineType, F as PascalCase, G as TitleCase, H as SnakeCase, I as PascalSnakeCase, J as UnchangedOrModifiedDiffLine, K as TrainCase, L as PathCase, M as IsAlphabet, N as KebabCase, O as DiffStats, P as MaskOptions, R as QueryString, S as CountryName, T as DiffLineDetails, U as SpecialCharacter, V as SentenceCase, W as StringCaseOptions, _ as CharDiffResult, a as $NormalizeString, b as CountryCode, c as $TrimRight, d as AddedDiffLine, f as Alphabet, g as CaseFormat, h as CapitalizeOptions, i as $LowercaseWords, j as Includes, k as DotCase, l as $UppercaseWords, m as CamelCase, n as $EnsureString, o as $TitleCaseWords, p as AnagramOptions, q as Trim, r as $LowerCaseWord, s as $TrimLeft, t as $CapitalizeWords, u as $WidenEmpty, v as ConstantCase, w as DiffLine, x as CountryISO, y as Country, z as RandomIdOptions } from "../string-Ok_IMpHP.cjs";
18
- export { $CapitalizeWords, $EnsureString, $LowerCaseWord, $LowercaseWords, $NormalizeString, $TitleCaseWords, $TrimLeft, $TrimRight, $UppercaseWords, $WidenEmpty, AddedDiffLine, Alphabet, AnagramOptions, CamelCase, CapitalizeOptions, CaseFormat, CharDiffResult, ConstantCase, Country, CountryCode, CountryISO, CountryName, CountryShortISO, DiffLine, DiffLineDetails, DiffLineType, DiffResult, DiffStats, DotCase, HighlightedText, Includes, IsAlphabet, KebabCase, MaskOptions, PascalCase, PascalSnakeCase, PathCase, QueryString, RandomIdOptions, RemovedDiffLine, SentenceCase, SnakeCase, SpecialCharacter, StringCaseOptions, TitleCase, TrainCase, Trim, UnchangedOrModifiedDiffLine };
17
+ import { A as HighlightedText, B as RemovedDiffLine, C as CountryShortISO, D as DiffResult, E as DiffLineType, F as PascalCase, G as TitleCase, H as SnakeCase, I as PascalSnakeCase, J as TruncateOptions, K as TrainCase, L as PathCase, M as IsAlphabet, N as KebabCase, O as DiffStats, P as MaskOptions, R as QueryString, S as CountryName, T as DiffLineDetails, U as SpecialCharacter, V as SentenceCase, W as StringCaseOptions, Y as UnchangedOrModifiedDiffLine, _ as CharDiffResult, a as $NormalizeString, b as CountryCode, c as $TrimRight, d as AddedDiffLine, f as Alphabet, g as CaseFormat, h as CapitalizeOptions, i as $LowercaseWords, j as Includes, k as DotCase, l as $UppercaseWords, m as CamelCase, n as $EnsureString, o as $TitleCaseWords, p as AnagramOptions, q as Trim, r as $LowerCaseWord, s as $TrimLeft, t as $CapitalizeWords, u as $WidenEmpty, v as ConstantCase, w as DiffLine, x as CountryISO, y as Country, z as RandomIdOptions } from "../string-Cm9AMOl_.cjs";
18
+ export { $CapitalizeWords, $EnsureString, $LowerCaseWord, $LowercaseWords, $NormalizeString, $TitleCaseWords, $TrimLeft, $TrimRight, $UppercaseWords, $WidenEmpty, AddedDiffLine, Alphabet, AnagramOptions, CamelCase, CapitalizeOptions, CaseFormat, CharDiffResult, ConstantCase, Country, CountryCode, CountryISO, CountryName, CountryShortISO, DiffLine, DiffLineDetails, DiffLineType, DiffResult, DiffStats, DotCase, HighlightedText, Includes, IsAlphabet, KebabCase, MaskOptions, PascalCase, PascalSnakeCase, PathCase, QueryString, RandomIdOptions, RemovedDiffLine, SentenceCase, SnakeCase, SpecialCharacter, StringCaseOptions, TitleCase, TrainCase, Trim, TruncateOptions, UnchangedOrModifiedDiffLine };
@@ -14,5 +14,5 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
- import { A as HighlightedText, B as RemovedDiffLine, C as CountryShortISO, D as DiffResult, E as DiffLineType, F as PascalCase, G as TitleCase, H as SnakeCase, I as PascalSnakeCase, J as UnchangedOrModifiedDiffLine, K as TrainCase, L as PathCase, M as IsAlphabet, N as KebabCase, O as DiffStats, P as MaskOptions, R as QueryString, S as CountryName, T as DiffLineDetails, U as SpecialCharacter, V as SentenceCase, W as StringCaseOptions, _ as CharDiffResult, a as $NormalizeString, b as CountryCode, c as $TrimRight, d as AddedDiffLine, f as Alphabet, g as CaseFormat, h as CapitalizeOptions, i as $LowercaseWords, j as Includes, k as DotCase, l as $UppercaseWords, m as CamelCase, n as $EnsureString, o as $TitleCaseWords, p as AnagramOptions, q as Trim, r as $LowerCaseWord, s as $TrimLeft, t as $CapitalizeWords, u as $WidenEmpty, v as ConstantCase, w as DiffLine, x as CountryISO, y as Country, z as RandomIdOptions } from "../string-edtZyJHf.mjs";
18
- export { $CapitalizeWords, $EnsureString, $LowerCaseWord, $LowercaseWords, $NormalizeString, $TitleCaseWords, $TrimLeft, $TrimRight, $UppercaseWords, $WidenEmpty, AddedDiffLine, Alphabet, AnagramOptions, CamelCase, CapitalizeOptions, CaseFormat, CharDiffResult, ConstantCase, Country, CountryCode, CountryISO, CountryName, CountryShortISO, DiffLine, DiffLineDetails, DiffLineType, DiffResult, DiffStats, DotCase, HighlightedText, Includes, IsAlphabet, KebabCase, MaskOptions, PascalCase, PascalSnakeCase, PathCase, QueryString, RandomIdOptions, RemovedDiffLine, SentenceCase, SnakeCase, SpecialCharacter, StringCaseOptions, TitleCase, TrainCase, Trim, UnchangedOrModifiedDiffLine };
17
+ import { A as HighlightedText, B as RemovedDiffLine, C as CountryShortISO, D as DiffResult, E as DiffLineType, F as PascalCase, G as TitleCase, H as SnakeCase, I as PascalSnakeCase, J as TruncateOptions, K as TrainCase, L as PathCase, M as IsAlphabet, N as KebabCase, O as DiffStats, P as MaskOptions, R as QueryString, S as CountryName, T as DiffLineDetails, U as SpecialCharacter, V as SentenceCase, W as StringCaseOptions, Y as UnchangedOrModifiedDiffLine, _ as CharDiffResult, a as $NormalizeString, b as CountryCode, c as $TrimRight, d as AddedDiffLine, f as Alphabet, g as CaseFormat, h as CapitalizeOptions, i as $LowercaseWords, j as Includes, k as DotCase, l as $UppercaseWords, m as CamelCase, n as $EnsureString, o as $TitleCaseWords, p as AnagramOptions, q as Trim, r as $LowerCaseWord, s as $TrimLeft, t as $CapitalizeWords, u as $WidenEmpty, v as ConstantCase, w as DiffLine, x as CountryISO, y as Country, z as RandomIdOptions } from "../string-D7N_U6y2.mjs";
18
+ export { $CapitalizeWords, $EnsureString, $LowerCaseWord, $LowercaseWords, $NormalizeString, $TitleCaseWords, $TrimLeft, $TrimRight, $UppercaseWords, $WidenEmpty, AddedDiffLine, Alphabet, AnagramOptions, CamelCase, CapitalizeOptions, CaseFormat, CharDiffResult, ConstantCase, Country, CountryCode, CountryISO, CountryName, CountryShortISO, DiffLine, DiffLineDetails, DiffLineType, DiffResult, DiffStats, DotCase, HighlightedText, Includes, IsAlphabet, KebabCase, MaskOptions, PascalCase, PascalSnakeCase, PathCase, QueryString, RandomIdOptions, RemovedDiffLine, SentenceCase, SnakeCase, SpecialCharacter, StringCaseOptions, TitleCase, TrainCase, Trim, TruncateOptions, UnchangedOrModifiedDiffLine };
@@ -20,19 +20,25 @@ const require_utilities = require('./utilities-_COSGq1U.cjs');
20
20
  const require_guards = require('./guards-DalSfIxV.cjs');
21
21
 
22
22
  //#region src/string/basics.ts
23
- /**
24
- * * Utility to truncate a string to a specified length.
23
+ /** Utility to truncate a string to a specified length.
25
24
  *
26
25
  * @param str The string to truncate.
27
- * @param maxLength The maximum length of the truncated string.
28
- * @returns Truncated string with ellipsis (`...`) (only if it has more length than `maxLength`).
26
+ * @param optionsOrLength The maximum length of the truncated string or options.
27
+ * @returns Truncated string based on provided options.
29
28
  */
30
- function truncateString(str, maxLength) {
29
+ function truncateString(str, optionsOrLength) {
31
30
  if (!require_primitives.isNonEmptyString(str)) return "";
32
- const trimmedString = str.trim();
31
+ let maxLength = 100, suffix = "...", trim = false;
32
+ if (require_primitives.isNumber(optionsOrLength) && optionsOrLength > 0) maxLength = optionsOrLength;
33
+ else if (require_specials.isNotEmptyObject(optionsOrLength)) {
34
+ maxLength = optionsOrLength?.maxLength ?? maxLength;
35
+ suffix = optionsOrLength?.suffix ?? suffix;
36
+ trim = optionsOrLength?.trim ?? trim;
37
+ }
38
+ const trimmedString = trim ? trimString(str) : str;
33
39
  if (!trimmedString) return "";
34
40
  if (trimmedString.length <= maxLength) return trimmedString;
35
- return trimmedString.slice(0, maxLength).concat("...");
41
+ return trimmedString.slice(0, maxLength).concat(suffix);
36
42
  }
37
43
  /**
38
44
  * * Generates a random alphanumeric (16 characters long, this length is customizable in the options) ID string composed of an optional `prefix`, `suffix`, a `timestamp`, `caseOption` and a customizable `separator`.
@@ -41,6 +47,7 @@ function truncateString(str, maxLength) {
41
47
  * @returns The generated ID string composed of the random alphanumeric string of specified length with optional `timeStamp`, `prefix`, and `suffix`, `caseOption` and `separator`.
42
48
  *
43
49
  * @see {@link https://toolbox-x.nazmul-nhb.dev/docs/utils/hash/uuid uuid} for `uuid` generation
50
+ * @see {@link https://toolbox-x.nazmul-nhb.dev/docs/utils/hash/random-numeric randomHex} for random numeric string generation
44
51
  * @see {@link https://toolbox-x.nazmul-nhb.dev/docs/utils/hash/random-hex randomHex} for random hexadecimal string generation
45
52
  *
46
53
  * @example
@@ -20,19 +20,25 @@ import { a as normalizeNumber } from "./utilities-CmPwOkdy.mjs";
20
20
  import { t as isDateLike } from "./guards-CyOZsZ1r.mjs";
21
21
 
22
22
  //#region src/string/basics.ts
23
- /**
24
- * * Utility to truncate a string to a specified length.
23
+ /** Utility to truncate a string to a specified length.
25
24
  *
26
25
  * @param str The string to truncate.
27
- * @param maxLength The maximum length of the truncated string.
28
- * @returns Truncated string with ellipsis (`...`) (only if it has more length than `maxLength`).
26
+ * @param optionsOrLength The maximum length of the truncated string or options.
27
+ * @returns Truncated string based on provided options.
29
28
  */
30
- function truncateString(str, maxLength) {
29
+ function truncateString(str, optionsOrLength) {
31
30
  if (!isNonEmptyString(str)) return "";
32
- const trimmedString = str.trim();
31
+ let maxLength = 100, suffix = "...", trim = false;
32
+ if (isNumber(optionsOrLength) && optionsOrLength > 0) maxLength = optionsOrLength;
33
+ else if (isNotEmptyObject(optionsOrLength)) {
34
+ maxLength = optionsOrLength?.maxLength ?? maxLength;
35
+ suffix = optionsOrLength?.suffix ?? suffix;
36
+ trim = optionsOrLength?.trim ?? trim;
37
+ }
38
+ const trimmedString = trim ? trimString(str) : str;
33
39
  if (!trimmedString) return "";
34
40
  if (trimmedString.length <= maxLength) return trimmedString;
35
- return trimmedString.slice(0, maxLength).concat("...");
41
+ return trimmedString.slice(0, maxLength).concat(suffix);
36
42
  }
37
43
  /**
38
44
  * * Generates a random alphanumeric (16 characters long, this length is customizable in the options) ID string composed of an optional `prefix`, `suffix`, a `timestamp`, `caseOption` and a customizable `separator`.
@@ -41,6 +47,7 @@ function truncateString(str, maxLength) {
41
47
  * @returns The generated ID string composed of the random alphanumeric string of specified length with optional `timeStamp`, `prefix`, and `suffix`, `caseOption` and `separator`.
42
48
  *
43
49
  * @see {@link https://toolbox-x.nazmul-nhb.dev/docs/utils/hash/uuid uuid} for `uuid` generation
50
+ * @see {@link https://toolbox-x.nazmul-nhb.dev/docs/utils/hash/random-numeric randomHex} for random numeric string generation
44
51
  * @see {@link https://toolbox-x.nazmul-nhb.dev/docs/utils/hash/random-hex randomHex} for random hexadecimal string generation
45
52
  *
46
53
  * @example
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "toolbox-x",
3
- "version": "2.4.4",
3
+ "version": "2.4.6",
4
4
  "description": "A versatile collection of smart, efficient, and reusable utility functions, classes and types for everyday development needs.",
5
5
  "main": "./dist/index.cjs",
6
6
  "type": "module",