@tempots/std 0.12.0 → 0.13.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,57 +1,90 @@
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 function 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
+ * `afterText` 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 function afterText(value: string, searchFor: string): string;
19
26
  /**
20
- * `afterLast` searches for the last occurrance of `searchFor` and returns the text after that.
27
+ * `afterLastText` 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 function afterLastText(value: string, searchFor: string): string;
25
36
  /**
26
- * `before` searches for the first occurrance of `searchFor` and returns the text before that.
37
+ * `beforeText` 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 function beforeText(value: string, searchFor: string): string;
31
46
  /**
32
- * `beforeLast` searches for the last occurrance of `searchFor` and returns the text before that.
47
+ * `beforeLastText` 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 function beforeLastText(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
63
  export declare function 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
73
  export declare function 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
81
  export declare function 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
90
  export declare function compareCaseInsensitive(a: string, b: string): number;
@@ -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 function textEndsWith(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 function 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 function textStartsWith(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,68 +123,114 @@ 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 function 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 function 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 function 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 function textCollapse(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
165
  export declare function 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 function 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 function textContains(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 function countTextOccurrences(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 function 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 function 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 function 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 function 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
236
  export declare function dasherize(s: string): string;
@@ -159,51 +238,80 @@ export declare function dasherize(s: string): string;
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
+ * @remarks
242
+ * @example
162
243
  * ```ts
163
- * diffIndex('abcdef', 'abc123') // returns 3
244
+ * stringsDifferAtIndex('abcdef', 'abc123') // returns 3
164
245
  * ```
165
246
  * @public
247
+ *
248
+ * @param a - The first string to compare.
249
+ * @param b - The second string to compare.
250
+ * @returns The position where the strings differ, or `-1` if they are equal.
251
+ *
166
252
  */
167
- export declare function diffIndex(a: string, b: string): number;
253
+ export declare function stringsDifferAtIndex(a: string, b: string): number;
168
254
  /**
169
255
  * `ellipsis` truncates `s` at len `maxlen` replaces the last characters with the content
170
256
  * of `symbol`.
257
+ *
258
+ * @remarks
259
+ * @example
171
260
  * ```ts
172
261
  * ellipsis('tempo is a nice library', 9) // returns 'tempo is …'
173
262
  * ```
263
+ *
264
+ * @param s - The string to truncate.
265
+ * @param maxlen - The maximum length of the string.
266
+ * @param symbol - The symbol to replace the truncated characters with.
267
+ * @returns The truncated string.
174
268
  * @public
175
269
  */
176
270
  export declare function ellipsis(s: string, maxlen?: number, symbol?: string): string;
177
271
  /**
178
272
  * Same as `ellipsis` but puts the symbol in the middle of the string and not to the end.
273
+ *
274
+ * @remarks
275
+ * @example
179
276
  * ```ts
180
277
  * ellipsisMiddle('tempo is a nice library', 18) // returns 'tempo is … library'
181
278
  * ```
279
+ *
280
+ * @param s - The string to truncate.
281
+ * @param maxlen - The maximum length of the string.
282
+ * @param symbol - The symbol to replace the truncated characters with.
283
+ * @returns The truncated string.
182
284
  * @public
183
285
  */
184
286
  export declare function ellipsisMiddle(s: string, maxlen?: number, symbol?: string): string;
185
287
  /**
186
288
  * Returns `true` if `s` ends with any of the values in `values`.
289
+ *
290
+ * @param s - The string to compare.
291
+ * @param values - The values to compare with the end of `s`.
292
+ * @returns `true` if `s` ends with any of the values in `values`, `false` otherwise.
187
293
  * @public
188
294
  */
189
- export declare function endsWithAny(s: string, values: string[]): boolean;
295
+ export declare function endsWithAnyText(s: string, values: string[]): boolean;
190
296
  /**
191
- * `filter` applies `predicate` character by character to `s` and it returns a filtered
297
+ * `filterString` applies `predicate` character by character to `s` and it returns a filtered
192
298
  * version of the string.
299
+ *
300
+ * @param s - The string to filter.
301
+ * @param predicate - The function to apply to each character in the string.
302
+ * @returns The filtered string.
193
303
  * @public
194
304
  */
195
- export declare function filter(s: string, predicate: (s: string) => boolean): string;
305
+ export declare function filterText(s: string, predicate: (s: string) => boolean): string;
196
306
  /**
197
- * Same as `filter` but `predicate` operates on integer char codes instead of string characters.
307
+ * Same as `filterCharcode` but `predicate` operates on integer char codes instead of string characters.
308
+ *
309
+ * @param s - The string to filter.
310
+ * @param predicate - The function to apply to each character code in the string.
311
+ * @returns The filtered string.
198
312
  * @public
199
313
  */
200
314
  export declare function filterCharcode(s: string, predicate: (n: number) => boolean): string;
201
- /**
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.
204
- * @public
205
- */
206
- export declare function from(value: string, searchFor: string): string;
207
315
  /**
208
316
  * Calculates the hash code for a given string.
209
317
  *
@@ -212,24 +320,36 @@ export declare function from(value: string, searchFor: string): string;
212
320
  * @returns The calculated hash code as a number.
213
321
  * @public
214
322
  */
215
- export declare function hashCode(value: string, seed?: number): number;
323
+ export declare function stringHashCode(value: string, seed?: number): number;
216
324
  /**
217
325
  * Returns `true` if `value` is not `null` and contains at least one character.
326
+ *
327
+ * @param value - The string to check.
328
+ * @returns `true` if the string is not `null` and contains at least one character, `false` otherwise.
218
329
  * @public
219
330
  */
220
- export declare function hasContent(value: string): boolean;
331
+ export declare function stringHasContent(value: string): boolean;
221
332
  /**
222
333
  * Works the same as `underscore` but also replaces underscores with whitespaces.
334
+ *
335
+ * @param s - The string to convert.
336
+ * @returns The converted string.
223
337
  * @public
224
338
  */
225
339
  export declare function humanize(s: string): string;
226
340
  /**
227
341
  * Checks if `s` contains only (and at least one) alphabetical characters.
342
+ *
343
+ * @param s - The string to check.
344
+ * @returns `true` if the string contains only alphabetical characters, `false` otherwise.
228
345
  * @public
229
346
  */
230
347
  export declare function isAlpha(s: string): boolean;
231
348
  /**
232
349
  * `isAlphaNum` returns `true` if the string only contains alpha-numeric characters.
350
+ *
351
+ * @param value - The string to check.
352
+ * @returns `true` if the string contains only alpha-numeric characters, `false` otherwise.
233
353
  * @public
234
354
  */
235
355
  export declare function isAlphaNum(value: string): boolean;
@@ -244,50 +364,80 @@ export declare function isBreakingWhitespace(value: string): boolean;
244
364
  /**
245
365
  * Returns `true` if the value string is composed of only lower cased characters
246
366
  * or case neutral characters.
367
+ *
368
+ * @param value - The string to check.
369
+ * @returns `true` if the string contains only lower case characters, `false` otherwise.
247
370
  * @public
248
371
  */
249
372
  export declare function isLowerCase(value: string): boolean;
250
373
  /**
251
374
  * Returns `true` if the value string is composed of only upper cased characters
252
375
  * or case neutral characters.
376
+ *
377
+ * @param value - The string to check.
378
+ * @returns `true` if the string contains only upper case characters, `false` otherwise.
253
379
  * @public
254
380
  */
255
381
  export declare function isUpperCase(value: string): boolean;
256
382
  /**
257
383
  * `ifEmpty` returns `value` if it is neither `null` or empty, otherwise it returns `alt`
384
+ *
385
+ * @param value - The string to check.
386
+ * @param alt - The alternative value to return if `value` is `null` or empty.
387
+ * @returns The original string if it is not `null` or empty, otherwise the alternative value.
258
388
  * @public
259
389
  */
260
- export declare function ifEmpty(value: string, alt: string): string;
390
+ export declare function ifEmptyString(value: string, alt: string): string;
261
391
  /**
262
392
  * `isDigitsOnly` returns `true` if the string only contains digits.
393
+ *
394
+ * @param value - The string to check.
395
+ * @returns `true` if the string contains only digits, `false` otherwise.
263
396
  * @public
264
397
  */
265
398
  export declare function isDigitsOnly(value: string): boolean;
266
399
  /**
267
400
  * `isEmpty` returns true if either `value` is null or is an empty string.
401
+ *
402
+ * @param value - The string to check.
403
+ * @returns `true` if the string is `null` or empty, `false` otherwise.
268
404
  * @public
269
405
  */
270
- export declare function isEmpty(value: string): boolean;
406
+ export declare function isEmptyString(value: string): boolean;
271
407
  /**
272
408
  * Convert first letter in `value` to lower case.
409
+ *
410
+ * @param value - The string to convert.
411
+ * @returns The string with the first letter in lower case.
273
412
  * @public
274
413
  */
275
414
  export declare function lowerCaseFirst(value: string): string;
276
415
  /**
277
416
  * Returns a random substring from the `value` argument. The length of such value is by default `1`.
417
+ *
418
+ * @param value - The string to extract the random substring from.
419
+ * @param length - The length of the random substring to extract.
420
+ * @returns The random substring.
278
421
  * @public
279
422
  */
280
- export declare function random(value: string, length?: number): string;
423
+ export declare function randomString(value: string, length?: number): string;
281
424
  /**
282
425
  * Returns a random sampling of the specified length from the seed string.
426
+ *
427
+ * @param alphabet - The seed string to sample from.
428
+ * @param length - The length of the random string to generate.
429
+ * @returns The random string.
283
430
  * @public
284
431
  */
285
- export declare function randomSequence(alphabet: string, length: number): string;
432
+ export declare function randomStringSequence(alphabet: string, length: number): string;
286
433
  /**
287
434
  * Like `randomSequence`, but automatically uses the base64 sequence as the seed string.
435
+ *
436
+ * @param length - The length of the random string to generate.
437
+ * @returns The random string.
288
438
  * @public
289
439
  */
290
- export declare function randomSequence64(length: number): string;
440
+ export declare function randomStringSequenceBase64(length: number): string;
291
441
  /**
292
442
  * It maps a string character by character using `callback`.
293
443
  *
@@ -296,47 +446,82 @@ export declare function randomSequence64(length: number): string;
296
446
  * @returns An array of the mapped characters.
297
447
  * @public
298
448
  */
299
- export declare function map<T>(callback: (c: string) => T, value: string): T[];
449
+ export declare function mapChars<T>(callback: (c: string) => T, value: string): T[];
300
450
  /**
301
451
  * If present, it removes all the occurrences of `toremove` from `value`.
452
+ *
453
+ * @param value - The string to remove the occurrences from.
454
+ * @param toremove - The string to remove from `value`.
455
+ * @returns The string with all occurrences of `toremove` removed.
302
456
  * @public
303
457
  */
304
- export declare function remove(value: string, toremove: string): string;
458
+ export declare function removeFromString(value: string, toremove: string): string;
305
459
  /**
306
460
  * If present, it removes the `toremove` text from the end of `value`.
461
+ *
462
+ * @param value - The string to remove the text from.
463
+ * @param toremove - The text to remove from the end of `value`.
464
+ * @returns The string with the text removed.
307
465
  * @public
308
466
  */
309
- export declare function removeAfter(value: string, toremove: string): string;
467
+ export declare function removeFromStringAfter(value: string, toremove: string): string;
310
468
  /**
311
469
  * Removes a slice from `index` to `index + length` from `value`.
470
+ *
471
+ * @param value - The string to remove the slice from.
472
+ * @param index - The starting index of the slice to remove.
473
+ * @param length - The length of the slice to remove.
474
+ * @returns The string with the slice removed.
312
475
  * @public
313
476
  */
314
- export declare function removeAt(value: string, index: number, length: number): string;
477
+ export declare function removeSliceFromString(value: string, index: number, length: number): string;
315
478
  /**
316
479
  * If present, it removes the `toremove` text from the beginning of `value`.
480
+ *
481
+ * @param value - The string to remove the text from.
482
+ * @param toremove - The text to remove from the beginning of `value`.
483
+ * @returns The string with the text removed.
317
484
  * @public
318
485
  */
319
- export declare function removeBefore(value: string, toremove: string): string;
486
+ export declare function removeFromStringBefore(value: string, toremove: string): string;
320
487
  /**
321
488
  * If present, it removes the first occurrence of `toremove` from `value`.
489
+ *
490
+ * @param value - The string to remove the text from.
491
+ * @param toremove - The text to remove from `value`.
492
+ * @returns The string with the text removed.
322
493
  * @public
323
494
  */
324
- export declare function removeOne(value: string, toremove: string): string;
495
+ export declare function removeFirstFromString(value: string, toremove: string): string;
325
496
  /**
326
- * `repeat` builds a new string by repeating the argument `s`, n `times`.
497
+ * `repeatString` builds a new string by repeating the argument `s`, n `times`.
498
+ *
499
+ * @remarks
500
+ * @example
327
501
  * ```ts
328
- * repeat('Xy', 3) // generates 'XyXyXy'
502
+ * repeatString('Xy', 3) // generates 'XyXyXy'
329
503
  * ```
504
+ *
505
+ * @param s - The string to repeat.
506
+ * @param times - The number of times to repeat the string.
507
+ * @returns The repeated string.
330
508
  * @public
331
509
  */
332
- export declare function repeat(s: string, times: number): string;
510
+ export declare function repeatString(s: string, times: number): string;
333
511
  /**
334
512
  * Returns a new string whose characters are in reverse order.
513
+ *
514
+ * @param s - The string to reverse.
515
+ * @returns The reversed string.
335
516
  * @public
336
517
  */
337
- export declare function reverse(s: string): string;
518
+ export declare function reverseString(s: string): string;
338
519
  /**
339
520
  * Converts a string in a quoted string.
521
+ *
522
+ * @param s - The string to quote.
523
+ * @param prefer - The preferred quote character. Defaults to single quote (`'`).
524
+ * @returns The quoted string.
340
525
  * @public
341
526
  */
342
527
  export declare function smartQuote(s: string, prefer?: string): string;
@@ -362,76 +547,120 @@ export declare function quote(s: string, quoteChar?: string): string;
362
547
  export declare function jsQuote(s: string, prefer?: string): string;
363
548
  /**
364
549
  * It only splits on the first occurrance of separator.
550
+ *
551
+ * @param s - The string to split.
552
+ * @param separator - The separator to split the string on.
553
+ * @returns An array with the split string.
365
554
  * @public
366
555
  */
367
- export declare function splitOnce(s: string, separator: string): [string] | [string, string];
556
+ export declare function splitStringOnce(s: string, separator: string): [string] | [string, string];
368
557
  /**
369
558
  * Returns `true` if `s` starts with any of the values in `values`.
559
+ *
560
+ * @param s - The string to compare.
561
+ * @param values - The values to compare with the start of `s`.
562
+ * @returns `true` if `s` starts with any of the values in `values`, `false` otherwise.
370
563
  * @public
371
564
  */
372
- export declare function startsWithAny(s: string, values: string[]): boolean;
565
+ export declare function textStartsWithAny(s: string, values: string[]): boolean;
373
566
  /**
374
567
  * Surrounds a string with the contents of `left` and `right`. If `right` is omitted,
375
568
  * `left` will be used on both sides
569
+ *
570
+ * @param s - The string to surround.
571
+ * @param left - The left side of the surrounding text.
572
+ * @param right - The right side of the surrounding text. Defaults to `left`.
573
+ * @returns The surrounded string.
376
574
  * @public
377
575
  */
378
- export declare function surround(s: string, left: string, right?: string): string;
576
+ export declare function surroundText(s: string, left: string, right?: string): string;
379
577
  /**
380
578
  * It transforms a string into an `Array` of characters.
579
+ *
580
+ * @param s - The string to transform.
581
+ * @returns An array of characters.
381
582
  * @public
382
583
  */
383
- export declare function toArray(s: string): string[];
584
+ export declare function stringToChars(s: string): string[];
384
585
  /**
385
586
  * It transforms a string into an `Array` of char codes in integer format.
587
+ *
588
+ * @param s - The string to transform.
589
+ * @returns An array of char codes.
386
590
  * @public
387
591
  */
388
- export declare function toCharcodes(s: string): number[];
592
+ export declare function stringToCharcodes(s: string): number[];
389
593
  /**
390
594
  * Returns an array of `string` whose elements are equally long (using `len`). If the string `s`
391
595
  * is not exactly divisible by `len` the last element of the array will be shorter.
596
+ *
597
+ * @param s - The string to chunk.
598
+ * @param len - The length of each chunk.
599
+ * @returns An array of chunks.
392
600
  * @public
393
601
  */
394
- export declare function toChunks(s: string, len: number): string[];
602
+ export declare function chunkText(s: string, len: number): string[];
395
603
  /**
396
604
  * Returns an array of `string` split by line breaks.
605
+ *
606
+ * @param s - The string to split.
607
+ * @returns An array of lines.
397
608
  * @public
398
609
  */
399
- export declare function toLines(s: string): string[];
610
+ export declare function stringToLines(s: string): string[];
400
611
  /**
401
612
  * `trimChars` removes from the beginning and the end of the string any character that is present in `charlist`.
613
+ *
614
+ * @param value - The string to trim.
615
+ * @param charlist - The characters to remove from the beginning and end of the string.
616
+ * @returns The trimmed string.
402
617
  * @public
403
618
  */
404
619
  export declare function trimChars(value: string, charlist: string): string;
405
620
  /**
406
621
  * `trimCharsLeft` removes from the beginning of the string any character that is present in `charlist`.
622
+ *
623
+ * @param value - The string to trim.
624
+ * @param charlist - The characters to remove from the beginning of the string.
625
+ * @returns The trimmed string.
407
626
  * @public
408
627
  */
409
628
  export declare function trimCharsLeft(value: string, charlist: string): string;
410
629
  /**
411
630
  * `trimCharsRight` removes from the end of the string any character that is present in `charlist`.
631
+ *
632
+ * @param value - The string to trim.
633
+ * @param charlist - The characters to remove from the end of the string.
634
+ * @returns The trimmed string.
412
635
  * @public
413
636
  */
414
637
  export declare function trimCharsRight(value: string, charlist: string): string;
415
638
  /**
416
639
  * `underscore` finds UpperCase characters and turns them into LowerCase and prepends them with a whtiespace.
417
640
  * Sequences of more than one UpperCase character are left untouched.
641
+ *
642
+ * @param s - The string to underscore.
643
+ * @returns The underscored string.
418
644
  * @public
419
645
  */
420
646
  export declare function underscore(s: string): string;
421
647
  /**
422
648
  * Convert first letter in `value` to upper case.
649
+ *
650
+ * @param value - The string to convert.
651
+ * @returns The string with the first letter in upper case.
423
652
  * @public
424
653
  */
425
654
  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;
432
655
  /**
433
656
  * `wrapColumns` splits a long string into lines that are at most `columns` long.
434
- * Words whose length exceeds `columns` are not split.
657
+ * Individual words whose length exceeds `columns` are not split.
658
+ *
659
+ * @param s - The string to wrap.
660
+ * @param columns - The number of columns per line.
661
+ * @param indent - The indentation string to prepend to each line.
662
+ * @param newline - The newline character to use for line breaks.
663
+ * @returns The wrapped string.
435
664
  * @public
436
665
  */
437
666
  export declare function wrapColumns(s: string, columns?: number, indent?: string, newline?: string): string;