@rzl-zone/utils-js 3.1.0-beta.2 → 3.1.1-beta.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/NumberRangeUnion-DC-C3_Kq.d.ts +23 -23
- package/dist/any-BmdI8UbK.d.ts +56 -56
- package/dist/arrays-normalize-recursive-CnjYJ9xg.d.ts +66 -66
- package/dist/assertions/index.cjs +1 -1
- package/dist/assertions/index.d.ts +396 -396
- package/dist/assertions/index.js +1 -1
- package/dist/chunk-26W3VZIK.cjs +1 -0
- package/dist/chunk-2KRCHXFG.cjs +2 -0
- package/dist/{chunk-TQMZ2LPI.js → chunk-33ZLH266.js} +1 -1
- package/dist/{chunk-VQLAPEL3.js → chunk-4L4EJTNZ.js} +1 -1
- package/dist/{chunk-CK3BZGEU.js → chunk-5Q37AP7P.js} +1 -1
- package/dist/chunk-7CHFAMS2.js +1 -0
- package/dist/{chunk-REFMEB4A.js → chunk-7MMJZ6HS.js} +1 -1
- package/dist/chunk-7TC6DE3J.cjs +1 -0
- package/dist/{chunk-K4PLGD7C.js → chunk-7VX33E3V.js} +1 -1
- package/dist/chunk-BEZPD44N.cjs +1 -0
- package/dist/{chunk-2AUUPGMN.js → chunk-BI263OHW.js} +1 -1
- package/dist/{chunk-LVUSFXQS.cjs → chunk-CII6WWLO.cjs} +1 -1
- package/dist/{chunk-OX6RLS2F.cjs → chunk-D5TYPCWU.cjs} +1 -1
- package/dist/{chunk-MWLEM7ED.js → chunk-EEQY5QUG.js} +1 -1
- package/dist/chunk-ESJYBIYH.js +1 -0
- package/dist/{chunk-MJAW5RAK.js → chunk-EWYPSKKM.js} +1 -1
- package/dist/chunk-EXCOQLWX.cjs +1 -0
- package/dist/chunk-FWQVTMYA.cjs +1 -0
- package/dist/{chunk-25G6B35W.js → chunk-G4EWCRKS.js} +1 -1
- package/dist/{chunk-PFLNHD4B.cjs → chunk-G7R5XZRM.cjs} +1 -1
- package/dist/{chunk-EXXLUO7L.cjs → chunk-GGEV7LXX.cjs} +1 -1
- package/dist/{chunk-VTR75UID.cjs → chunk-HJOZOENU.cjs} +1 -1
- package/dist/{chunk-HXTACM3O.cjs → chunk-IRDZVLNZ.cjs} +1 -1
- package/dist/chunk-IW73G523.cjs +1 -0
- package/dist/chunk-IY5OZAB3.cjs +1 -0
- package/dist/{chunk-467VEMJH.js → chunk-J4NCYYGS.js} +1 -1
- package/dist/{chunk-RHIBYOFQ.js → chunk-J7JAZAJD.js} +1 -1
- package/dist/{chunk-JQZUWBIX.js → chunk-JYNSO7ZY.js} +1 -1
- package/dist/{chunk-UUMKL74S.js → chunk-K3UVKYEU.js} +1 -1
- package/dist/{chunk-ME5OV5HN.js → chunk-LQ76EDZG.js} +1 -1
- package/dist/chunk-MROH35V3.cjs +1 -0
- package/dist/chunk-NJSAV73S.js +1 -0
- package/dist/{chunk-HXST7RJB.js → chunk-NR44SNYE.js} +1 -1
- package/dist/{chunk-BLCANGFS.js → chunk-NXMTWY77.js} +1 -1
- package/dist/chunk-OZCQZO2V.cjs +4 -0
- package/dist/chunk-Q3NTKN5I.cjs +1 -0
- package/dist/{chunk-NSVLG7NY.js → chunk-QDNSC57Z.js} +1 -1
- package/dist/{chunk-NUVGETPD.js → chunk-QGXTL5ZH.js} +1 -1
- package/dist/{chunk-D43GV6EF.cjs → chunk-QSQDP7L2.cjs} +1 -1
- package/dist/{chunk-U4TZO7WV.js → chunk-S5M33A4O.js} +1 -1
- package/dist/{chunk-S7GMG4TB.js → chunk-SGTHOQQ2.js} +1 -1
- package/dist/chunk-SL3RQOWA.js +1 -0
- package/dist/{chunk-NUHOOAUN.cjs → chunk-SZPWZZYG.cjs} +1 -1
- package/dist/{chunk-RHE3M2NJ.cjs → chunk-UA4B7JBO.cjs} +1 -1
- package/dist/chunk-UQDJF5RR.cjs +1 -0
- package/dist/chunk-UTQUYABU.cjs +1 -0
- package/dist/{chunk-G72VSVGO.js → chunk-VPW3DRV5.js} +1 -1
- package/dist/{chunk-PSWITZK5.js → chunk-W32WALNU.js} +1 -1
- package/dist/chunk-XGZ6K753.cjs +1 -0
- package/dist/chunk-YFTR64N5.cjs +1 -0
- package/dist/chunk-ZFDS7W6B.cjs +1 -0
- package/dist/chunk-ZQOLZE6Z.cjs +1 -0
- package/dist/conversions/index.cjs +1 -1
- package/dist/conversions/index.d.ts +1285 -1285
- package/dist/conversions/index.js +1 -1
- package/dist/env/index.d.ts +14 -14
- package/dist/events/index.cjs +1 -1
- package/dist/events/index.d.ts +109 -109
- package/dist/events/index.js +1 -1
- package/dist/extends-Bk_SBGdT.d.ts +330 -330
- package/dist/formatting/index.cjs +1 -1
- package/dist/formatting/index.d.ts +855 -855
- package/dist/formatting/index.js +1 -1
- package/dist/generator/index.cjs +1 -1
- package/dist/generator/index.d.ts +155 -155
- package/dist/generator/index.js +1 -1
- package/dist/if-CvT4R7Kh.d.ts +16 -16
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/is-array--YjXV-Wx.d.ts +1084 -1084
- package/dist/isPlainObject-BVhBAPHX.d.ts +154 -154
- package/dist/never-BfayMBF9.d.ts +64 -64
- package/dist/next/index.cjs +5 -5
- package/dist/next/index.d.ts +183 -183
- package/dist/next/index.js +1 -1
- package/dist/next/server/index.cjs +1 -1
- package/dist/next/server/index.d.ts +25 -25
- package/dist/next/server/index.js +1 -1
- package/dist/nils-DMz3kU7M.d.ts +155 -155
- package/dist/omit-VvmIsZmX.d.ts +25 -25
- package/dist/operations/index.cjs +1 -1
- package/dist/operations/index.d.ts +120 -120
- package/dist/operations/index.js +1 -1
- package/dist/parsers/index.cjs +1 -1
- package/dist/parsers/index.d.ts +34 -34
- package/dist/parsers/index.js +1 -1
- package/dist/predicates/index.cjs +1 -1
- package/dist/predicates/index.d.ts +1674 -1674
- package/dist/predicates/index.js +1 -1
- package/dist/prettify-C4xLcYOP.d.ts +328 -328
- package/dist/promise/index.cjs +1 -1
- package/dist/promise/index.d.ts +29 -29
- package/dist/promise/index.js +1 -1
- package/dist/rzl-utils.global.js +1 -1
- package/dist/string-XA-til3C.d.ts +318 -318
- package/dist/strings/index.cjs +1 -1
- package/dist/strings/index.d.ts +690 -690
- package/dist/strings/index.js +1 -1
- package/dist/stylings/index.cjs +1 -1
- package/dist/stylings/index.d.ts +35 -35
- package/dist/stylings/index.js +1 -1
- package/dist/type-data-DDs-u2kq.d.ts +241 -241
- package/dist/types/index.d.ts +3264 -3264
- package/dist/urls/index.cjs +1 -1
- package/dist/urls/index.d.ts +373 -373
- package/dist/urls/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-2JQQQ625.js +0 -1
- package/dist/chunk-445TAVT4.cjs +0 -1
- package/dist/chunk-6Q4I2RPC.cjs +0 -1
- package/dist/chunk-6SMJMZ7G.cjs +0 -1
- package/dist/chunk-DFSTVQFI.cjs +0 -1
- package/dist/chunk-DYRDBYPF.cjs +0 -1
- package/dist/chunk-GAJTFCUA.js +0 -1
- package/dist/chunk-GOJNH55O.cjs +0 -1
- package/dist/chunk-IJTZWWRJ.cjs +0 -1
- package/dist/chunk-ISJ33O2J.cjs +0 -1
- package/dist/chunk-JISH2VGG.js +0 -1
- package/dist/chunk-KZQB7H4E.cjs +0 -1
- package/dist/chunk-LUVV5KSD.cjs +0 -2
- package/dist/chunk-MF5Y5K4N.cjs +0 -1
- package/dist/chunk-O5VXBNUQ.cjs +0 -4
- package/dist/chunk-O7SJR4CY.cjs +0 -1
- package/dist/chunk-PYUVKHUF.cjs +0 -1
- package/dist/chunk-XFCJDSB2.cjs +0 -1
- package/dist/chunk-XOYX4PLZ.cjs +0 -1
- package/dist/chunk-Z6FLCEN6.js +0 -1
- package/dist/chunk-ZO5364A6.cjs +0 -1
package/dist/strings/index.d.ts
CHANGED
|
@@ -1,741 +1,741 @@
|
|
|
1
1
|
import{c as Nilable}from'../nils-DMz3kU7M.js';import{E as Extends}from'../extends-Bk_SBGdT.js';import'../if-CvT4R7Kh.js';import'../never-BfayMBF9.js';type CapitalizeFirstOptions={
|
|
2
2
|
/** If true **(default)**, the rest of the string will be converted to lowercase after capitalizing the first letter.
|
|
3
|
-
*
|
|
4
|
-
* @default true
|
|
5
|
-
*/
|
|
3
|
+
*
|
|
4
|
+
* @default true
|
|
5
|
+
*/
|
|
6
6
|
lowerCaseNextRest?:boolean;
|
|
7
7
|
/** If true, the string will trimmed, default: `false`.
|
|
8
|
-
*
|
|
9
|
-
* @default false
|
|
10
|
-
*/
|
|
8
|
+
*
|
|
9
|
+
* @default false
|
|
10
|
+
*/
|
|
11
11
|
trim?:boolean;};
|
|
12
12
|
/** ----------------------------------------------------------
|
|
13
|
-
* * ***Utility: `capitalizeFirst`.***
|
|
14
|
-
* ----------------------------------------------------------
|
|
15
|
-
* **Capitalizes the first letter of a string, with optionally lowercases the rest and trims whitespace.**
|
|
16
|
-
* @param {string | null | undefined} string - The string to be processed.
|
|
17
|
-
* @param {CapitalizeFirstOptions} [options] - Options to control behavior.
|
|
18
|
-
* @param {CapitalizeFirstOptions["lowerCaseNextRest"]} [options.lowerCaseNextRest=true] - If true, lowercases the rest (next first letter), default: `true`.
|
|
19
|
-
* @param {CapitalizeFirstOptions["trim"]} [options.trim=false] - If true, trims the string before processing, default: `false`.
|
|
20
|
-
* @returns {string} The processed string, returns `""` if input is `null`, `undefined`, or `not a valid string`.
|
|
21
|
-
* @example
|
|
22
|
-
* ```ts
|
|
23
|
-
* capitalizeFirst(" hello WORLD ")
|
|
24
|
-
* // ➔ " Hello world"
|
|
25
|
-
* capitalizeFirst(" hello WORLD ", { trim: true })
|
|
26
|
-
* // ➔ "Hello world"
|
|
27
|
-
* capitalizeFirst("FOO", { lowerCaseNextRest: false })
|
|
28
|
-
* // ➔ "FOO"
|
|
29
|
-
* capitalizeFirst(" foo BAR ", { trim: true, lowerCaseNextRest: false })
|
|
30
|
-
* // ➔ "Foo BAR"
|
|
31
|
-
* ```
|
|
32
|
-
* #### ℹ️ If null, undefined, or not a valid string input, return `""`.
|
|
33
|
-
* ```ts
|
|
34
|
-
* capitalizeFirst(123)
|
|
35
|
-
* capitalizeFirst(null)
|
|
36
|
-
* capitalizeFirst(undefined)
|
|
37
|
-
* // ➔ ""
|
|
38
|
-
* ```
|
|
39
|
-
*/
|
|
13
|
+
* * ***Utility: `capitalizeFirst`.***
|
|
14
|
+
* ----------------------------------------------------------
|
|
15
|
+
* **Capitalizes the first letter of a string, with optionally lowercases the rest and trims whitespace.**
|
|
16
|
+
* @param {string | null | undefined} string - The string to be processed.
|
|
17
|
+
* @param {CapitalizeFirstOptions} [options] - Options to control behavior.
|
|
18
|
+
* @param {CapitalizeFirstOptions["lowerCaseNextRest"]} [options.lowerCaseNextRest=true] - If true, lowercases the rest (next first letter), default: `true`.
|
|
19
|
+
* @param {CapitalizeFirstOptions["trim"]} [options.trim=false] - If true, trims the string before processing, default: `false`.
|
|
20
|
+
* @returns {string} The processed string, returns `""` if input is `null`, `undefined`, or `not a valid string`.
|
|
21
|
+
* @example
|
|
22
|
+
* ```ts
|
|
23
|
+
* capitalizeFirst(" hello WORLD ")
|
|
24
|
+
* // ➔ " Hello world"
|
|
25
|
+
* capitalizeFirst(" hello WORLD ", { trim: true })
|
|
26
|
+
* // ➔ "Hello world"
|
|
27
|
+
* capitalizeFirst("FOO", { lowerCaseNextRest: false })
|
|
28
|
+
* // ➔ "FOO"
|
|
29
|
+
* capitalizeFirst(" foo BAR ", { trim: true, lowerCaseNextRest: false })
|
|
30
|
+
* // ➔ "Foo BAR"
|
|
31
|
+
* ```
|
|
32
|
+
* #### ℹ️ If null, undefined, or not a valid string input, return `""`.
|
|
33
|
+
* ```ts
|
|
34
|
+
* capitalizeFirst(123)
|
|
35
|
+
* capitalizeFirst(null)
|
|
36
|
+
* capitalizeFirst(undefined)
|
|
37
|
+
* // ➔ ""
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
40
|
declare const capitalizeFirst:(string:string|null|undefined,options?:CapitalizeFirstOptions)=>string;type CapitalizeWordsOptions={
|
|
41
41
|
/** If `true`, removes leading and trailing spaces, default `false`.
|
|
42
|
-
*
|
|
43
|
-
* @default false
|
|
44
|
-
*/
|
|
42
|
+
*
|
|
43
|
+
* @default false
|
|
44
|
+
*/
|
|
45
45
|
trim?:boolean;
|
|
46
46
|
/** If `true`, collapses multiple spaces **between words** into a single space (while preserving leading/trailing spaces), default `false`.
|
|
47
|
-
*
|
|
48
|
-
* @default false
|
|
49
|
-
*/
|
|
47
|
+
*
|
|
48
|
+
* @default false
|
|
49
|
+
*/
|
|
50
50
|
collapseSpaces?:boolean;};
|
|
51
51
|
/** ----------------------------------------------------------
|
|
52
|
-
* * ***Utility: `capitalizeWords`.***
|
|
53
|
-
* ----------------------------------------------------------
|
|
54
|
-
* **Capitalizes the first letter of each word in a string while converting the rest to lowercase.**
|
|
55
|
-
* @param {string | null | undefined} value
|
|
56
|
-
* The input string to be processed.
|
|
57
|
-
* - If `null` or `undefined`, returns an empty-string (`""`).
|
|
58
|
-
* @param {CapitalizeWordsOptions} [options]
|
|
59
|
-
* Optional settings to control the output:
|
|
60
|
-
* - `trim`: If `true`, removes leading and trailing spaces, defaultValue: `false`.
|
|
61
|
-
* - `collapseSpaces`: If `true`, collapses multiple spaces **between words** into a single space (while preserving leading/trailing spaces), defaultValue: `false`.
|
|
62
|
-
* @returns {string} A new string where each word starts with an uppercase letter
|
|
63
|
-
* and the remaining letters are lowercase.
|
|
64
|
-
* - If `value` is `empty`, `null`, or `undefined`, returns an `empty-string`.
|
|
65
|
-
* @example
|
|
66
|
-
* ```ts
|
|
67
|
-
* capitalizeWords(" hello world ");
|
|
68
|
-
* // ➔ " Hello World "
|
|
69
|
-
* capitalizeWords(" hello world ", { trim: true });
|
|
70
|
-
* // ➔ "Hello World"
|
|
71
|
-
* capitalizeWords(" hello world ", { collapseSpaces: true });
|
|
72
|
-
* // ➔ " Hello World "
|
|
73
|
-
* capitalizeWords(" hello world ", { trim: true, collapseSpaces: true });
|
|
74
|
-
* // ➔ "Hello World"
|
|
75
|
-
* ```
|
|
76
|
-
* #### ℹ️ If null, undefined, or not a valid string input, return "".
|
|
77
|
-
* ```ts
|
|
78
|
-
* capitalizeWords(123);
|
|
79
|
-
* capitalizeWords(null);
|
|
80
|
-
* capitalizeWords(undefined);
|
|
81
|
-
* // ➔ ""
|
|
82
|
-
* ```
|
|
83
|
-
*/
|
|
52
|
+
* * ***Utility: `capitalizeWords`.***
|
|
53
|
+
* ----------------------------------------------------------
|
|
54
|
+
* **Capitalizes the first letter of each word in a string while converting the rest to lowercase.**
|
|
55
|
+
* @param {string | null | undefined} value
|
|
56
|
+
* The input string to be processed.
|
|
57
|
+
* - If `null` or `undefined`, returns an empty-string (`""`).
|
|
58
|
+
* @param {CapitalizeWordsOptions} [options]
|
|
59
|
+
* Optional settings to control the output:
|
|
60
|
+
* - `trim`: If `true`, removes leading and trailing spaces, defaultValue: `false`.
|
|
61
|
+
* - `collapseSpaces`: If `true`, collapses multiple spaces **between words** into a single space (while preserving leading/trailing spaces), defaultValue: `false`.
|
|
62
|
+
* @returns {string} A new string where each word starts with an uppercase letter
|
|
63
|
+
* and the remaining letters are lowercase.
|
|
64
|
+
* - If `value` is `empty`, `null`, or `undefined`, returns an `empty-string`.
|
|
65
|
+
* @example
|
|
66
|
+
* ```ts
|
|
67
|
+
* capitalizeWords(" hello world ");
|
|
68
|
+
* // ➔ " Hello World "
|
|
69
|
+
* capitalizeWords(" hello world ", { trim: true });
|
|
70
|
+
* // ➔ "Hello World"
|
|
71
|
+
* capitalizeWords(" hello world ", { collapseSpaces: true });
|
|
72
|
+
* // ➔ " Hello World "
|
|
73
|
+
* capitalizeWords(" hello world ", { trim: true, collapseSpaces: true });
|
|
74
|
+
* // ➔ "Hello World"
|
|
75
|
+
* ```
|
|
76
|
+
* #### ℹ️ If null, undefined, or not a valid string input, return "".
|
|
77
|
+
* ```ts
|
|
78
|
+
* capitalizeWords(123);
|
|
79
|
+
* capitalizeWords(null);
|
|
80
|
+
* capitalizeWords(undefined);
|
|
81
|
+
* // ➔ ""
|
|
82
|
+
* ```
|
|
83
|
+
*/
|
|
84
84
|
declare const capitalizeWords:(value:string|null|undefined,options?:CapitalizeWordsOptions)=>string;
|
|
85
85
|
/** --------------------------------------------------
|
|
86
|
-
* * ***Represents a string input.***
|
|
87
|
-
* --------------------------------------------------
|
|
88
|
-
*
|
|
89
|
-
* - **Can be one of:**
|
|
90
|
-
* - A single `string`
|
|
91
|
-
* - An array of strings (`string[]`)
|
|
92
|
-
* - A readonly array of strings (`readonly string[]`)
|
|
93
|
-
* - `null` or `undefined`
|
|
94
|
-
*
|
|
95
|
-
* @template T - A string or array of strings.
|
|
96
|
-
*/
|
|
86
|
+
* * ***Represents a string input.***
|
|
87
|
+
* --------------------------------------------------
|
|
88
|
+
*
|
|
89
|
+
* - **Can be one of:**
|
|
90
|
+
* - A single `string`
|
|
91
|
+
* - An array of strings (`string[]`)
|
|
92
|
+
* - A readonly array of strings (`readonly string[]`)
|
|
93
|
+
* - `null` or `undefined`
|
|
94
|
+
*
|
|
95
|
+
* @template T - A string or array of strings.
|
|
96
|
+
*/
|
|
97
97
|
type StringLike=Nilable<string|string[]|ReadonlyArray<string>>;
|
|
98
98
|
/** --------------------------------------------------
|
|
99
|
-
* * ***Represents a collection of strings.***
|
|
100
|
-
* --------------------------------------------------
|
|
101
|
-
*
|
|
102
|
-
* - **Can be one of:**
|
|
103
|
-
* - A single `string`
|
|
104
|
-
* - An array of strings (`string[]`)
|
|
105
|
-
* - A readonly array of strings (`readonly string[]`)
|
|
106
|
-
* - A `Set<string>`
|
|
107
|
-
* - A `ReadonlySet<string>`
|
|
108
|
-
*/
|
|
99
|
+
* * ***Represents a collection of strings.***
|
|
100
|
+
* --------------------------------------------------
|
|
101
|
+
*
|
|
102
|
+
* - **Can be one of:**
|
|
103
|
+
* - A single `string`
|
|
104
|
+
* - An array of strings (`string[]`)
|
|
105
|
+
* - A readonly array of strings (`readonly string[]`)
|
|
106
|
+
* - A `Set<string>`
|
|
107
|
+
* - A `ReadonlySet<string>`
|
|
108
|
+
*/
|
|
109
109
|
type StringCollection=string|string[]|ReadonlyArray<string>|Set<string>|ReadonlySet<string>;
|
|
110
110
|
/** ----------------------------------------------------------
|
|
111
|
-
* * ***Utility: `toCamelCase`.***
|
|
112
|
-
* ----------------------------------------------------------
|
|
113
|
-
* **Converts a string (or array of strings) into `camelCase`, with optionally leaving specific words unchanged.**
|
|
114
|
-
* - **Behavior:**
|
|
115
|
-
* - Accepts a `string` or an `array of strings`:
|
|
116
|
-
* - If an array is provided, elements are trimmed, empty ones removed,
|
|
117
|
-
* then joined with `"-"` before conversion.
|
|
118
|
-
* - Splits the input by non-alphanumeric characters
|
|
119
|
-
* (spaces, punctuation, symbols, hyphens, underscores, emojis, etc.).
|
|
120
|
-
* - The first word is fully lowercase; subsequent words are capitalized.
|
|
121
|
-
* - Words listed in `ignoreWord` remain unchanged in the output.
|
|
122
|
-
* - `ignoreWord` is normalized (trimmed, delimiters removed), empty values ignored.
|
|
123
|
-
* - `ignoreWord` accepts:
|
|
124
|
-
* - a single string,
|
|
125
|
-
* - an array of strings, or
|
|
126
|
-
* - a `Set` of strings.
|
|
127
|
-
* - Multiple delimiters collapse into one; empty segments ignored.
|
|
128
|
-
* - Returns `""` if the input is `null`, `undefined`, or empty.
|
|
129
|
-
* @param {StringLike} input - The string or array to convert. Returns `""` if empty, `null`, or `undefined`.
|
|
130
|
-
* @param {StringCollection} [ignoreWord] - Optional word(s) to leave unchanged in the output.
|
|
131
|
-
* @returns {string} The camelCase formatted string.
|
|
132
|
-
* @example
|
|
133
|
-
* // Basic usage
|
|
134
|
-
* toCamelCase("hello world");
|
|
135
|
-
* // ➔ "helloWorld"
|
|
136
|
-
*
|
|
137
|
-
* // Array input is joined before conversion
|
|
138
|
-
* toCamelCase(["Join", "Words", "Here"]);
|
|
139
|
-
* // ➔ "joinWordsHere"
|
|
140
|
-
*
|
|
141
|
-
* // Supports mixed delimiters
|
|
142
|
-
* toCamelCase("convert_to-camel case");
|
|
143
|
-
* // ➔ "convertToCamelCase"
|
|
144
|
-
*
|
|
145
|
-
* // Words in ignoreWord stay unchanged
|
|
146
|
-
* toCamelCase("this URL path will ignore", "URL");
|
|
147
|
-
* // ➔ "thisURLPathWillIgnore"
|
|
148
|
-
*
|
|
149
|
-
* // Multiple ignored words
|
|
150
|
-
* toCamelCase("ignore API and URL", ["API", "URL"]);
|
|
151
|
-
* // ➔ "ignoreAPIAndURL"
|
|
152
|
-
*
|
|
153
|
-
* // Set can also be used
|
|
154
|
-
* toCamelCase("ignore API and URL", new Set(["API", "URL"]));
|
|
155
|
-
* // ➔ "ignoreAPIAndURL"
|
|
156
|
-
*
|
|
157
|
-
* // Null, Undefined or empty (string or array) input returns empty string
|
|
158
|
-
* toCamelCase(null);
|
|
159
|
-
* // ➔ ""
|
|
160
|
-
*/
|
|
111
|
+
* * ***Utility: `toCamelCase`.***
|
|
112
|
+
* ----------------------------------------------------------
|
|
113
|
+
* **Converts a string (or array of strings) into `camelCase`, with optionally leaving specific words unchanged.**
|
|
114
|
+
* - **Behavior:**
|
|
115
|
+
* - Accepts a `string` or an `array of strings`:
|
|
116
|
+
* - If an array is provided, elements are trimmed, empty ones removed,
|
|
117
|
+
* then joined with `"-"` before conversion.
|
|
118
|
+
* - Splits the input by non-alphanumeric characters
|
|
119
|
+
* (spaces, punctuation, symbols, hyphens, underscores, emojis, etc.).
|
|
120
|
+
* - The first word is fully lowercase; subsequent words are capitalized.
|
|
121
|
+
* - Words listed in `ignoreWord` remain unchanged in the output.
|
|
122
|
+
* - `ignoreWord` is normalized (trimmed, delimiters removed), empty values ignored.
|
|
123
|
+
* - `ignoreWord` accepts:
|
|
124
|
+
* - a single string,
|
|
125
|
+
* - an array of strings, or
|
|
126
|
+
* - a `Set` of strings.
|
|
127
|
+
* - Multiple delimiters collapse into one; empty segments ignored.
|
|
128
|
+
* - Returns `""` if the input is `null`, `undefined`, or empty.
|
|
129
|
+
* @param {StringLike} input - The string or array to convert. Returns `""` if empty, `null`, or `undefined`.
|
|
130
|
+
* @param {StringCollection} [ignoreWord] - Optional word(s) to leave unchanged in the output.
|
|
131
|
+
* @returns {string} The camelCase formatted string.
|
|
132
|
+
* @example
|
|
133
|
+
* // Basic usage
|
|
134
|
+
* toCamelCase("hello world");
|
|
135
|
+
* // ➔ "helloWorld"
|
|
136
|
+
*
|
|
137
|
+
* // Array input is joined before conversion
|
|
138
|
+
* toCamelCase(["Join", "Words", "Here"]);
|
|
139
|
+
* // ➔ "joinWordsHere"
|
|
140
|
+
*
|
|
141
|
+
* // Supports mixed delimiters
|
|
142
|
+
* toCamelCase("convert_to-camel case");
|
|
143
|
+
* // ➔ "convertToCamelCase"
|
|
144
|
+
*
|
|
145
|
+
* // Words in ignoreWord stay unchanged
|
|
146
|
+
* toCamelCase("this URL path will ignore", "URL");
|
|
147
|
+
* // ➔ "thisURLPathWillIgnore"
|
|
148
|
+
*
|
|
149
|
+
* // Multiple ignored words
|
|
150
|
+
* toCamelCase("ignore API and URL", ["API", "URL"]);
|
|
151
|
+
* // ➔ "ignoreAPIAndURL"
|
|
152
|
+
*
|
|
153
|
+
* // Set can also be used
|
|
154
|
+
* toCamelCase("ignore API and URL", new Set(["API", "URL"]));
|
|
155
|
+
* // ➔ "ignoreAPIAndURL"
|
|
156
|
+
*
|
|
157
|
+
* // Null, Undefined or empty (string or array) input returns empty string
|
|
158
|
+
* toCamelCase(null);
|
|
159
|
+
* // ➔ ""
|
|
160
|
+
*/
|
|
161
161
|
declare const toCamelCase:(input:StringLike,ignoreWord?:StringCollection)=>string;
|
|
162
162
|
/** ----------------------------------------------------------
|
|
163
|
-
* * ***Utility: `toPascalCaseSpace`.***
|
|
164
|
-
* ----------------------------------------------------------
|
|
165
|
-
* **Converts a string (or array of strings) into `PascalCaseSpace`, with optionally leaving specific words unchanged.**
|
|
166
|
-
* - **Behavior:**
|
|
167
|
-
* - Accepts a `string` or an `array of strings`:
|
|
168
|
-
* - If an array is provided, elements are trimmed, empty ones removed,
|
|
169
|
-
* then joined with `"-"` before conversion.
|
|
170
|
-
* - Splits the input by non-alphanumeric characters
|
|
171
|
-
* (spaces, punctuation, symbols, hyphens, underscores, emojis, etc.).
|
|
172
|
-
* - The first word is fully lowercase; subsequent words are capitalized.
|
|
173
|
-
* - Words listed in `ignoreWord` remain unchanged in the output.
|
|
174
|
-
* - `ignoreWord` is normalized (trimmed, delimiters removed), empty values ignored.
|
|
175
|
-
* - `ignoreWord` accepts:
|
|
176
|
-
* - a single string,
|
|
177
|
-
* - an array of strings, or
|
|
178
|
-
* - a `Set` of strings.
|
|
179
|
-
* - Multiple delimiters collapse into one; empty segments ignored.
|
|
180
|
-
* - Returns `""` if the input is `null`, `undefined`, or empty.
|
|
181
|
-
* @param {StringLike} input - The string or array to convert. Returns `""` if empty, `null`, or `undefined`.
|
|
182
|
-
* @param {StringCollection} [ignoreWord] - Optional word(s) to leave unchanged in the output.
|
|
183
|
-
* @returns {string} The PascalCaseSpace formatted string.
|
|
184
|
-
* @example
|
|
185
|
-
* // Basic usage
|
|
186
|
-
* toPascalCaseSpace("hello world");
|
|
187
|
-
* // ➔ "Hello World"
|
|
188
|
-
*
|
|
189
|
-
* // Array input is joined before conversion
|
|
190
|
-
* toPascalCaseSpace(["Join", "Words", "Here"]);
|
|
191
|
-
* // ➔ "Join Words Here"
|
|
192
|
-
*
|
|
193
|
-
* // Handles underscores and hyphens
|
|
194
|
-
* toPascalCaseSpace("convert_to-pascal case");
|
|
195
|
-
* // ➔ "Convert To Pascal Case Space"
|
|
196
|
-
*
|
|
197
|
-
* // Trims extra delimiters
|
|
198
|
-
* toPascalCaseSpace("___hello--world__ again!!");
|
|
199
|
-
* // ➔ "Hello World Again"
|
|
200
|
-
*
|
|
201
|
-
* // Supports emojis and symbols
|
|
202
|
-
* toPascalCaseSpace("🔥fire_and-ice❄️");
|
|
203
|
-
* // ➔ "Fire And Ice"
|
|
204
|
-
*
|
|
205
|
-
* // Ignore single word
|
|
206
|
-
* toPascalCaseSpace("this URL path will ignore", "URL");
|
|
207
|
-
* // ➔ "This URL Path Will Ignore"
|
|
208
|
-
*
|
|
209
|
-
* // Ignore multiple words
|
|
210
|
-
* toPascalCaseSpace("ignore API and URL", ["API", "URL"]);
|
|
211
|
-
* // ➔ "Ignore API And URL"
|
|
212
|
-
*
|
|
213
|
-
* // Ignore using Set
|
|
214
|
-
* toPascalCaseSpace("ignore API and URL", new Set(["API", "URL"]));
|
|
215
|
-
* // ➔ "Ignore API And URL"
|
|
216
|
-
*
|
|
217
|
-
* // Null, Undefined or empty (string or array) input returns empty string
|
|
218
|
-
* toPascalCaseSpace(undefined);
|
|
219
|
-
* // ➔ ""
|
|
220
|
-
*/
|
|
163
|
+
* * ***Utility: `toPascalCaseSpace`.***
|
|
164
|
+
* ----------------------------------------------------------
|
|
165
|
+
* **Converts a string (or array of strings) into `PascalCaseSpace`, with optionally leaving specific words unchanged.**
|
|
166
|
+
* - **Behavior:**
|
|
167
|
+
* - Accepts a `string` or an `array of strings`:
|
|
168
|
+
* - If an array is provided, elements are trimmed, empty ones removed,
|
|
169
|
+
* then joined with `"-"` before conversion.
|
|
170
|
+
* - Splits the input by non-alphanumeric characters
|
|
171
|
+
* (spaces, punctuation, symbols, hyphens, underscores, emojis, etc.).
|
|
172
|
+
* - The first word is fully lowercase; subsequent words are capitalized.
|
|
173
|
+
* - Words listed in `ignoreWord` remain unchanged in the output.
|
|
174
|
+
* - `ignoreWord` is normalized (trimmed, delimiters removed), empty values ignored.
|
|
175
|
+
* - `ignoreWord` accepts:
|
|
176
|
+
* - a single string,
|
|
177
|
+
* - an array of strings, or
|
|
178
|
+
* - a `Set` of strings.
|
|
179
|
+
* - Multiple delimiters collapse into one; empty segments ignored.
|
|
180
|
+
* - Returns `""` if the input is `null`, `undefined`, or empty.
|
|
181
|
+
* @param {StringLike} input - The string or array to convert. Returns `""` if empty, `null`, or `undefined`.
|
|
182
|
+
* @param {StringCollection} [ignoreWord] - Optional word(s) to leave unchanged in the output.
|
|
183
|
+
* @returns {string} The PascalCaseSpace formatted string.
|
|
184
|
+
* @example
|
|
185
|
+
* // Basic usage
|
|
186
|
+
* toPascalCaseSpace("hello world");
|
|
187
|
+
* // ➔ "Hello World"
|
|
188
|
+
*
|
|
189
|
+
* // Array input is joined before conversion
|
|
190
|
+
* toPascalCaseSpace(["Join", "Words", "Here"]);
|
|
191
|
+
* // ➔ "Join Words Here"
|
|
192
|
+
*
|
|
193
|
+
* // Handles underscores and hyphens
|
|
194
|
+
* toPascalCaseSpace("convert_to-pascal case");
|
|
195
|
+
* // ➔ "Convert To Pascal Case Space"
|
|
196
|
+
*
|
|
197
|
+
* // Trims extra delimiters
|
|
198
|
+
* toPascalCaseSpace("___hello--world__ again!!");
|
|
199
|
+
* // ➔ "Hello World Again"
|
|
200
|
+
*
|
|
201
|
+
* // Supports emojis and symbols
|
|
202
|
+
* toPascalCaseSpace("🔥fire_and-ice❄️");
|
|
203
|
+
* // ➔ "Fire And Ice"
|
|
204
|
+
*
|
|
205
|
+
* // Ignore single word
|
|
206
|
+
* toPascalCaseSpace("this URL path will ignore", "URL");
|
|
207
|
+
* // ➔ "This URL Path Will Ignore"
|
|
208
|
+
*
|
|
209
|
+
* // Ignore multiple words
|
|
210
|
+
* toPascalCaseSpace("ignore API and URL", ["API", "URL"]);
|
|
211
|
+
* // ➔ "Ignore API And URL"
|
|
212
|
+
*
|
|
213
|
+
* // Ignore using Set
|
|
214
|
+
* toPascalCaseSpace("ignore API and URL", new Set(["API", "URL"]));
|
|
215
|
+
* // ➔ "Ignore API And URL"
|
|
216
|
+
*
|
|
217
|
+
* // Null, Undefined or empty (string or array) input returns empty string
|
|
218
|
+
* toPascalCaseSpace(undefined);
|
|
219
|
+
* // ➔ ""
|
|
220
|
+
*/
|
|
221
221
|
declare const toPascalCaseSpace:(input:StringLike,ignoreWord?:StringCollection)=>string;
|
|
222
222
|
/** ----------------------------------------------------------
|
|
223
|
-
* * ***Utility: `toPascalCase`.***
|
|
224
|
-
* ----------------------------------------------------------
|
|
225
|
-
* **Converts a string (or array of strings) into `PascalCase`, with optionally leaving specific words unchanged.**
|
|
226
|
-
* - **Behavior:**
|
|
227
|
-
* - Accepts a `string` or an `array of strings`:
|
|
228
|
-
* - If an array is provided, elements are trimmed, empty ones removed,
|
|
229
|
-
* then joined with `"-"` before conversion.
|
|
230
|
-
* - Splits the input by non-alphanumeric characters
|
|
231
|
-
* (spaces, punctuation, symbols, hyphens, underscores, emojis, etc.).
|
|
232
|
-
* - The first word is fully lowercase; subsequent words are capitalized.
|
|
233
|
-
* - Words listed in `ignoreWord` remain unchanged in the output.
|
|
234
|
-
* - `ignoreWord` is normalized (trimmed, delimiters removed), empty values ignored.
|
|
235
|
-
* - `ignoreWord` accepts:
|
|
236
|
-
* - a single string,
|
|
237
|
-
* - an array of strings, or
|
|
238
|
-
* - a `Set` of strings.
|
|
239
|
-
* - Multiple delimiters collapse into one; empty segments ignored.
|
|
240
|
-
* - Returns `""` if the input is `null`, `undefined`, or empty.
|
|
241
|
-
* @param {StringLike} input - The string or array to convert. Returns `""` if empty, `null`, or `undefined`.
|
|
242
|
-
* @param {StringCollection} [ignoreWord] - Optional word(s) to leave unchanged in the output.
|
|
243
|
-
* @returns {string} The PascalCase formatted string.
|
|
244
|
-
* @example
|
|
245
|
-
* // Basic usage
|
|
246
|
-
* toPascalCase("hello world");
|
|
247
|
-
* // ➔ "HelloWorld"
|
|
248
|
-
*
|
|
249
|
-
* // Array input is joined before conversion
|
|
250
|
-
* toPascalCase(["Join", "Words", "Here"]);
|
|
251
|
-
* // ➔ "JoinWordsHere"
|
|
252
|
-
*
|
|
253
|
-
* // Handles underscores and hyphens
|
|
254
|
-
* toPascalCase("convert_to-pascal case");
|
|
255
|
-
* // ➔ "ConvertToPascalCase"
|
|
256
|
-
*
|
|
257
|
-
* // Trims extra delimiters
|
|
258
|
-
* toPascalCase("___hello--world__ again!!");
|
|
259
|
-
* // ➔ "HelloWorldAgain"
|
|
260
|
-
*
|
|
261
|
-
* // Supports emojis and symbols
|
|
262
|
-
* toPascalCase("🔥fire_and-ice❄️");
|
|
263
|
-
* // ➔ "FireAndIce"
|
|
264
|
-
*
|
|
265
|
-
* // Ignore single word
|
|
266
|
-
* toPascalCase("this URL path will ignore", "URL");
|
|
267
|
-
* // ➔ "ThisURLPathWillIgnore"
|
|
268
|
-
*
|
|
269
|
-
* // Ignore multiple words
|
|
270
|
-
* toPascalCase("ignore API and URL", ["API", "URL"]);
|
|
271
|
-
* // ➔ "IgnoreAPIAndURL"
|
|
272
|
-
*
|
|
273
|
-
* // Ignore using Set
|
|
274
|
-
* toPascalCase("ignore API and URL", new Set(["API", "URL"]));
|
|
275
|
-
* // ➔ "IgnoreAPIAndURL"
|
|
276
|
-
*
|
|
277
|
-
* // Null, Undefined or empty (string or array) input returns empty string
|
|
278
|
-
* toPascalCase(undefined);
|
|
279
|
-
* // ➔ ""
|
|
280
|
-
*/
|
|
223
|
+
* * ***Utility: `toPascalCase`.***
|
|
224
|
+
* ----------------------------------------------------------
|
|
225
|
+
* **Converts a string (or array of strings) into `PascalCase`, with optionally leaving specific words unchanged.**
|
|
226
|
+
* - **Behavior:**
|
|
227
|
+
* - Accepts a `string` or an `array of strings`:
|
|
228
|
+
* - If an array is provided, elements are trimmed, empty ones removed,
|
|
229
|
+
* then joined with `"-"` before conversion.
|
|
230
|
+
* - Splits the input by non-alphanumeric characters
|
|
231
|
+
* (spaces, punctuation, symbols, hyphens, underscores, emojis, etc.).
|
|
232
|
+
* - The first word is fully lowercase; subsequent words are capitalized.
|
|
233
|
+
* - Words listed in `ignoreWord` remain unchanged in the output.
|
|
234
|
+
* - `ignoreWord` is normalized (trimmed, delimiters removed), empty values ignored.
|
|
235
|
+
* - `ignoreWord` accepts:
|
|
236
|
+
* - a single string,
|
|
237
|
+
* - an array of strings, or
|
|
238
|
+
* - a `Set` of strings.
|
|
239
|
+
* - Multiple delimiters collapse into one; empty segments ignored.
|
|
240
|
+
* - Returns `""` if the input is `null`, `undefined`, or empty.
|
|
241
|
+
* @param {StringLike} input - The string or array to convert. Returns `""` if empty, `null`, or `undefined`.
|
|
242
|
+
* @param {StringCollection} [ignoreWord] - Optional word(s) to leave unchanged in the output.
|
|
243
|
+
* @returns {string} The PascalCase formatted string.
|
|
244
|
+
* @example
|
|
245
|
+
* // Basic usage
|
|
246
|
+
* toPascalCase("hello world");
|
|
247
|
+
* // ➔ "HelloWorld"
|
|
248
|
+
*
|
|
249
|
+
* // Array input is joined before conversion
|
|
250
|
+
* toPascalCase(["Join", "Words", "Here"]);
|
|
251
|
+
* // ➔ "JoinWordsHere"
|
|
252
|
+
*
|
|
253
|
+
* // Handles underscores and hyphens
|
|
254
|
+
* toPascalCase("convert_to-pascal case");
|
|
255
|
+
* // ➔ "ConvertToPascalCase"
|
|
256
|
+
*
|
|
257
|
+
* // Trims extra delimiters
|
|
258
|
+
* toPascalCase("___hello--world__ again!!");
|
|
259
|
+
* // ➔ "HelloWorldAgain"
|
|
260
|
+
*
|
|
261
|
+
* // Supports emojis and symbols
|
|
262
|
+
* toPascalCase("🔥fire_and-ice❄️");
|
|
263
|
+
* // ➔ "FireAndIce"
|
|
264
|
+
*
|
|
265
|
+
* // Ignore single word
|
|
266
|
+
* toPascalCase("this URL path will ignore", "URL");
|
|
267
|
+
* // ➔ "ThisURLPathWillIgnore"
|
|
268
|
+
*
|
|
269
|
+
* // Ignore multiple words
|
|
270
|
+
* toPascalCase("ignore API and URL", ["API", "URL"]);
|
|
271
|
+
* // ➔ "IgnoreAPIAndURL"
|
|
272
|
+
*
|
|
273
|
+
* // Ignore using Set
|
|
274
|
+
* toPascalCase("ignore API and URL", new Set(["API", "URL"]));
|
|
275
|
+
* // ➔ "IgnoreAPIAndURL"
|
|
276
|
+
*
|
|
277
|
+
* // Null, Undefined or empty (string or array) input returns empty string
|
|
278
|
+
* toPascalCase(undefined);
|
|
279
|
+
* // ➔ ""
|
|
280
|
+
*/
|
|
281
281
|
declare const toPascalCase:(input:StringLike,ignoreWord?:StringCollection)=>string;
|
|
282
282
|
/** ----------------------------------------------------------
|
|
283
|
-
* * ***Utility: `toLowerCase`.***
|
|
284
|
-
* ----------------------------------------------------------
|
|
285
|
-
* **Converts a string (or array of strings) into `lower case`, with optionally leaving specific words unchanged.**
|
|
286
|
-
* - **Behavior:**
|
|
287
|
-
* - Accepts a `string` or an `array of strings`:
|
|
288
|
-
* - If an array is provided, elements are trimmed, empty ones removed,
|
|
289
|
-
* then joined with `"-"` before conversion.
|
|
290
|
-
* - Splits the input by non-alphanumeric characters
|
|
291
|
-
* (spaces, punctuation, symbols, hyphens, underscores, emojis, etc.).
|
|
292
|
-
* - The first word is fully lowercase; subsequent words are capitalized.
|
|
293
|
-
* - Words listed in `ignoreWord` remain unchanged in the output.
|
|
294
|
-
* - `ignoreWord` is normalized (trimmed, delimiters removed), empty values ignored.
|
|
295
|
-
* - `ignoreWord` accepts:
|
|
296
|
-
* - a single string,
|
|
297
|
-
* - an array of strings, or
|
|
298
|
-
* - a `Set` of strings.
|
|
299
|
-
* - Multiple delimiters collapse into one; empty segments ignored.
|
|
300
|
-
* - Returns `""` if the input is `null`, `undefined`, or empty.
|
|
301
|
-
* @param {StringLike} input - The string or array to convert. Returns `""` if empty, `null`, or `undefined`.
|
|
302
|
-
* @param {StringCollection} [ignoreWord] - Optional word(s) to leave unchanged in the output.
|
|
303
|
-
* @returns {string} The LowerCase formatted string.
|
|
304
|
-
* @example
|
|
305
|
-
* // Basic usage
|
|
306
|
-
* toLowerCase("Hello World");
|
|
307
|
-
* // ➔ "hello world"
|
|
308
|
-
*
|
|
309
|
-
* // Array input is joined before conversion
|
|
310
|
-
* toLowerCase(["Join", "WORLD", "Here"]);
|
|
311
|
-
* // ➔ "join words here"
|
|
312
|
-
*
|
|
313
|
-
* // Handles underscores and hyphens
|
|
314
|
-
* toLowerCase("convert_to-pascal case");
|
|
315
|
-
* // ➔ "convert to lower case"
|
|
316
|
-
*
|
|
317
|
-
* // Trims extra delimiters
|
|
318
|
-
* toLowerCase("___hello--world__ again!!");
|
|
319
|
-
* // ➔ "hello world again"
|
|
320
|
-
*
|
|
321
|
-
* // Supports emojis and symbols
|
|
322
|
-
* toLowerCase("🔥fire_and-ice❄️");
|
|
323
|
-
* // ➔ "fire and ice"
|
|
324
|
-
*
|
|
325
|
-
* // Ignore single word
|
|
326
|
-
* toLowerCase("this URL path will ignore", "URL");
|
|
327
|
-
* // ➔ "this URL path will ignore"
|
|
328
|
-
*
|
|
329
|
-
* // Ignore multiple words
|
|
330
|
-
* toLowerCase("ignore API and URL", ["API", "URL"]);
|
|
331
|
-
* // ➔ "ignore API and URL"
|
|
332
|
-
*
|
|
333
|
-
* // Ignore using Set
|
|
334
|
-
* toLowerCase("ignore API and URL", new Set(["API", "URL"]));
|
|
335
|
-
* // ➔ "ignore API and URL"
|
|
336
|
-
*
|
|
337
|
-
* // Null, Undefined or empty (string or array) input returns empty string
|
|
338
|
-
* toLowerCase(undefined);
|
|
339
|
-
* // ➔ ""
|
|
340
|
-
*/
|
|
283
|
+
* * ***Utility: `toLowerCase`.***
|
|
284
|
+
* ----------------------------------------------------------
|
|
285
|
+
* **Converts a string (or array of strings) into `lower case`, with optionally leaving specific words unchanged.**
|
|
286
|
+
* - **Behavior:**
|
|
287
|
+
* - Accepts a `string` or an `array of strings`:
|
|
288
|
+
* - If an array is provided, elements are trimmed, empty ones removed,
|
|
289
|
+
* then joined with `"-"` before conversion.
|
|
290
|
+
* - Splits the input by non-alphanumeric characters
|
|
291
|
+
* (spaces, punctuation, symbols, hyphens, underscores, emojis, etc.).
|
|
292
|
+
* - The first word is fully lowercase; subsequent words are capitalized.
|
|
293
|
+
* - Words listed in `ignoreWord` remain unchanged in the output.
|
|
294
|
+
* - `ignoreWord` is normalized (trimmed, delimiters removed), empty values ignored.
|
|
295
|
+
* - `ignoreWord` accepts:
|
|
296
|
+
* - a single string,
|
|
297
|
+
* - an array of strings, or
|
|
298
|
+
* - a `Set` of strings.
|
|
299
|
+
* - Multiple delimiters collapse into one; empty segments ignored.
|
|
300
|
+
* - Returns `""` if the input is `null`, `undefined`, or empty.
|
|
301
|
+
* @param {StringLike} input - The string or array to convert. Returns `""` if empty, `null`, or `undefined`.
|
|
302
|
+
* @param {StringCollection} [ignoreWord] - Optional word(s) to leave unchanged in the output.
|
|
303
|
+
* @returns {string} The LowerCase formatted string.
|
|
304
|
+
* @example
|
|
305
|
+
* // Basic usage
|
|
306
|
+
* toLowerCase("Hello World");
|
|
307
|
+
* // ➔ "hello world"
|
|
308
|
+
*
|
|
309
|
+
* // Array input is joined before conversion
|
|
310
|
+
* toLowerCase(["Join", "WORLD", "Here"]);
|
|
311
|
+
* // ➔ "join words here"
|
|
312
|
+
*
|
|
313
|
+
* // Handles underscores and hyphens
|
|
314
|
+
* toLowerCase("convert_to-pascal case");
|
|
315
|
+
* // ➔ "convert to lower case"
|
|
316
|
+
*
|
|
317
|
+
* // Trims extra delimiters
|
|
318
|
+
* toLowerCase("___hello--world__ again!!");
|
|
319
|
+
* // ➔ "hello world again"
|
|
320
|
+
*
|
|
321
|
+
* // Supports emojis and symbols
|
|
322
|
+
* toLowerCase("🔥fire_and-ice❄️");
|
|
323
|
+
* // ➔ "fire and ice"
|
|
324
|
+
*
|
|
325
|
+
* // Ignore single word
|
|
326
|
+
* toLowerCase("this URL path will ignore", "URL");
|
|
327
|
+
* // ➔ "this URL path will ignore"
|
|
328
|
+
*
|
|
329
|
+
* // Ignore multiple words
|
|
330
|
+
* toLowerCase("ignore API and URL", ["API", "URL"]);
|
|
331
|
+
* // ➔ "ignore API and URL"
|
|
332
|
+
*
|
|
333
|
+
* // Ignore using Set
|
|
334
|
+
* toLowerCase("ignore API and URL", new Set(["API", "URL"]));
|
|
335
|
+
* // ➔ "ignore API and URL"
|
|
336
|
+
*
|
|
337
|
+
* // Null, Undefined or empty (string or array) input returns empty string
|
|
338
|
+
* toLowerCase(undefined);
|
|
339
|
+
* // ➔ ""
|
|
340
|
+
*/
|
|
341
341
|
declare const toLowerCase:(input:StringLike,ignoreWord?:StringCollection)=>string;
|
|
342
342
|
/** ----------------------------------------------------------
|
|
343
|
-
* * ***Utility: `toKebabCase`.***
|
|
344
|
-
* ----------------------------------------------------------
|
|
345
|
-
* **Converts a string (or array of strings) into `kebab-case`, with optionally leaving specific words unchanged.**
|
|
346
|
-
* - **Behavior:**
|
|
347
|
-
* - Accepts a `string` or an `array of strings`:
|
|
348
|
-
* - If an array is provided, elements are trimmed, empty ones removed,
|
|
349
|
-
* then joined with `"-"` before conversion.
|
|
350
|
-
* - Splits the input by non-alphanumeric characters
|
|
351
|
-
* (spaces, punctuation, symbols, hyphens, underscores, emojis, etc.).
|
|
352
|
-
* - The first word is fully lowercase; subsequent words are capitalized.
|
|
353
|
-
* - Words listed in `ignoreWord` remain unchanged in the output.
|
|
354
|
-
* - `ignoreWord` is normalized (trimmed, delimiters removed), empty values ignored.
|
|
355
|
-
* - `ignoreWord` accepts:
|
|
356
|
-
* - a single string,
|
|
357
|
-
* - an array of strings, or
|
|
358
|
-
* - a `Set` of strings.
|
|
359
|
-
* - Multiple delimiters collapse into one; empty segments ignored.
|
|
360
|
-
* - Returns `""` if the input is `null`, `undefined`, or empty.
|
|
361
|
-
* @param {StringLike} input - The string or array to convert. Returns `""` if empty, `null`, or `undefined`.
|
|
362
|
-
* @param {StringCollection} [ignoreWord] - Optional word(s) to leave unchanged in the output.
|
|
363
|
-
* @returns {string} The kebab-case formatted string.
|
|
364
|
-
* @example
|
|
365
|
-
* // Basic usage
|
|
366
|
-
* toKebabCase("Hello World");
|
|
367
|
-
* // ➔ "hello-world"
|
|
368
|
-
*
|
|
369
|
-
* // Array input is joined before conversion
|
|
370
|
-
* toKebabCase(["Join", "Words", "Here"]);
|
|
371
|
-
* // ➔ "join-words-here"
|
|
372
|
-
*
|
|
373
|
-
* // Handles underscores and hyphens
|
|
374
|
-
* toKebabCase("convert_to-kebab case");
|
|
375
|
-
* // ➔ "convert-to-kebab-case"
|
|
376
|
-
*
|
|
377
|
-
* // Handles emojis and symbols
|
|
378
|
-
* toKebabCase("🔥fire___and--ice❄️");
|
|
379
|
-
* // ➔ "fire-and-ice"
|
|
380
|
-
*
|
|
381
|
-
* // Ignore specific word
|
|
382
|
-
* toKebabCase("ignore URL case", "URL");
|
|
383
|
-
* // ➔ "ignore-URL-case"
|
|
384
|
-
*
|
|
385
|
-
* // Ignore multiple words
|
|
386
|
-
* toKebabCase("ignore API and URL", ["API", "URL"]);
|
|
387
|
-
* // ➔ "ignore-API-and-URL"
|
|
388
|
-
*
|
|
389
|
-
* // Ignore with Set
|
|
390
|
-
* toKebabCase("ignore API and URL", new Set(["API", "URL"]));
|
|
391
|
-
* // ➔ "ignore-API-and-URL"
|
|
392
|
-
*
|
|
393
|
-
* // Null, Undefined or empty (string or array) input returns empty string
|
|
394
|
-
* toKebabCase(null);
|
|
395
|
-
* // ➔ ""
|
|
396
|
-
*/
|
|
343
|
+
* * ***Utility: `toKebabCase`.***
|
|
344
|
+
* ----------------------------------------------------------
|
|
345
|
+
* **Converts a string (or array of strings) into `kebab-case`, with optionally leaving specific words unchanged.**
|
|
346
|
+
* - **Behavior:**
|
|
347
|
+
* - Accepts a `string` or an `array of strings`:
|
|
348
|
+
* - If an array is provided, elements are trimmed, empty ones removed,
|
|
349
|
+
* then joined with `"-"` before conversion.
|
|
350
|
+
* - Splits the input by non-alphanumeric characters
|
|
351
|
+
* (spaces, punctuation, symbols, hyphens, underscores, emojis, etc.).
|
|
352
|
+
* - The first word is fully lowercase; subsequent words are capitalized.
|
|
353
|
+
* - Words listed in `ignoreWord` remain unchanged in the output.
|
|
354
|
+
* - `ignoreWord` is normalized (trimmed, delimiters removed), empty values ignored.
|
|
355
|
+
* - `ignoreWord` accepts:
|
|
356
|
+
* - a single string,
|
|
357
|
+
* - an array of strings, or
|
|
358
|
+
* - a `Set` of strings.
|
|
359
|
+
* - Multiple delimiters collapse into one; empty segments ignored.
|
|
360
|
+
* - Returns `""` if the input is `null`, `undefined`, or empty.
|
|
361
|
+
* @param {StringLike} input - The string or array to convert. Returns `""` if empty, `null`, or `undefined`.
|
|
362
|
+
* @param {StringCollection} [ignoreWord] - Optional word(s) to leave unchanged in the output.
|
|
363
|
+
* @returns {string} The kebab-case formatted string.
|
|
364
|
+
* @example
|
|
365
|
+
* // Basic usage
|
|
366
|
+
* toKebabCase("Hello World");
|
|
367
|
+
* // ➔ "hello-world"
|
|
368
|
+
*
|
|
369
|
+
* // Array input is joined before conversion
|
|
370
|
+
* toKebabCase(["Join", "Words", "Here"]);
|
|
371
|
+
* // ➔ "join-words-here"
|
|
372
|
+
*
|
|
373
|
+
* // Handles underscores and hyphens
|
|
374
|
+
* toKebabCase("convert_to-kebab case");
|
|
375
|
+
* // ➔ "convert-to-kebab-case"
|
|
376
|
+
*
|
|
377
|
+
* // Handles emojis and symbols
|
|
378
|
+
* toKebabCase("🔥fire___and--ice❄️");
|
|
379
|
+
* // ➔ "fire-and-ice"
|
|
380
|
+
*
|
|
381
|
+
* // Ignore specific word
|
|
382
|
+
* toKebabCase("ignore URL case", "URL");
|
|
383
|
+
* // ➔ "ignore-URL-case"
|
|
384
|
+
*
|
|
385
|
+
* // Ignore multiple words
|
|
386
|
+
* toKebabCase("ignore API and URL", ["API", "URL"]);
|
|
387
|
+
* // ➔ "ignore-API-and-URL"
|
|
388
|
+
*
|
|
389
|
+
* // Ignore with Set
|
|
390
|
+
* toKebabCase("ignore API and URL", new Set(["API", "URL"]));
|
|
391
|
+
* // ➔ "ignore-API-and-URL"
|
|
392
|
+
*
|
|
393
|
+
* // Null, Undefined or empty (string or array) input returns empty string
|
|
394
|
+
* toKebabCase(null);
|
|
395
|
+
* // ➔ ""
|
|
396
|
+
*/
|
|
397
397
|
declare const toKebabCase:(input:StringLike,ignoreWord?:StringCollection)=>string;
|
|
398
398
|
/** ----------------------------------------------------------
|
|
399
|
-
* * ***Utility: `toSnakeCase`.***
|
|
400
|
-
* ----------------------------------------------------------
|
|
401
|
-
* **Converts a string (or array of strings) into `snake_case`, with optionally leaving specific words unchanged.**
|
|
402
|
-
* - **Behavior:**
|
|
403
|
-
* - Accepts a `string` or an `array of strings`:
|
|
404
|
-
* - If an array is provided, elements are trimmed, empty ones removed,
|
|
405
|
-
* then joined with `"-"` before conversion.
|
|
406
|
-
* - Splits the input by non-alphanumeric characters
|
|
407
|
-
* (spaces, punctuation, symbols, hyphens, underscores, emojis, etc.).
|
|
408
|
-
* - The first word is fully lowercase; subsequent words are capitalized.
|
|
409
|
-
* - Words listed in `ignoreWord` remain unchanged in the output.
|
|
410
|
-
* - `ignoreWord` is normalized (trimmed, delimiters removed), empty values ignored.
|
|
411
|
-
* - `ignoreWord` accepts:
|
|
412
|
-
* - a single string,
|
|
413
|
-
* - an array of strings, or
|
|
414
|
-
* - a `Set` of strings.
|
|
415
|
-
* - Multiple delimiters collapse into one; empty segments ignored.
|
|
416
|
-
* - Returns `""` if the input is `null`, `undefined`, or empty.
|
|
417
|
-
* @param {StringLike} input - The string or array to convert. Returns `""` if empty, `null`, or `undefined`.
|
|
418
|
-
* @param {StringCollection} [ignoreWord] - Optional word(s) to leave unchanged in the output.
|
|
419
|
-
* @returns {string} The snake_case formatted string.
|
|
420
|
-
* @example
|
|
421
|
-
* // Basic usage
|
|
422
|
-
* toSnakeCase("Hello World");
|
|
423
|
-
* // ➔ "hello_world"
|
|
424
|
-
*
|
|
425
|
-
* // Array input is joined before conversion
|
|
426
|
-
* toSnakeCase(["Join", "Words", "Here"]);
|
|
427
|
-
* // ➔ "join_words_here"
|
|
428
|
-
*
|
|
429
|
-
* // Handles underscores, hyphens, spaces
|
|
430
|
-
* toSnakeCase("convert-to_snake case");
|
|
431
|
-
* // ➔ "convert_to_snake_case"
|
|
432
|
-
*
|
|
433
|
-
* // Handles emojis and symbols
|
|
434
|
-
* toSnakeCase("🔥fire___and--ice❄️");
|
|
435
|
-
* // ➔ "fire_and_ice"
|
|
436
|
-
*
|
|
437
|
-
* // Ignore specific word
|
|
438
|
-
* toSnakeCase("ignore URL case", "URL");
|
|
439
|
-
* // ➔ "ignore_URL_case"
|
|
440
|
-
*
|
|
441
|
-
* // Ignore multiple words
|
|
442
|
-
* toSnakeCase("ignore API and URL", ["API", "URL"]);
|
|
443
|
-
* // ➔ "ignore_API_and_URL"
|
|
444
|
-
*
|
|
445
|
-
* // Ignore with Set
|
|
446
|
-
* toSnakeCase("ignore API and URL", new Set(["API", "URL"]));
|
|
447
|
-
* // ➔ "ignore_API_and_URL"
|
|
448
|
-
*
|
|
449
|
-
* // Null, Undefined or empty (string or array) input returns empty string
|
|
450
|
-
* toSnakeCase(null);
|
|
451
|
-
* // ➔ ""
|
|
452
|
-
*/
|
|
399
|
+
* * ***Utility: `toSnakeCase`.***
|
|
400
|
+
* ----------------------------------------------------------
|
|
401
|
+
* **Converts a string (or array of strings) into `snake_case`, with optionally leaving specific words unchanged.**
|
|
402
|
+
* - **Behavior:**
|
|
403
|
+
* - Accepts a `string` or an `array of strings`:
|
|
404
|
+
* - If an array is provided, elements are trimmed, empty ones removed,
|
|
405
|
+
* then joined with `"-"` before conversion.
|
|
406
|
+
* - Splits the input by non-alphanumeric characters
|
|
407
|
+
* (spaces, punctuation, symbols, hyphens, underscores, emojis, etc.).
|
|
408
|
+
* - The first word is fully lowercase; subsequent words are capitalized.
|
|
409
|
+
* - Words listed in `ignoreWord` remain unchanged in the output.
|
|
410
|
+
* - `ignoreWord` is normalized (trimmed, delimiters removed), empty values ignored.
|
|
411
|
+
* - `ignoreWord` accepts:
|
|
412
|
+
* - a single string,
|
|
413
|
+
* - an array of strings, or
|
|
414
|
+
* - a `Set` of strings.
|
|
415
|
+
* - Multiple delimiters collapse into one; empty segments ignored.
|
|
416
|
+
* - Returns `""` if the input is `null`, `undefined`, or empty.
|
|
417
|
+
* @param {StringLike} input - The string or array to convert. Returns `""` if empty, `null`, or `undefined`.
|
|
418
|
+
* @param {StringCollection} [ignoreWord] - Optional word(s) to leave unchanged in the output.
|
|
419
|
+
* @returns {string} The snake_case formatted string.
|
|
420
|
+
* @example
|
|
421
|
+
* // Basic usage
|
|
422
|
+
* toSnakeCase("Hello World");
|
|
423
|
+
* // ➔ "hello_world"
|
|
424
|
+
*
|
|
425
|
+
* // Array input is joined before conversion
|
|
426
|
+
* toSnakeCase(["Join", "Words", "Here"]);
|
|
427
|
+
* // ➔ "join_words_here"
|
|
428
|
+
*
|
|
429
|
+
* // Handles underscores, hyphens, spaces
|
|
430
|
+
* toSnakeCase("convert-to_snake case");
|
|
431
|
+
* // ➔ "convert_to_snake_case"
|
|
432
|
+
*
|
|
433
|
+
* // Handles emojis and symbols
|
|
434
|
+
* toSnakeCase("🔥fire___and--ice❄️");
|
|
435
|
+
* // ➔ "fire_and_ice"
|
|
436
|
+
*
|
|
437
|
+
* // Ignore specific word
|
|
438
|
+
* toSnakeCase("ignore URL case", "URL");
|
|
439
|
+
* // ➔ "ignore_URL_case"
|
|
440
|
+
*
|
|
441
|
+
* // Ignore multiple words
|
|
442
|
+
* toSnakeCase("ignore API and URL", ["API", "URL"]);
|
|
443
|
+
* // ➔ "ignore_API_and_URL"
|
|
444
|
+
*
|
|
445
|
+
* // Ignore with Set
|
|
446
|
+
* toSnakeCase("ignore API and URL", new Set(["API", "URL"]));
|
|
447
|
+
* // ➔ "ignore_API_and_URL"
|
|
448
|
+
*
|
|
449
|
+
* // Null, Undefined or empty (string or array) input returns empty string
|
|
450
|
+
* toSnakeCase(null);
|
|
451
|
+
* // ➔ ""
|
|
452
|
+
*/
|
|
453
453
|
declare const toSnakeCase:(input:StringLike,ignoreWord?:StringCollection)=>string;
|
|
454
454
|
/** ----------------------------------------------------------
|
|
455
|
-
* * ***Utility: `toDotCase`.***
|
|
456
|
-
* ----------------------------------------------------------
|
|
457
|
-
* **Converts a string (or array of strings) into `dot.case`, with optionally leaving specific words unchanged.**
|
|
458
|
-
* - **Behavior:**
|
|
459
|
-
* - Accepts a `string` or an `array of strings`:
|
|
460
|
-
* - If an array is provided, elements are trimmed, empty ones removed,
|
|
461
|
-
* then joined with `"-"` before conversion.
|
|
462
|
-
* - Splits the input by non-alphanumeric characters
|
|
463
|
-
* (spaces, punctuation, symbols, hyphens, underscores, emojis, etc.).
|
|
464
|
-
* - The first word is fully lowercase; subsequent words are capitalized.
|
|
465
|
-
* - Words listed in `ignoreWord` remain unchanged in the output.
|
|
466
|
-
* - `ignoreWord` is normalized (trimmed, delimiters removed), empty values ignored.
|
|
467
|
-
* - `ignoreWord` accepts:
|
|
468
|
-
* - a single string,
|
|
469
|
-
* - an array of strings, or
|
|
470
|
-
* - a `Set` of strings.
|
|
471
|
-
* - Multiple delimiters collapse into one; empty segments ignored.
|
|
472
|
-
* - Returns `""` if the input is `null`, `undefined`, or empty.
|
|
473
|
-
* @param {StringLike} input - The string or array to convert. Returns `""` if empty, `null`, or `undefined`.
|
|
474
|
-
* @param {StringCollection} [ignoreWord] - Optional word(s) to leave unchanged in the output.
|
|
475
|
-
* @returns {string} The dot.case formatted string.
|
|
476
|
-
* @example
|
|
477
|
-
* // Basic usage
|
|
478
|
-
* toDotCase("Hello World");
|
|
479
|
-
* // ➔ "hello.world"
|
|
480
|
-
*
|
|
481
|
-
* // Array input is joined before conversion
|
|
482
|
-
* toDotCase(["Join", "Words", "Here"]);
|
|
483
|
-
* // ➔ "join.words.here"
|
|
484
|
-
*
|
|
485
|
-
* // Handles underscores and hyphens
|
|
486
|
-
* toDotCase("convert-to_dot case");
|
|
487
|
-
* // ➔ "convert.to.dot.case"
|
|
488
|
-
*
|
|
489
|
-
* // Multiple delimiters and trimming
|
|
490
|
-
* toDotCase("___Hello--World__ again!!");
|
|
491
|
-
* // ➔ "hello.world.again"
|
|
492
|
-
*
|
|
493
|
-
* // Supports emojis and symbols
|
|
494
|
-
* toDotCase("🔥Fire_and-ice❄️");
|
|
495
|
-
* // ➔ "fire.and.ice"
|
|
496
|
-
*
|
|
497
|
-
* // Ignore single word
|
|
498
|
-
* toDotCase("this URL path", "URL");
|
|
499
|
-
* // ➔ "this.URL.path"
|
|
500
|
-
*
|
|
501
|
-
* // Ignore multiple words
|
|
502
|
-
* toDotCase("ignore API and URL", ["API", "URL"]);
|
|
503
|
-
* // ➔ "ignore.API.and.URL"
|
|
504
|
-
*
|
|
505
|
-
* // Ignore using Set
|
|
506
|
-
* toDotCase("ignore API and URL", new Set(["API", "URL"]));
|
|
507
|
-
* // ➔ "ignore.API.and.URL"
|
|
508
|
-
*
|
|
509
|
-
* // Null, Undefined or empty (string or array) input returns empty string
|
|
510
|
-
* toDotCase(undefined);
|
|
511
|
-
* // ➔ ""
|
|
512
|
-
*/
|
|
455
|
+
* * ***Utility: `toDotCase`.***
|
|
456
|
+
* ----------------------------------------------------------
|
|
457
|
+
* **Converts a string (or array of strings) into `dot.case`, with optionally leaving specific words unchanged.**
|
|
458
|
+
* - **Behavior:**
|
|
459
|
+
* - Accepts a `string` or an `array of strings`:
|
|
460
|
+
* - If an array is provided, elements are trimmed, empty ones removed,
|
|
461
|
+
* then joined with `"-"` before conversion.
|
|
462
|
+
* - Splits the input by non-alphanumeric characters
|
|
463
|
+
* (spaces, punctuation, symbols, hyphens, underscores, emojis, etc.).
|
|
464
|
+
* - The first word is fully lowercase; subsequent words are capitalized.
|
|
465
|
+
* - Words listed in `ignoreWord` remain unchanged in the output.
|
|
466
|
+
* - `ignoreWord` is normalized (trimmed, delimiters removed), empty values ignored.
|
|
467
|
+
* - `ignoreWord` accepts:
|
|
468
|
+
* - a single string,
|
|
469
|
+
* - an array of strings, or
|
|
470
|
+
* - a `Set` of strings.
|
|
471
|
+
* - Multiple delimiters collapse into one; empty segments ignored.
|
|
472
|
+
* - Returns `""` if the input is `null`, `undefined`, or empty.
|
|
473
|
+
* @param {StringLike} input - The string or array to convert. Returns `""` if empty, `null`, or `undefined`.
|
|
474
|
+
* @param {StringCollection} [ignoreWord] - Optional word(s) to leave unchanged in the output.
|
|
475
|
+
* @returns {string} The dot.case formatted string.
|
|
476
|
+
* @example
|
|
477
|
+
* // Basic usage
|
|
478
|
+
* toDotCase("Hello World");
|
|
479
|
+
* // ➔ "hello.world"
|
|
480
|
+
*
|
|
481
|
+
* // Array input is joined before conversion
|
|
482
|
+
* toDotCase(["Join", "Words", "Here"]);
|
|
483
|
+
* // ➔ "join.words.here"
|
|
484
|
+
*
|
|
485
|
+
* // Handles underscores and hyphens
|
|
486
|
+
* toDotCase("convert-to_dot case");
|
|
487
|
+
* // ➔ "convert.to.dot.case"
|
|
488
|
+
*
|
|
489
|
+
* // Multiple delimiters and trimming
|
|
490
|
+
* toDotCase("___Hello--World__ again!!");
|
|
491
|
+
* // ➔ "hello.world.again"
|
|
492
|
+
*
|
|
493
|
+
* // Supports emojis and symbols
|
|
494
|
+
* toDotCase("🔥Fire_and-ice❄️");
|
|
495
|
+
* // ➔ "fire.and.ice"
|
|
496
|
+
*
|
|
497
|
+
* // Ignore single word
|
|
498
|
+
* toDotCase("this URL path", "URL");
|
|
499
|
+
* // ➔ "this.URL.path"
|
|
500
|
+
*
|
|
501
|
+
* // Ignore multiple words
|
|
502
|
+
* toDotCase("ignore API and URL", ["API", "URL"]);
|
|
503
|
+
* // ➔ "ignore.API.and.URL"
|
|
504
|
+
*
|
|
505
|
+
* // Ignore using Set
|
|
506
|
+
* toDotCase("ignore API and URL", new Set(["API", "URL"]));
|
|
507
|
+
* // ➔ "ignore.API.and.URL"
|
|
508
|
+
*
|
|
509
|
+
* // Null, Undefined or empty (string or array) input returns empty string
|
|
510
|
+
* toDotCase(undefined);
|
|
511
|
+
* // ➔ ""
|
|
512
|
+
*/
|
|
513
513
|
declare const toDotCase:(input:StringLike,ignoreWord?:StringCollection)=>string;
|
|
514
514
|
/** ----------------------------------------------------------
|
|
515
|
-
* * ***Utility: `slugify`.***
|
|
516
|
-
* ----------------------------------------------------------
|
|
517
|
-
* **Slugifies a string (or array of strings) for safe use in URLs, with optionally leaving specific words unchanged.**
|
|
518
|
-
* - **Behavior:**
|
|
519
|
-
* - Accepts a `string` or an `array of strings`:
|
|
520
|
-
* - If an array is provided, elements are trimmed, empty ones removed,
|
|
521
|
-
* then joined with `"-"` before conversion.
|
|
522
|
-
* - Splits the input by non-alphanumeric characters
|
|
523
|
-
* (spaces, punctuation, symbols, hyphens, underscores, emojis, etc.).
|
|
524
|
-
* - The first word is fully lowercase; subsequent words are capitalized.
|
|
525
|
-
* - Words listed in `ignoreWord` remain unchanged in the output.
|
|
526
|
-
* - `ignoreWord` is normalized (trimmed, delimiters removed), empty values ignored.
|
|
527
|
-
* - `ignoreWord` accepts:
|
|
528
|
-
* - a single string,
|
|
529
|
-
* - an array of strings, or
|
|
530
|
-
* - a `Set` of strings.
|
|
531
|
-
* - Multiple delimiters collapse into one; empty segments ignored.
|
|
532
|
-
* - Returns `""` if the input is `null`, `undefined`, or empty.
|
|
533
|
-
* @param {StringLike} input - The string or array to convert. Returns `""` if empty, `null`, or `undefined`.
|
|
534
|
-
* @param {StringCollection} [ignoreWord] - Optional word(s) to leave unchanged in the output.
|
|
535
|
-
* @returns {string} The slugified string.
|
|
536
|
-
* @example
|
|
537
|
-
* // Basic usage
|
|
538
|
-
* slugify("Hello World!");
|
|
539
|
-
* // ➔ "hello-world"
|
|
540
|
-
*
|
|
541
|
-
* // Array input is joined before conversion
|
|
542
|
-
* slugify(["Join", "Words", "Here"]);
|
|
543
|
-
* // ➔ "join-words-here"
|
|
544
|
-
*
|
|
545
|
-
* // Trims and cleans input
|
|
546
|
-
* slugify(" --- Convert to Slug? --- ");
|
|
547
|
-
* // ➔ "convert-to-slug"
|
|
548
|
-
*
|
|
549
|
-
* // Ignore single word
|
|
550
|
-
* slugify("This URL path", "URL");
|
|
551
|
-
* // ➔ "this-URL-path"
|
|
552
|
-
*
|
|
553
|
-
* // Ignore multiple words
|
|
554
|
-
* slugify("ignore API and URL", ["API", "URL"]);
|
|
555
|
-
* // ➔ "ignore-API-and-URL"
|
|
556
|
-
*
|
|
557
|
-
* // Ignore using Set
|
|
558
|
-
* slugify("ignore API and URL", new Set(["API", "URL"]));
|
|
559
|
-
* // ➔ "ignore-API-and-URL"
|
|
560
|
-
*
|
|
561
|
-
* // Supports emojis and symbols
|
|
562
|
-
* slugify("🔥 Fire_and_ice ❄️");
|
|
563
|
-
* // ➔ "fire-and-ice"
|
|
564
|
-
*
|
|
565
|
-
* // Null, Undefined or empty (string or array) input returns empty string
|
|
566
|
-
* slugify(undefined);
|
|
567
|
-
* // ➔ ""
|
|
568
|
-
*/
|
|
515
|
+
* * ***Utility: `slugify`.***
|
|
516
|
+
* ----------------------------------------------------------
|
|
517
|
+
* **Slugifies a string (or array of strings) for safe use in URLs, with optionally leaving specific words unchanged.**
|
|
518
|
+
* - **Behavior:**
|
|
519
|
+
* - Accepts a `string` or an `array of strings`:
|
|
520
|
+
* - If an array is provided, elements are trimmed, empty ones removed,
|
|
521
|
+
* then joined with `"-"` before conversion.
|
|
522
|
+
* - Splits the input by non-alphanumeric characters
|
|
523
|
+
* (spaces, punctuation, symbols, hyphens, underscores, emojis, etc.).
|
|
524
|
+
* - The first word is fully lowercase; subsequent words are capitalized.
|
|
525
|
+
* - Words listed in `ignoreWord` remain unchanged in the output.
|
|
526
|
+
* - `ignoreWord` is normalized (trimmed, delimiters removed), empty values ignored.
|
|
527
|
+
* - `ignoreWord` accepts:
|
|
528
|
+
* - a single string,
|
|
529
|
+
* - an array of strings, or
|
|
530
|
+
* - a `Set` of strings.
|
|
531
|
+
* - Multiple delimiters collapse into one; empty segments ignored.
|
|
532
|
+
* - Returns `""` if the input is `null`, `undefined`, or empty.
|
|
533
|
+
* @param {StringLike} input - The string or array to convert. Returns `""` if empty, `null`, or `undefined`.
|
|
534
|
+
* @param {StringCollection} [ignoreWord] - Optional word(s) to leave unchanged in the output.
|
|
535
|
+
* @returns {string} The slugified string.
|
|
536
|
+
* @example
|
|
537
|
+
* // Basic usage
|
|
538
|
+
* slugify("Hello World!");
|
|
539
|
+
* // ➔ "hello-world"
|
|
540
|
+
*
|
|
541
|
+
* // Array input is joined before conversion
|
|
542
|
+
* slugify(["Join", "Words", "Here"]);
|
|
543
|
+
* // ➔ "join-words-here"
|
|
544
|
+
*
|
|
545
|
+
* // Trims and cleans input
|
|
546
|
+
* slugify(" --- Convert to Slug? --- ");
|
|
547
|
+
* // ➔ "convert-to-slug"
|
|
548
|
+
*
|
|
549
|
+
* // Ignore single word
|
|
550
|
+
* slugify("This URL path", "URL");
|
|
551
|
+
* // ➔ "this-URL-path"
|
|
552
|
+
*
|
|
553
|
+
* // Ignore multiple words
|
|
554
|
+
* slugify("ignore API and URL", ["API", "URL"]);
|
|
555
|
+
* // ➔ "ignore-API-and-URL"
|
|
556
|
+
*
|
|
557
|
+
* // Ignore using Set
|
|
558
|
+
* slugify("ignore API and URL", new Set(["API", "URL"]));
|
|
559
|
+
* // ➔ "ignore-API-and-URL"
|
|
560
|
+
*
|
|
561
|
+
* // Supports emojis and symbols
|
|
562
|
+
* slugify("🔥 Fire_and_ice ❄️");
|
|
563
|
+
* // ➔ "fire-and-ice"
|
|
564
|
+
*
|
|
565
|
+
* // Null, Undefined or empty (string or array) input returns empty string
|
|
566
|
+
* slugify(undefined);
|
|
567
|
+
* // ➔ ""
|
|
568
|
+
*/
|
|
569
569
|
declare const slugify:(input:StringLike,ignoreWord?:StringCollection)=>string;type NormalizeSpacesOptions={
|
|
570
570
|
/** If `true`, skips normalization and only trims whitespace from start & end, defaultValue: `false`.
|
|
571
|
-
*
|
|
572
|
-
* @default false
|
|
573
|
-
*/
|
|
571
|
+
*
|
|
572
|
+
* @default false
|
|
573
|
+
*/
|
|
574
574
|
trimOnly?:boolean;
|
|
575
575
|
/** If `false`, skips trimming value, defaultValue: `true`.
|
|
576
|
-
*
|
|
577
|
-
* @default true
|
|
578
|
-
*/
|
|
576
|
+
*
|
|
577
|
+
* @default true
|
|
578
|
+
*/
|
|
579
579
|
withTrim?:boolean;};
|
|
580
580
|
/** ----------------------------------------------------------
|
|
581
|
-
* * ***Utility: `normalizeSpaces`.***
|
|
582
|
-
* ----------------------------------------------------------
|
|
583
|
-
* **Normalizes whitespace in a string by reducing multiple spaces
|
|
584
|
-
* to a single space, optionally trims, or only trims based on options.**
|
|
585
|
-
* - **Behavior:**
|
|
586
|
-
* - Collapses all consecutive whitespace (spaces, tabs, newlines) into a single space.
|
|
587
|
-
* - Can trim leading/trailing spaces (default behavior), or preserve them with `withTrim: false`.
|
|
588
|
-
* - Can skip normalization entirely and only trim using `trimOnly: true`.
|
|
589
|
-
* - Returns an empty string if input is `null` or `undefined`.
|
|
590
|
-
* @param {string | null | undefined} value - The input string to be processed. If `null` or `undefined`, returns an empty string.
|
|
591
|
-
* @param {NormalizeSpacesOptions} [options] - Configuration options.
|
|
592
|
-
* @param {NormalizeSpacesOptions["trimOnly"]} [options.trimOnly=false] - If `true`, skips normalization and only trims the string.
|
|
593
|
-
* @param {NormalizeSpacesOptions["withTrim"]} [options.withTrim=true] - If `false`, preserves leading/trailing whitespace.
|
|
594
|
-
* @returns {string} The processed string.
|
|
595
|
-
* @example
|
|
596
|
-
* normalizeSpaces(" Hello World\tthis is\n\nok ");
|
|
597
|
-
* // ➔ "Hello World this is ok"
|
|
598
|
-
* normalizeSpaces(" Hello World\tthis is\n\nok ", { trimOnly: true });
|
|
599
|
-
* // ➔ "Hello World this is\n\nok"
|
|
600
|
-
* normalizeSpaces(" Hello World ", { withTrim: false });
|
|
601
|
-
* // ➔ " Hello World "
|
|
602
|
-
* normalizeSpaces(null);
|
|
603
|
-
* // ➔ ""
|
|
604
|
-
*/
|
|
581
|
+
* * ***Utility: `normalizeSpaces`.***
|
|
582
|
+
* ----------------------------------------------------------
|
|
583
|
+
* **Normalizes whitespace in a string by reducing multiple spaces
|
|
584
|
+
* to a single space, optionally trims, or only trims based on options.**
|
|
585
|
+
* - **Behavior:**
|
|
586
|
+
* - Collapses all consecutive whitespace (spaces, tabs, newlines) into a single space.
|
|
587
|
+
* - Can trim leading/trailing spaces (default behavior), or preserve them with `withTrim: false`.
|
|
588
|
+
* - Can skip normalization entirely and only trim using `trimOnly: true`.
|
|
589
|
+
* - Returns an empty string if input is `null` or `undefined`.
|
|
590
|
+
* @param {string | null | undefined} value - The input string to be processed. If `null` or `undefined`, returns an empty string.
|
|
591
|
+
* @param {NormalizeSpacesOptions} [options] - Configuration options.
|
|
592
|
+
* @param {NormalizeSpacesOptions["trimOnly"]} [options.trimOnly=false] - If `true`, skips normalization and only trims the string.
|
|
593
|
+
* @param {NormalizeSpacesOptions["withTrim"]} [options.withTrim=true] - If `false`, preserves leading/trailing whitespace.
|
|
594
|
+
* @returns {string} The processed string.
|
|
595
|
+
* @example
|
|
596
|
+
* normalizeSpaces(" Hello World\tthis is\n\nok ");
|
|
597
|
+
* // ➔ "Hello World this is ok"
|
|
598
|
+
* normalizeSpaces(" Hello World\tthis is\n\nok ", { trimOnly: true });
|
|
599
|
+
* // ➔ "Hello World this is\n\nok"
|
|
600
|
+
* normalizeSpaces(" Hello World ", { withTrim: false });
|
|
601
|
+
* // ➔ " Hello World "
|
|
602
|
+
* normalizeSpaces(null);
|
|
603
|
+
* // ➔ ""
|
|
604
|
+
*/
|
|
605
605
|
declare const normalizeSpaces:(value:string|null|undefined,options?:NormalizeSpacesOptions)=>string;
|
|
606
606
|
/** ----------------------------------------------------------
|
|
607
|
-
* * ***Utility: `normalizeString`.***
|
|
608
|
-
* ----------------------------------------------------------
|
|
609
|
-
* **Normalizes a string by ensuring it is a valid string and trimming whitespace.**
|
|
610
|
-
* - **Behavior:**
|
|
611
|
-
* - If the input is `undefined`, `null`, or an `empty string` after trimming,
|
|
612
|
-
* it returns an empty string `("")`.
|
|
613
|
-
* @param {string | undefined | null} input - The input string to be normalize. If `null` or `undefined`, returns an empty string.
|
|
614
|
-
* @returns {string} A trimmed string or an empty string if the input is invalid.
|
|
615
|
-
* @example
|
|
616
|
-
* normalizeString(" Hello World ");
|
|
617
|
-
* // ➔ "Hello World"
|
|
618
|
-
* normalizeString(" Hello World ");
|
|
619
|
-
* // ➔ "Hello World"
|
|
620
|
-
* normalizeString("");
|
|
621
|
-
* // ➔ ""
|
|
622
|
-
* normalizeString(null);
|
|
623
|
-
* // ➔ ""
|
|
624
|
-
* normalizeString(undefined);
|
|
625
|
-
* // ➔ ""
|
|
626
|
-
*/
|
|
607
|
+
* * ***Utility: `normalizeString`.***
|
|
608
|
+
* ----------------------------------------------------------
|
|
609
|
+
* **Normalizes a string by ensuring it is a valid string and trimming whitespace.**
|
|
610
|
+
* - **Behavior:**
|
|
611
|
+
* - If the input is `undefined`, `null`, or an `empty string` after trimming,
|
|
612
|
+
* it returns an empty string `("")`.
|
|
613
|
+
* @param {string | undefined | null} input - The input string to be normalize. If `null` or `undefined`, returns an empty string.
|
|
614
|
+
* @returns {string} A trimmed string or an empty string if the input is invalid.
|
|
615
|
+
* @example
|
|
616
|
+
* normalizeString(" Hello World ");
|
|
617
|
+
* // ➔ "Hello World"
|
|
618
|
+
* normalizeString(" Hello World ");
|
|
619
|
+
* // ➔ "Hello World"
|
|
620
|
+
* normalizeString("");
|
|
621
|
+
* // ➔ ""
|
|
622
|
+
* normalizeString(null);
|
|
623
|
+
* // ➔ ""
|
|
624
|
+
* normalizeString(undefined);
|
|
625
|
+
* // ➔ ""
|
|
626
|
+
*/
|
|
627
627
|
declare const normalizeString:(input:string|null|undefined)=>string;type RemoveSpacesOptions={
|
|
628
628
|
/** If `true`, only trims the string, defaultValue: `false`.
|
|
629
|
-
*
|
|
630
|
-
* @default false */
|
|
629
|
+
*
|
|
630
|
+
* @default false */
|
|
631
631
|
trimOnly?:boolean;};
|
|
632
632
|
/** ----------------------------------------------------------
|
|
633
|
-
* * ***Utility: `removeSpaces`.***
|
|
634
|
-
* ----------------------------------------------------------
|
|
635
|
-
* **Removes all spaces from a string or trims only, based on the options provided.**
|
|
636
|
-
* - **Behavior:**
|
|
637
|
-
* - If `trimOnly` is `true`, the string is simply trimmed.
|
|
638
|
-
* - Otherwise, removes **all spaces**, tabs, newlines, etc.
|
|
639
|
-
* - If the input is `null` or `undefined`, returns an empty string `("")`.
|
|
640
|
-
* @param {string | null | undefined} value - The input string to be processed. If `null` or `undefined`, returns an empty string.
|
|
641
|
-
* @param {RemoveSpacesOptions} [options] - The options object.
|
|
642
|
-
* @param {RemoveSpacesOptions["trimOnly"]} [options.trimOnly=false] - If `true`, only trims the string without removing spaces inside.
|
|
643
|
-
* @returns {string} The processed string.
|
|
644
|
-
* @example
|
|
645
|
-
* removeSpaces(" Hello World ");
|
|
646
|
-
* // ➔ "HelloWorld"
|
|
647
|
-
* removeSpaces(" Hello World ", { trimOnly: true });
|
|
648
|
-
* // ➔ "Hello World"
|
|
649
|
-
* removeSpaces(null);
|
|
650
|
-
* // ➔ ""
|
|
651
|
-
*/
|
|
633
|
+
* * ***Utility: `removeSpaces`.***
|
|
634
|
+
* ----------------------------------------------------------
|
|
635
|
+
* **Removes all spaces from a string or trims only, based on the options provided.**
|
|
636
|
+
* - **Behavior:**
|
|
637
|
+
* - If `trimOnly` is `true`, the string is simply trimmed.
|
|
638
|
+
* - Otherwise, removes **all spaces**, tabs, newlines, etc.
|
|
639
|
+
* - If the input is `null` or `undefined`, returns an empty string `("")`.
|
|
640
|
+
* @param {string | null | undefined} value - The input string to be processed. If `null` or `undefined`, returns an empty string.
|
|
641
|
+
* @param {RemoveSpacesOptions} [options] - The options object.
|
|
642
|
+
* @param {RemoveSpacesOptions["trimOnly"]} [options.trimOnly=false] - If `true`, only trims the string without removing spaces inside.
|
|
643
|
+
* @returns {string} The processed string.
|
|
644
|
+
* @example
|
|
645
|
+
* removeSpaces(" Hello World ");
|
|
646
|
+
* // ➔ "HelloWorld"
|
|
647
|
+
* removeSpaces(" Hello World ", { trimOnly: true });
|
|
648
|
+
* // ➔ "Hello World"
|
|
649
|
+
* removeSpaces(null);
|
|
650
|
+
* // ➔ ""
|
|
651
|
+
*/
|
|
652
652
|
declare const removeSpaces:(value:string|null|undefined,options?:RemoveSpacesOptions)=>string;
|
|
653
653
|
/** ----------------------------------------------------------
|
|
654
|
-
* * ***Utility: `stripHtmlTags`.***
|
|
655
|
-
* ----------------------------------------------------------
|
|
656
|
-
* **This function removes valid HTML tags (including nested and self-closing ones)
|
|
657
|
-
* by replacing them with spaces, then collapses multiple whitespaces into a single space.**
|
|
658
|
-
* - **It handles the following cases:**
|
|
659
|
-
* - If the input is not a string (`null`, `undefined`, or any non-string), it is returned as undefined.
|
|
660
|
-
* - If the input is an empty or whitespace-only string, it returns an empty string (`""`).
|
|
661
|
-
* - Otherwise, it returns the cleaned string with tags removed and normalized whitespace.
|
|
662
|
-
* @template T - Input string type (string | null | undefined).
|
|
663
|
-
* @param {string | null | undefined} input - A string potentially containing HTML tags.
|
|
664
|
-
* @returns {string | undefined} Cleaned string if input is string, or original input otherwise.
|
|
665
|
-
* @example
|
|
666
|
-
* stripHtmlTags("<p>Hello</p>");
|
|
667
|
-
* // ➔ "Hello"
|
|
668
|
-
* stripHtmlTags("<div><b>Bold</b> text</div>");
|
|
669
|
-
* // ➔ "Bold text"
|
|
670
|
-
* stripHtmlTags("Line<br/>Break");
|
|
671
|
-
* // ➔ "Line Break"
|
|
672
|
-
* stripHtmlTags("2 < 5 and 5 > 2");
|
|
673
|
-
* // ➔ "2 < 5 and 5 > 2"
|
|
674
|
-
* stripHtmlTags("");
|
|
675
|
-
* // ➔ ""
|
|
676
|
-
* stripHtmlTags(" ");
|
|
677
|
-
* // ➔ ""
|
|
678
|
-
* stripHtmlTags(null);
|
|
679
|
-
* // ➔ undefined
|
|
680
|
-
* stripHtmlTags(undefined);
|
|
681
|
-
* // ➔ undefined
|
|
682
|
-
*/
|
|
654
|
+
* * ***Utility: `stripHtmlTags`.***
|
|
655
|
+
* ----------------------------------------------------------
|
|
656
|
+
* **This function removes valid HTML tags (including nested and self-closing ones)
|
|
657
|
+
* by replacing them with spaces, then collapses multiple whitespaces into a single space.**
|
|
658
|
+
* - **It handles the following cases:**
|
|
659
|
+
* - If the input is not a string (`null`, `undefined`, or any non-string), it is returned as undefined.
|
|
660
|
+
* - If the input is an empty or whitespace-only string, it returns an empty string (`""`).
|
|
661
|
+
* - Otherwise, it returns the cleaned string with tags removed and normalized whitespace.
|
|
662
|
+
* @template T - Input string type (string | null | undefined).
|
|
663
|
+
* @param {string | null | undefined} input - A string potentially containing HTML tags.
|
|
664
|
+
* @returns {string | undefined} Cleaned string if input is string, or original input otherwise.
|
|
665
|
+
* @example
|
|
666
|
+
* stripHtmlTags("<p>Hello</p>");
|
|
667
|
+
* // ➔ "Hello"
|
|
668
|
+
* stripHtmlTags("<div><b>Bold</b> text</div>");
|
|
669
|
+
* // ➔ "Bold text"
|
|
670
|
+
* stripHtmlTags("Line<br/>Break");
|
|
671
|
+
* // ➔ "Line Break"
|
|
672
|
+
* stripHtmlTags("2 < 5 and 5 > 2");
|
|
673
|
+
* // ➔ "2 < 5 and 5 > 2"
|
|
674
|
+
* stripHtmlTags("");
|
|
675
|
+
* // ➔ ""
|
|
676
|
+
* stripHtmlTags(" ");
|
|
677
|
+
* // ➔ ""
|
|
678
|
+
* stripHtmlTags(null);
|
|
679
|
+
* // ➔ undefined
|
|
680
|
+
* stripHtmlTags(undefined);
|
|
681
|
+
* // ➔ undefined
|
|
682
|
+
*/
|
|
683
683
|
declare function stripHtmlTags(input:string):string;declare function stripHtmlTags<T>(input:T):Extends<string,T>extends true?string|undefined:undefined;
|
|
684
684
|
/** ----------------------------------------------------------
|
|
685
|
-
* * ***Utility: `replaceAt`.***
|
|
686
|
-
* ----------------------------------------------------------
|
|
687
|
-
* **Replaces exactly one character at the specified index in the original string
|
|
688
|
-
* with the provided `replaceTo` string.**
|
|
689
|
-
* - **Behavior:**
|
|
690
|
-
* - If `replaceTo` has more than one character,
|
|
691
|
-
* the result will expand accordingly.
|
|
692
|
-
* @param {number} index - The starting index where the replacement should occur.
|
|
693
|
-
* @param {string} originalString - The original string to modify.
|
|
694
|
-
* @param {string} replaceTo - The string to insert at the specified index.
|
|
695
|
-
* @returns {string} The modified string with the replacement applied.
|
|
696
|
-
* @example
|
|
697
|
-
* replaceAt(3, "hello", "X");
|
|
698
|
-
* // ➔ "helXo"
|
|
699
|
-
* replaceAt(1, "world", "AB");
|
|
700
|
-
* // ➔ "wABrld"
|
|
701
|
-
* replaceAt(0, "cat", "br");
|
|
702
|
-
* // ➔ "brat"
|
|
703
|
-
* replaceAt(2, "12345", "-");
|
|
704
|
-
* // ➔ "12-45"
|
|
705
|
-
* replaceAt(4, "ABCDE", "Z");
|
|
706
|
-
* // ➔ "ABCDZ"
|
|
707
|
-
* // ❌ Examples that throw:
|
|
708
|
-
* replaceAt(10, "short", "X");
|
|
709
|
-
* // ➔ ❌ RangeError: First parameter (`index`) is out of range from second parameter `originalString`.
|
|
710
|
-
* replaceAt(-1, "test", "X");
|
|
711
|
-
* // ➔ ❌ RangeError: First parameter (`index`) is out of range from second parameter `originalString`.
|
|
712
|
-
* replaceAt("1", "test", "X");
|
|
713
|
-
* // ➔ ❌ TypeError: First parameter `index` must be of type `number`, second parameter `originalString` and third parameter `replaceTo` must be of type `string`, but received: "['index': `string`,...]."
|
|
714
|
-
* replaceAt(2, null, "X");
|
|
715
|
-
* // ➔ ❌ TypeError: First parameter `index` must be of type `number`, second parameter `originalString` and third parameter `replaceTo` must be of type `string`, but received: "['index': `string`,...]."
|
|
716
|
-
*/
|
|
685
|
+
* * ***Utility: `replaceAt`.***
|
|
686
|
+
* ----------------------------------------------------------
|
|
687
|
+
* **Replaces exactly one character at the specified index in the original string
|
|
688
|
+
* with the provided `replaceTo` string.**
|
|
689
|
+
* - **Behavior:**
|
|
690
|
+
* - If `replaceTo` has more than one character,
|
|
691
|
+
* the result will expand accordingly.
|
|
692
|
+
* @param {number} index - The starting index where the replacement should occur.
|
|
693
|
+
* @param {string} originalString - The original string to modify.
|
|
694
|
+
* @param {string} replaceTo - The string to insert at the specified index.
|
|
695
|
+
* @returns {string} The modified string with the replacement applied.
|
|
696
|
+
* @example
|
|
697
|
+
* replaceAt(3, "hello", "X");
|
|
698
|
+
* // ➔ "helXo"
|
|
699
|
+
* replaceAt(1, "world", "AB");
|
|
700
|
+
* // ➔ "wABrld"
|
|
701
|
+
* replaceAt(0, "cat", "br");
|
|
702
|
+
* // ➔ "brat"
|
|
703
|
+
* replaceAt(2, "12345", "-");
|
|
704
|
+
* // ➔ "12-45"
|
|
705
|
+
* replaceAt(4, "ABCDE", "Z");
|
|
706
|
+
* // ➔ "ABCDZ"
|
|
707
|
+
* // ❌ Examples that throw:
|
|
708
|
+
* replaceAt(10, "short", "X");
|
|
709
|
+
* // ➔ ❌ RangeError: First parameter (`index`) is out of range from second parameter `originalString`.
|
|
710
|
+
* replaceAt(-1, "test", "X");
|
|
711
|
+
* // ➔ ❌ RangeError: First parameter (`index`) is out of range from second parameter `originalString`.
|
|
712
|
+
* replaceAt("1", "test", "X");
|
|
713
|
+
* // ➔ ❌ TypeError: First parameter `index` must be of type `number`, second parameter `originalString` and third parameter `replaceTo` must be of type `string`, but received: "['index': `string`,...]."
|
|
714
|
+
* replaceAt(2, null, "X");
|
|
715
|
+
* // ➔ ❌ TypeError: First parameter `index` must be of type `number`, second parameter `originalString` and third parameter `replaceTo` must be of type `string`, but received: "['index': `string`,...]."
|
|
716
|
+
*/
|
|
717
717
|
declare const replaceAt:(index:number,originalString:string,replaceTo:string)=>string;
|
|
718
718
|
/** ----------------------------------------------------------
|
|
719
|
-
* * ***Utility: `getInitialsName`.***
|
|
720
|
-
* ----------------------------------------------------------
|
|
721
|
-
* **Extracts initials from the given name string.**
|
|
722
|
-
* - **Behavior:**
|
|
723
|
-
* - For names with two or more words, returns the first letter of the first and second words.
|
|
724
|
-
* - For a single word with 2+ characters, returns the first two letters.
|
|
725
|
-
* - For a single character, returns that character.
|
|
726
|
-
* - For `empty`, `null`, `undefined` or `whitespace-only input`, returns an empty string (`""`).
|
|
727
|
-
* @param {string | null | undefined} name - The name to extract initials from.
|
|
728
|
-
* @returns {string} The extracted initials (e.g., "JD" for "John Doe").
|
|
729
|
-
* @example
|
|
730
|
-
* getInitialsName("Alice"); // ➔ "AL"
|
|
731
|
-
* getInitialsName("John Doe"); // ➔ "JD"
|
|
732
|
-
* getInitialsName(" Bob Marley "); // ➔ "BM"
|
|
733
|
-
* getInitialsName("John Ronald Donal"); // ➔ "JR"
|
|
734
|
-
* getInitialsName("Lord John Doe Moe"); // ➔ "LJ"
|
|
735
|
-
* getInitialsName("X"); // ➔ "X"
|
|
736
|
-
* getInitialsName(""); // ➔ "" (empty string)
|
|
737
|
-
* getInitialsName(" "); // ➔ "" (empty string)
|
|
738
|
-
* getInitialsName(null); // ➔ "" (null input)
|
|
739
|
-
* getInitialsName(undefined); // ➔ "" (undefined input)
|
|
740
|
-
*/
|
|
719
|
+
* * ***Utility: `getInitialsName`.***
|
|
720
|
+
* ----------------------------------------------------------
|
|
721
|
+
* **Extracts initials from the given name string.**
|
|
722
|
+
* - **Behavior:**
|
|
723
|
+
* - For names with two or more words, returns the first letter of the first and second words.
|
|
724
|
+
* - For a single word with 2+ characters, returns the first two letters.
|
|
725
|
+
* - For a single character, returns that character.
|
|
726
|
+
* - For `empty`, `null`, `undefined` or `whitespace-only input`, returns an empty string (`""`).
|
|
727
|
+
* @param {string | null | undefined} name - The name to extract initials from.
|
|
728
|
+
* @returns {string} The extracted initials (e.g., "JD" for "John Doe").
|
|
729
|
+
* @example
|
|
730
|
+
* getInitialsName("Alice"); // ➔ "AL"
|
|
731
|
+
* getInitialsName("John Doe"); // ➔ "JD"
|
|
732
|
+
* getInitialsName(" Bob Marley "); // ➔ "BM"
|
|
733
|
+
* getInitialsName("John Ronald Donal"); // ➔ "JR"
|
|
734
|
+
* getInitialsName("Lord John Doe Moe"); // ➔ "LJ"
|
|
735
|
+
* getInitialsName("X"); // ➔ "X"
|
|
736
|
+
* getInitialsName(""); // ➔ "" (empty string)
|
|
737
|
+
* getInitialsName(" "); // ➔ "" (empty string)
|
|
738
|
+
* getInitialsName(null); // ➔ "" (null input)
|
|
739
|
+
* getInitialsName(undefined); // ➔ "" (undefined input)
|
|
740
|
+
*/
|
|
741
741
|
declare const getInitialsName:(name:string|null|undefined)=>string;export{capitalizeFirst,capitalizeWords,getInitialsName,normalizeSpaces,normalizeString,removeSpaces,replaceAt,slugify,stripHtmlTags,toCamelCase,toDotCase,toKebabCase,toLowerCase,toPascalCase,toPascalCaseSpace,toSnakeCase};
|