@tempots/std 0.12.0 → 0.14.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/string.d.ts CHANGED
@@ -1,60 +1,93 @@
1
1
  /**
2
2
  * Utility functions to manipulate string values.
3
+ *
4
+ * Use by importing the desired utility from "@tempots/std" or directly from "@tempots/std/string".
3
5
  * @public
4
6
  */
5
7
  /**
6
8
  * Replaces all occurrances of `placeholder` in `subject` with the value `replacement`.
7
- * @param subject -
8
- * @param placeholder -
9
- * @param replacement -
9
+ * @param subject - The string to search in.
10
+ * @param placeholder - The string to search for.
11
+ * @param replacement - The string to replace `placeholder` with.
12
+ * @returns The string with all occurrances of `placeholder` replaced by `replacement`.
10
13
  * @public
11
14
  */
12
- export declare function replace(subject: string, placeholder: string, replacement: string): string;
15
+ export declare const replaceAll: (subject: string, placeholder: string, replacement: string) => string;
13
16
  /**
14
- * `after` searches for the first occurrance of `searchFor` and returns the text after that.
17
+ * `substringAfter` searches for the first occurrance of `searchFor` and returns the text after that.
15
18
  * If `searchFor` is not found, an empty string is returned.
19
+ *
20
+ * @param value - The string to search in.
21
+ * @param searchFor - The string to search for.
22
+ * @returns The text after the first occurrance of `searchFor` or an empty string if `searchFor` is not found.
16
23
  * @public
17
24
  */
18
- export declare function after(value: string, searchFor: string): string;
25
+ export declare const substringAfter: (value: string, searchFor: string) => string;
19
26
  /**
20
- * `afterLast` searches for the last occurrance of `searchFor` and returns the text after that.
27
+ * `substringAfterLast` searches for the last occurrance of `searchFor` and returns the text after that.
21
28
  * If `searchFor` is not found, an empty string is returned.
29
+ *
30
+ * @param value - The string to search in.
31
+ * @param searchFor - The string to search for.
32
+ * @returns The text after the last occurrance of `searchFor` or an empty string if `searchFor` is not found.
22
33
  * @public
23
34
  */
24
- export declare function afterLast(value: string, searchFor: string): string;
35
+ export declare const substringAfterLast: (value: string, searchFor: string) => string;
25
36
  /**
26
- * `before` searches for the first occurrance of `searchFor` and returns the text before that.
37
+ * `substringBefore` searches for the first occurrance of `searchFor` and returns the text before that.
27
38
  * If `searchFor` is not found, an empty string is returned.
39
+ *
40
+ * @param value - The string to search in.
41
+ * @param searchFor - The string to search for.
42
+ * @returns The text before the first occurrance of `searchFor` or an empty string if `searchFor` is not found.
28
43
  * @public
29
44
  */
30
- export declare function before(value: string, searchFor: string): string;
45
+ export declare const substringBefore: (value: string, searchFor: string) => string;
31
46
  /**
32
- * `beforeLast` searches for the last occurrance of `searchFor` and returns the text before that.
47
+ * `substringBeforeLast` searches for the last occurrance of `searchFor` and returns the text before that.
33
48
  * If `searchFor` is not found, an empty string is returned.
49
+ *
50
+ * @param value - The string to search in.
51
+ * @param searchFor - The string to search for.
52
+ * @returns The text before the last occurrance of `searchFor` or an empty string if `searchFor` is not found.
34
53
  * @public
35
54
  */
36
- export declare function beforeLast(value: string, searchFor: string): string;
55
+ export declare const substringBeforeLast: (value: string, searchFor: string) => string;
37
56
  /**
38
57
  * `capitalize` returns a string with the first character convert to upper case.
58
+ *
59
+ * @param s - The string to capitalize.
60
+ * @returns The capitalized string.
39
61
  * @public
40
62
  */
41
- export declare function capitalize(s: string): string;
63
+ export declare const capitalize: (s: string) => string;
42
64
  /**
43
65
  * Capitalize the first letter of every word in `value`. If `whiteSpaceOnly` is set to `true`
44
66
  * the process is limited to whitespace separated words.
67
+ *
68
+ * @param value - The string to capitalize.
69
+ * @param whiteSpaceOnly - If `true`, only whitespace separated words will be capitalized.
70
+ * @returns The string with the first letter of each word capitalized.
45
71
  * @public
46
72
  */
47
- export declare function capitalizeWords(value: string, whiteSpaceOnly?: boolean): string;
73
+ export declare const capitalizeWords: (value: string, whiteSpaceOnly?: boolean) => string;
48
74
  /**
49
75
  * Replaces occurrances of `\r\n`, `\n\r`, `\r` with `\n`
76
+ *
77
+ * @param value - The string to normalize.
78
+ * @returns The string with normalized line endings.
50
79
  * @public
51
80
  */
52
- export declare function canonicalizeNewlines(value: string): string;
81
+ export declare const canonicalizeNewlines: (value: string) => string;
53
82
  /**
54
83
  * Compares two strings ignoring their case.
84
+ *
85
+ * @param a - The first string to compare.
86
+ * @param b - The second string to compare.
87
+ * @returns A negative number if `a` is less than `b`, zero if they are equal, or a positive number if `a` is greater than `b`.
55
88
  * @public
56
89
  */
57
- export declare function compareCaseInsensitive(a: string, b: string): number;
90
+ export declare const compareCaseInsensitive: (a: string, b: string) => number;
58
91
  /**
59
92
  * Checks if a string ends with a specified suffix.
60
93
  *
@@ -63,7 +96,7 @@ export declare function compareCaseInsensitive(a: string, b: string): number;
63
96
  * @returns `true` if the string ends with the specified suffix, `false` otherwise.
64
97
  * @public
65
98
  */
66
- export declare function endsWith(s: string, end: string): boolean;
99
+ export declare const stringEndsWith: (s: string, end: string) => boolean;
67
100
  /**
68
101
  * Checks if a string ends with another string in a case-insensitive manner.
69
102
  *
@@ -72,7 +105,7 @@ export declare function endsWith(s: string, end: string): boolean;
72
105
  * @returns `true` if `s` ends with `end` (case-insensitive), otherwise `false`.
73
106
  * @public
74
107
  */
75
- export declare function endsWithCaseInsensitive(s: string, end: string): boolean;
108
+ export declare const textEndsWithCaseInsensitive: (s: string, end: string) => boolean;
76
109
  /**
77
110
  * Checks if a string starts with a specified substring.
78
111
  *
@@ -81,7 +114,7 @@ export declare function endsWithCaseInsensitive(s: string, end: string): boolean
81
114
  * @returns `true` if the string starts with the specified substring, `false` otherwise.
82
115
  * @public
83
116
  */
84
- export declare function startsWith(s: string, start: string): boolean;
117
+ export declare const stringStartsWith: (s: string, start: string) => boolean;
85
118
  /**
86
119
  * Checks if a string starts with another string in a case-insensitive manner.
87
120
  *
@@ -90,120 +123,192 @@ export declare function startsWith(s: string, start: string): boolean;
90
123
  * @returns `true` if `s` starts with `start` (case-insensitive), `false` otherwise.
91
124
  * @public
92
125
  */
93
- export declare function startsWithCaseInsensitive(s: string, start: string): boolean;
126
+ export declare const textStartsWithCaseInsensitive: (s: string, start: string) => boolean;
94
127
  /**
95
128
  * Compares a string `s` with many `values` and see if one of them matches its end ignoring their case.
129
+ *
130
+ * @param s - The string to compare.
131
+ * @param values - The values to compare with the end of `s`.
132
+ * @returns `true` if `s` ends with any of the values in `values` (case-insensitive), `false` otherwise.
96
133
  * @public
97
134
  */
98
- export declare function endsWithAnyCaseInsensitive(s: string, values: string[]): boolean;
135
+ export declare const textEndsWithAnyCaseInsensitive: (s: string, values: string[]) => boolean;
99
136
  /**
100
137
  * Compares a string `s` with many `values` and see if one of them matches its beginning ignoring their case.
138
+ *
139
+ * @param s - The string to compare.
140
+ * @param values - The values to compare with the start of `s`.
141
+ * @returns `true` if `s` starts with any of the values in `values` (case-insensitive), `false` otherwise.
101
142
  * @public
102
143
  */
103
- export declare function startsWithAnyCaseInsensitive(s: string, values: string[]): boolean;
144
+ export declare const textStartsWithAnyCaseInsensitive: (s: string, values: string[]) => boolean;
104
145
  /**
105
146
  * It cleans up all the whitespaces in the passed `value`. `collapse` does the following:
106
147
  * - remove trailing/leading whitespaces
107
148
  * - within the string, it collapses seqeunces of whitespaces into a single space character
108
149
  * For whitespaces in this description, it is intended to be anything that is matched by the regular expression `\s`.
150
+ *
151
+ * @param value - The string to collapse.
152
+ * @returns The string with all whitespaces collapsed.
109
153
  * @public
110
154
  */
111
- export declare function collapse(value: string): string;
155
+ export declare const collapseText: (value: string) => string;
112
156
  /**
113
157
  * It compares to string and it returns a negative number if `a` is inferior to `b`, zero if they are the same,
114
158
  * or otherwise a positive non-sero number.
159
+ *
160
+ * @param a - The first string to compare.
161
+ * @param b - The second string to compare.
162
+ * @returns A negative number if `a` is less than `b`, zero if they are equal, or a positive number if `a` is greater than `b`.
115
163
  * @public
116
164
  */
117
- export declare function compareStrings(a: string, b: string): number;
165
+ export declare const compareStrings: (a: string, b: string) => number;
118
166
  /**
119
- * `contains` returns `true` if `s` contains one or more occurrences of `test` regardless of the text case.
167
+ * `textContainsCaseInsensitive` returns `true` if `s` contains one or more occurrences of `test` regardless of the text case.
168
+ *
169
+ * @param s - The string to search in.
170
+ * @param test - The string to search for.
171
+ * @returns `true` if `s` contains `test` (case-insensitive), `false` otherwise.
120
172
  * @public
121
173
  */
122
- export declare function containsCaseInsensitive(s: string, test: string): boolean;
174
+ export declare const textContainsCaseInsensitive: (s: string, test: string) => boolean;
123
175
  /**
124
- * `contains` returns `true` if `s` contains one or more occurrences of `test`.
176
+ * `textContains` returns `true` if `s` contains one or more occurrences of `test`.
177
+ *
178
+ * @param s - The string to search in.
179
+ * @param test - The string to search for.
180
+ * @returns `true` if `s` contains `test`, `false` otherwise.
125
181
  * @public
126
182
  */
127
- export declare function contains(s: string, test: string): boolean;
183
+ export declare const stringContains: (s: string, test: string) => boolean;
128
184
  /**
129
- * Return the number of occurances of `test` in `s`.
185
+ * Return the number of occurrences of `test` in `s`.
186
+ *
187
+ * @param s - The string to search in.
188
+ * @param test - The string to search for.
189
+ * @returns The number of occurrences of `test` in `s`.
130
190
  * @public
131
191
  */
132
- export declare function count(s: string, test: string): number;
192
+ export declare const countStringOccurrences: (s: string, test: string) => number;
133
193
  /**
134
- * `contains` returns `true` if `s` contains any of the strings in `tests` regardless of the text case
194
+ * `containsAnyTextCaseInsensitive` returns `true` if `s` contains any of the strings in `tests` regardless of the text case
195
+ *
196
+ * @param s - The string to search in.
197
+ * @param tests - The strings to search for.
198
+ * @returns `true` if `s` contains any of the strings in `tests` (case-insensitive), `false` otherwise.
135
199
  * @public
136
200
  */
137
- export declare function containsAnyCaseInsensitive(s: string, tests: string[]): boolean;
201
+ export declare const containsAnyTextCaseInsensitive: (s: string, tests: string[]) => boolean;
138
202
  /**
139
- * `contains` returns `true` if `s` contains any of the strings in `tests`
203
+ * `containsAnyText` returns `true` if `s` contains any of the strings in `tests`
204
+ *
205
+ * @param s - The string to search in.
206
+ * @param tests - The strings to search for.
207
+ * @returns `true` if `s` contains any of the strings in `tests`, `false` otherwise.
140
208
  * @public
141
209
  */
142
- export declare function containsAny(s: string, tests: string[]): boolean;
210
+ export declare const containsAnyText: (s: string, tests: string[]) => boolean;
143
211
  /**
144
- * `contains` returns `true` if `s` contains all of the strings in `tests` regardless of the text case
212
+ * `containsAllTextCaseInsensitive` returns `true` if `s` contains all of the strings in `tests` regardless of the text case
213
+ *
214
+ * @param s - The string to search in.
215
+ * @param tests - The strings to search for.
216
+ * @returns `true` if `s` contains all of the strings in `tests` (case-insensitive), `false` otherwise.
145
217
  * @public
146
218
  */
147
- export declare function containsAllCaseInsensitive(s: string, tests: string[]): boolean;
219
+ export declare const containsAllTextCaseInsensitive: (s: string, tests: string[]) => boolean;
148
220
  /**
149
- * `contains` returns `true` if `s` contains all of the strings in `tests`
221
+ * `containsAllText` returns `true` if `s` contains all of the strings in `tests`
222
+ *
223
+ * @param s - The string to search in.
224
+ * @param tests - The strings to search for.
225
+ * @returns `true` if `s` contains all of the strings in `tests`, `false` otherwise.
150
226
  * @public
151
227
  */
152
- export declare function containsAll(s: string, tests: string[]): boolean;
228
+ export declare const containsAllText: (s: string, tests: string[]) => boolean;
153
229
  /**
154
230
  * `dasherize` replaces all the occurrances of `_` with `-`
231
+ *
232
+ * @param s - The string to dasherize.
233
+ * @returns The dasherized string.
155
234
  * @public
156
235
  */
157
- export declare function dasherize(s: string): string;
236
+ export declare const dasherize: (s: string) => string;
158
237
  /**
159
238
  * Compares strings `a` and `b` and returns the position where they differ.
160
239
  * If the strings are equal, it returns `-1`.
161
240
  *
241
+ * @example
162
242
  * ```ts
163
- * diffIndex('abcdef', 'abc123') // returns 3
243
+ * stringsDifferAtIndex('abcdef', 'abc123') // returns 3
164
244
  * ```
165
245
  * @public
246
+ *
247
+ * @param a - The first string to compare.
248
+ * @param b - The second string to compare.
249
+ * @returns The position where the strings differ, or `-1` if they are equal.
250
+ *
166
251
  */
167
- export declare function diffIndex(a: string, b: string): number;
252
+ export declare const stringsDifferAtIndex: (a: string, b: string) => number;
168
253
  /**
169
254
  * `ellipsis` truncates `s` at len `maxlen` replaces the last characters with the content
170
255
  * of `symbol`.
256
+ *
257
+ * @example
171
258
  * ```ts
172
259
  * ellipsis('tempo is a nice library', 9) // returns 'tempo is …'
173
260
  * ```
261
+ *
262
+ * @param s - The string to truncate.
263
+ * @param maxlen - The maximum length of the string.
264
+ * @param symbol - The symbol to replace the truncated characters with.
265
+ * @returns The truncated string.
174
266
  * @public
175
267
  */
176
- export declare function ellipsis(s: string, maxlen?: number, symbol?: string): string;
268
+ export declare const ellipsis: (s: string, maxlen?: number, symbol?: string) => string;
177
269
  /**
178
270
  * Same as `ellipsis` but puts the symbol in the middle of the string and not to the end.
271
+ *
272
+ * @example
179
273
  * ```ts
180
274
  * ellipsisMiddle('tempo is a nice library', 18) // returns 'tempo is … library'
181
275
  * ```
276
+ *
277
+ * @param s - The string to truncate.
278
+ * @param maxlen - The maximum length of the string.
279
+ * @param symbol - The symbol to replace the truncated characters with.
280
+ * @returns The truncated string.
182
281
  * @public
183
282
  */
184
- export declare function ellipsisMiddle(s: string, maxlen?: number, symbol?: string): string;
283
+ export declare const ellipsisMiddle: (s: string, maxlen?: number, symbol?: string) => string;
185
284
  /**
186
285
  * Returns `true` if `s` ends with any of the values in `values`.
286
+ *
287
+ * @param s - The string to compare.
288
+ * @param values - The values to compare with the end of `s`.
289
+ * @returns `true` if `s` ends with any of the values in `values`, `false` otherwise.
187
290
  * @public
188
291
  */
189
- export declare function endsWithAny(s: string, values: string[]): boolean;
292
+ export declare const stringEndsWithAny: (s: string, values: string[]) => boolean;
190
293
  /**
191
- * `filter` applies `predicate` character by character to `s` and it returns a filtered
294
+ * `filterString` applies `predicate` character by character to `s` and it returns a filtered
192
295
  * version of the string.
296
+ *
297
+ * @param s - The string to filter.
298
+ * @param predicate - The function to apply to each character in the string.
299
+ * @returns The filtered string.
193
300
  * @public
194
301
  */
195
- export declare function filter(s: string, predicate: (s: string) => boolean): string;
196
- /**
197
- * Same as `filter` but `predicate` operates on integer char codes instead of string characters.
198
- * @public
199
- */
200
- export declare function filterCharcode(s: string, predicate: (n: number) => boolean): string;
302
+ export declare const filterChars: (s: string, predicate: (s: string) => boolean) => string;
201
303
  /**
202
- * `from` searches for the first occurrance of `searchFor` and returns the text from that point on.
203
- * If `searchFor` is not found, an empty string is returned.
304
+ * Same as `filterCharcodes` but `predicate` operates on integer char codes instead of string characters.
305
+ *
306
+ * @param s - The string to filter.
307
+ * @param predicate - The function to apply to each character code in the string.
308
+ * @returns The filtered string.
204
309
  * @public
205
310
  */
206
- export declare function from(value: string, searchFor: string): string;
311
+ export declare const filterCharcodes: (s: string, predicate: (n: number) => boolean) => string;
207
312
  /**
208
313
  * Calculates the hash code for a given string.
209
314
  *
@@ -212,27 +317,39 @@ export declare function from(value: string, searchFor: string): string;
212
317
  * @returns The calculated hash code as a number.
213
318
  * @public
214
319
  */
215
- export declare function hashCode(value: string, seed?: number): number;
320
+ export declare const stringHashCode: (value: string, seed?: number) => number;
216
321
  /**
217
322
  * Returns `true` if `value` is not `null` and contains at least one character.
323
+ *
324
+ * @param value - The string to check.
325
+ * @returns `true` if the string is not `null` and contains at least one character, `false` otherwise.
218
326
  * @public
219
327
  */
220
- export declare function hasContent(value: string): boolean;
328
+ export declare const stringHasContent: (value: string) => boolean;
221
329
  /**
222
330
  * Works the same as `underscore` but also replaces underscores with whitespaces.
331
+ *
332
+ * @param s - The string to convert.
333
+ * @returns The converted string.
223
334
  * @public
224
335
  */
225
- export declare function humanize(s: string): string;
336
+ export declare const humanize: (s: string) => string;
226
337
  /**
227
338
  * Checks if `s` contains only (and at least one) alphabetical characters.
339
+ *
340
+ * @param s - The string to check.
341
+ * @returns `true` if the string contains only alphabetical characters, `false` otherwise.
228
342
  * @public
229
343
  */
230
- export declare function isAlpha(s: string): boolean;
344
+ export declare const isAlpha: (s: string) => boolean;
231
345
  /**
232
346
  * `isAlphaNum` returns `true` if the string only contains alpha-numeric characters.
347
+ *
348
+ * @param value - The string to check.
349
+ * @returns `true` if the string contains only alpha-numeric characters, `false` otherwise.
233
350
  * @public
234
351
  */
235
- export declare function isAlphaNum(value: string): boolean;
352
+ export declare const isAlphaNum: (value: string) => boolean;
236
353
  /**
237
354
  * Checks if a string contains any breaking whitespace characters.
238
355
  *
@@ -240,54 +357,84 @@ export declare function isAlphaNum(value: string): boolean;
240
357
  * @returns `true` if the string contains breaking whitespace characters, `false` otherwise.
241
358
  * @public
242
359
  */
243
- export declare function isBreakingWhitespace(value: string): boolean;
360
+ export declare const isBreakingWhitespace: (value: string) => boolean;
244
361
  /**
245
362
  * Returns `true` if the value string is composed of only lower cased characters
246
363
  * or case neutral characters.
364
+ *
365
+ * @param value - The string to check.
366
+ * @returns `true` if the string contains only lower case characters, `false` otherwise.
247
367
  * @public
248
368
  */
249
- export declare function isLowerCase(value: string): boolean;
369
+ export declare const isLowerCase: (value: string) => boolean;
250
370
  /**
251
371
  * Returns `true` if the value string is composed of only upper cased characters
252
372
  * or case neutral characters.
373
+ *
374
+ * @param value - The string to check.
375
+ * @returns `true` if the string contains only upper case characters, `false` otherwise.
253
376
  * @public
254
377
  */
255
- export declare function isUpperCase(value: string): boolean;
378
+ export declare const isUpperCase: (value: string) => boolean;
256
379
  /**
257
380
  * `ifEmpty` returns `value` if it is neither `null` or empty, otherwise it returns `alt`
381
+ *
382
+ * @param value - The string to check.
383
+ * @param alt - The alternative value to return if `value` is `null` or empty.
384
+ * @returns The original string if it is not `null` or empty, otherwise the alternative value.
258
385
  * @public
259
386
  */
260
- export declare function ifEmpty(value: string, alt: string): string;
387
+ export declare const ifEmptyString: (value: string, alt: string) => string;
261
388
  /**
262
389
  * `isDigitsOnly` returns `true` if the string only contains digits.
390
+ *
391
+ * @param value - The string to check.
392
+ * @returns `true` if the string contains only digits, `false` otherwise.
263
393
  * @public
264
394
  */
265
- export declare function isDigitsOnly(value: string): boolean;
395
+ export declare const isDigitsOnly: (value: string) => boolean;
266
396
  /**
267
397
  * `isEmpty` returns true if either `value` is null or is an empty string.
398
+ *
399
+ * @param value - The string to check.
400
+ * @returns `true` if the string is `null` or empty, `false` otherwise.
268
401
  * @public
269
402
  */
270
- export declare function isEmpty(value: string): boolean;
403
+ export declare const isEmptyString: (value: string) => boolean;
271
404
  /**
272
405
  * Convert first letter in `value` to lower case.
406
+ *
407
+ * @param value - The string to convert.
408
+ * @returns The string with the first letter in lower case.
273
409
  * @public
274
410
  */
275
- export declare function lowerCaseFirst(value: string): string;
411
+ export declare const lowerCaseFirst: (value: string) => string;
276
412
  /**
277
413
  * Returns a random substring from the `value` argument. The length of such value is by default `1`.
414
+ *
415
+ * @param value - The string to extract the random substring from.
416
+ * @param length - The length of the random substring to extract.
417
+ * @returns The random substring.
278
418
  * @public
279
419
  */
280
- export declare function random(value: string, length?: number): string;
420
+ export declare const randomString: (value: string, length?: number) => string;
281
421
  /**
282
422
  * Returns a random sampling of the specified length from the seed string.
423
+ *
424
+ * @param alphabet - The seed string to sample from.
425
+ * @param length - The length of the random string to generate.
426
+ * @returns The random string.
283
427
  * @public
284
428
  */
285
- export declare function randomSequence(alphabet: string, length: number): string;
429
+ export declare const randomStringSequence: (alphabet: string, length: number) => string;
286
430
  /**
287
431
  * Like `randomSequence`, but automatically uses the base64 sequence as the seed string.
432
+ *
433
+ * @param length - The length of the random string to generate.
434
+ * @returns The random string.
288
435
  * @public
289
436
  */
290
- export declare function randomSequence64(length: number): string;
437
+ export declare const randomStringSequenceBase64: (length: number) => string;
291
438
  /**
292
439
  * It maps a string character by character using `callback`.
293
440
  *
@@ -296,50 +443,84 @@ export declare function randomSequence64(length: number): string;
296
443
  * @returns An array of the mapped characters.
297
444
  * @public
298
445
  */
299
- export declare function map<T>(callback: (c: string) => T, value: string): T[];
446
+ export declare const mapChars: <T>(callback: (c: string) => T, value: string) => T[];
300
447
  /**
301
448
  * If present, it removes all the occurrences of `toremove` from `value`.
449
+ *
450
+ * @param value - The string to remove the occurrences from.
451
+ * @param toremove - The string to remove from `value`.
452
+ * @returns The string with all occurrences of `toremove` removed.
302
453
  * @public
303
454
  */
304
- export declare function remove(value: string, toremove: string): string;
455
+ export declare const deleteSubstring: (value: string, toremove: string) => string;
305
456
  /**
306
457
  * If present, it removes the `toremove` text from the end of `value`.
458
+ *
459
+ * @param value - The string to remove the text from.
460
+ * @param toremove - The text to remove from the end of `value`.
461
+ * @returns The string with the text removed.
307
462
  * @public
308
463
  */
309
- export declare function removeAfter(value: string, toremove: string): string;
464
+ export declare const deleteStringAfter: (value: string, toremove: string) => string;
310
465
  /**
311
466
  * Removes a slice from `index` to `index + length` from `value`.
467
+ *
468
+ * @param value - The string to remove the slice from.
469
+ * @param index - The starting index of the slice to remove.
470
+ * @param length - The length of the slice to remove.
471
+ * @returns The string with the slice removed.
312
472
  * @public
313
473
  */
314
- export declare function removeAt(value: string, index: number, length: number): string;
474
+ export declare const trimStringSlice: (value: string, index: number, length: number) => string;
315
475
  /**
316
476
  * If present, it removes the `toremove` text from the beginning of `value`.
477
+ *
478
+ * @param value - The string to remove the text from.
479
+ * @param toremove - The text to remove from the beginning of `value`.
480
+ * @returns The string with the text removed.
317
481
  * @public
318
482
  */
319
- export declare function removeBefore(value: string, toremove: string): string;
483
+ export declare const deleteStringBefore: (value: string, toremove: string) => string;
320
484
  /**
321
485
  * If present, it removes the first occurrence of `toremove` from `value`.
486
+ *
487
+ * @param value - The string to remove the text from.
488
+ * @param toremove - The text to remove from `value`.
489
+ * @returns The string with the text removed.
322
490
  * @public
323
491
  */
324
- export declare function removeOne(value: string, toremove: string): string;
492
+ export declare const deleteFirstFromString: (value: string, toremove: string) => string;
325
493
  /**
326
- * `repeat` builds a new string by repeating the argument `s`, n `times`.
494
+ * `repeatString` builds a new string by repeating the argument `s`, n `times`.
495
+ *
496
+ * @example
327
497
  * ```ts
328
- * repeat('Xy', 3) // generates 'XyXyXy'
498
+ * repeatString('Xy', 3) // generates 'XyXyXy'
329
499
  * ```
500
+ *
501
+ * @param s - The string to repeat.
502
+ * @param times - The number of times to repeat the string.
503
+ * @returns The repeated string.
330
504
  * @public
331
505
  */
332
- export declare function repeat(s: string, times: number): string;
506
+ export declare const repeatString: (s: string, times: number) => string;
333
507
  /**
334
508
  * Returns a new string whose characters are in reverse order.
509
+ *
510
+ * @param s - The string to reverse.
511
+ * @returns The reversed string.
335
512
  * @public
336
513
  */
337
- export declare function reverse(s: string): string;
514
+ export declare const reverseString: (s: string) => string;
338
515
  /**
339
516
  * Converts a string in a quoted string.
517
+ *
518
+ * @param s - The string to quote.
519
+ * @param prefer - The preferred quote character. Defaults to single quote (`'`).
520
+ * @returns The quoted string.
340
521
  * @public
341
522
  */
342
- export declare function smartQuote(s: string, prefer?: string): string;
523
+ export declare const smartQuote: (s: string, prefer?: string) => string;
343
524
  /**
344
525
  * Returns a quoted version of the input string.
345
526
  *
@@ -348,7 +529,7 @@ export declare function smartQuote(s: string, prefer?: string): string;
348
529
  * @returns The quoted string.
349
530
  * @public
350
531
  */
351
- export declare function quote(s: string, quoteChar?: string): string;
532
+ export declare const quote: (s: string, quoteChar?: string) => string;
352
533
  /**
353
534
  * Quotes a string for use in JavaScript code.
354
535
  * If the string contains a newline character, it will be quoted using backticks.
@@ -359,82 +540,126 @@ export declare function quote(s: string, quoteChar?: string): string;
359
540
  * @returns The quoted string.
360
541
  * @public
361
542
  */
362
- export declare function jsQuote(s: string, prefer?: string): string;
543
+ export declare const jsQuote: (s: string, prefer?: string) => string;
363
544
  /**
364
545
  * It only splits on the first occurrance of separator.
546
+ *
547
+ * @param s - The string to split.
548
+ * @param separator - The separator to split the string on.
549
+ * @returns An array with the split string.
365
550
  * @public
366
551
  */
367
- export declare function splitOnce(s: string, separator: string): [string] | [string, string];
552
+ export declare const splitStringOnce: (s: string, separator: string) => [string] | [string, string];
368
553
  /**
369
554
  * Returns `true` if `s` starts with any of the values in `values`.
555
+ *
556
+ * @param s - The string to compare.
557
+ * @param values - The values to compare with the start of `s`.
558
+ * @returns `true` if `s` starts with any of the values in `values`, `false` otherwise.
370
559
  * @public
371
560
  */
372
- export declare function startsWithAny(s: string, values: string[]): boolean;
561
+ export declare const stringStartsWithAny: (s: string, values: string[]) => boolean;
373
562
  /**
374
563
  * Surrounds a string with the contents of `left` and `right`. If `right` is omitted,
375
564
  * `left` will be used on both sides
565
+ *
566
+ * @param s - The string to surround.
567
+ * @param left - The left side of the surrounding text.
568
+ * @param right - The right side of the surrounding text. Defaults to `left`.
569
+ * @returns The surrounded string.
376
570
  * @public
377
571
  */
378
- export declare function surround(s: string, left: string, right?: string): string;
572
+ export declare const surroundString: (s: string, left: string, right?: string) => string;
379
573
  /**
380
574
  * It transforms a string into an `Array` of characters.
575
+ *
576
+ * @param s - The string to transform.
577
+ * @returns An array of characters.
381
578
  * @public
382
579
  */
383
- export declare function toArray(s: string): string[];
580
+ export declare const stringToChars: (s: string) => string[];
384
581
  /**
385
582
  * It transforms a string into an `Array` of char codes in integer format.
583
+ *
584
+ * @param s - The string to transform.
585
+ * @returns An array of char codes.
386
586
  * @public
387
587
  */
388
- export declare function toCharcodes(s: string): number[];
588
+ export declare const stringToCharcodes: (s: string) => number[];
389
589
  /**
390
590
  * Returns an array of `string` whose elements are equally long (using `len`). If the string `s`
391
591
  * is not exactly divisible by `len` the last element of the array will be shorter.
592
+ *
593
+ * @param s - The string to chunk.
594
+ * @param len - The length of each chunk.
595
+ * @returns An array of chunks.
392
596
  * @public
393
597
  */
394
- export declare function toChunks(s: string, len: number): string[];
598
+ export declare const chunkString: (s: string, len: number) => string[];
395
599
  /**
396
600
  * Returns an array of `string` split by line breaks.
601
+ *
602
+ * @param s - The string to split.
603
+ * @returns An array of lines.
397
604
  * @public
398
605
  */
399
- export declare function toLines(s: string): string[];
606
+ export declare const textToLines: (s: string) => string[];
400
607
  /**
401
608
  * `trimChars` removes from the beginning and the end of the string any character that is present in `charlist`.
609
+ *
610
+ * @param value - The string to trim.
611
+ * @param charlist - The characters to remove from the beginning and end of the string.
612
+ * @returns The trimmed string.
402
613
  * @public
403
614
  */
404
- export declare function trimChars(value: string, charlist: string): string;
615
+ export declare const trimChars: (value: string, charlist: string) => string;
405
616
  /**
406
617
  * `trimCharsLeft` removes from the beginning of the string any character that is present in `charlist`.
618
+ *
619
+ * @param value - The string to trim.
620
+ * @param charlist - The characters to remove from the beginning of the string.
621
+ * @returns The trimmed string.
407
622
  * @public
408
623
  */
409
- export declare function trimCharsLeft(value: string, charlist: string): string;
624
+ export declare const trimCharsLeft: (value: string, charlist: string) => string;
410
625
  /**
411
626
  * `trimCharsRight` removes from the end of the string any character that is present in `charlist`.
627
+ *
628
+ * @param value - The string to trim.
629
+ * @param charlist - The characters to remove from the end of the string.
630
+ * @returns The trimmed string.
412
631
  * @public
413
632
  */
414
- export declare function trimCharsRight(value: string, charlist: string): string;
633
+ export declare const trimCharsRight: (value: string, charlist: string) => string;
415
634
  /**
416
635
  * `underscore` finds UpperCase characters and turns them into LowerCase and prepends them with a whtiespace.
417
636
  * Sequences of more than one UpperCase character are left untouched.
637
+ *
638
+ * @param s - The string to underscore.
639
+ * @returns The underscored string.
418
640
  * @public
419
641
  */
420
- export declare function underscore(s: string): string;
642
+ export declare const underscore: (s: string) => string;
421
643
  /**
422
644
  * Convert first letter in `value` to upper case.
645
+ *
646
+ * @param value - The string to convert.
647
+ * @returns The string with the first letter in upper case.
423
648
  * @public
424
649
  */
425
- export declare function upperCaseFirst(value: string): string;
426
- /**
427
- * `upTo` searches for the first occurrance of `searchFor` and returns the text up to that point.
428
- * If `searchFor` is not found, the entire string is returned.
429
- * @public
430
- */
431
- export declare function upTo(value: string, searchFor: string): string;
650
+ export declare const upperCaseFirst: (value: string) => string;
432
651
  /**
433
652
  * `wrapColumns` splits a long string into lines that are at most `columns` long.
434
- * Words whose length exceeds `columns` are not split.
653
+ * Individual words whose length exceeds `columns` are not split.
654
+ *
655
+ * @param s - The string to wrap.
656
+ * @param columns - The number of columns per line.
657
+ * @param indent - The indentation string to prepend to each line.
658
+ * @param newline - The newline character to use for line breaks.
659
+ * @returns The wrapped string.
435
660
  * @public
436
661
  */
437
- export declare function wrapColumns(s: string, columns?: number, indent?: string, newline?: string): string;
662
+ export declare const wrapColumns: (s: string, columns?: number, indent?: string, newline?: string) => string;
438
663
  /**
439
664
  * Checks if the character at the specified position in a string is a whitespace character.
440
665
  *
@@ -443,25 +668,25 @@ export declare function wrapColumns(s: string, columns?: number, indent?: string
443
668
  * @returns A boolean indicating whether the character at the specified position is a whitespace character.
444
669
  * @public
445
670
  */
446
- export declare function isSpaceAt(s: string, pos: number): boolean;
671
+ export declare const isSpaceAt: (s: string, pos: number) => boolean;
447
672
  /**
448
673
  * Encodes a string to base64.
449
674
  *
450
675
  * @param s - The string to encode.
451
676
  * @returns The base64 encoded string.
452
- * @throws Error if no implementation is found for base64 encoding.
677
+ * @throws Throws `MissingImplementationError` if no implementation is found for base64 encoding.
453
678
  * @public
454
679
  */
455
- export declare function encodeBase64(s: string): string;
680
+ export declare const encodeBase64: (s: string) => string;
456
681
  /**
457
682
  * Decodes a base64 encoded string.
458
683
  *
459
684
  * @param s - The base64 encoded string to decode.
460
685
  * @returns The decoded string.
461
- * @throws An error if no implementation is found for base64 decoding.
686
+ * @throws Throws a `MissingImplementationError` if no implementation is found for base64 decoding.
462
687
  * @public
463
688
  */
464
- export declare function decodeBase64(s: string): string;
689
+ export declare const decodeBase64: (s: string) => string;
465
690
  /**
466
691
  * Wraps a string into multiple lines based on the specified number of columns,
467
692
  * indentation, and newline character.
@@ -473,7 +698,7 @@ export declare function decodeBase64(s: string): string;
473
698
  * @returns The wrapped string.
474
699
  * @public
475
700
  */
476
- export declare function wrapLine(s: string, columns: number, indent: string, newline: string): string;
701
+ export declare const wrapLine: (s: string, columns: number, indent: string, newline: string) => string;
477
702
  /**
478
703
  * Pads a string on the left with a specified character until it reaches a specified length.
479
704
  * If the string is already longer than the specified length, it is returned as is.
@@ -484,7 +709,7 @@ export declare function wrapLine(s: string, columns: number, indent: string, new
484
709
  * @returns The padded string.
485
710
  * @public
486
711
  */
487
- export declare function lpad(s: string, char: string, length: number): string;
712
+ export declare const lpad: (s: string, char: string, length: number) => string;
488
713
  /**
489
714
  * Pads a string on the right with a specified character until it reaches a specified length.
490
715
  * If the string is already longer than the specified length, it is returned as is.
@@ -495,7 +720,7 @@ export declare function lpad(s: string, char: string, length: number): string;
495
720
  * @returns The padded string.
496
721
  * @public
497
722
  */
498
- export declare function rpad(s: string, char: string, length: number): string;
723
+ export declare const rpad: (s: string, char: string, length: number) => string;
499
724
  /**
500
725
  * Splits a string into two parts at the last occurrence of a specified substring.
501
726
  * If the substring is found, the function returns an array with two elements:
@@ -508,7 +733,7 @@ export declare function rpad(s: string, char: string, length: number): string;
508
733
  * @returns An array containing the split parts of the string.
509
734
  * @public
510
735
  */
511
- export declare function splitOnLast(s: string, find: string): [string] | [string, string];
736
+ export declare const splitStringOnLast: (s: string, find: string) => [string] | [string, string];
512
737
  /**
513
738
  * Splits a string into two parts based on the first occurrence of a specified substring.
514
739
  * If the substring is found, returns an array with two elements: the part of the string before the substring and the part after the substring.
@@ -519,4 +744,4 @@ export declare function splitOnLast(s: string, find: string): [string] | [string
519
744
  * @returns An array containing the split parts of the string.
520
745
  * @public
521
746
  */
522
- export declare function splitOnFirst(s: string, find: string): [string] | [string, string];
747
+ export declare const splitStringOnFirst: (s: string, find: string) => [string] | [string, string];