@zinaid/str 0.0.5 → 0.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/dist/ascii/index.d.ts +14 -0
  2. package/dist/ascii/index.d.ts.map +1 -0
  3. package/dist/ascii/index.js +7 -0
  4. package/dist/base64/index.d.ts +23 -0
  5. package/dist/base64/index.d.ts.map +1 -0
  6. package/dist/base64/index.js +124 -0
  7. package/dist/{convertcase.d.ts → convertcase/index.d.ts} +11 -1
  8. package/dist/convertcase/index.d.ts.map +1 -0
  9. package/dist/index.d.ts +4 -0
  10. package/dist/index.d.ts.map +1 -1
  11. package/dist/index.js +136 -131
  12. package/dist/markdown/index.d.ts +49 -0
  13. package/dist/markdown/index.d.ts.map +1 -0
  14. package/dist/markdown/index.js +32 -0
  15. package/dist/pluralizer/index.d.ts +100 -0
  16. package/dist/pluralizer/index.d.ts.map +1 -0
  17. package/dist/{pluralizer.js → pluralizer/index.js} +39 -32
  18. package/dist/{random.d.ts → random/index.d.ts} +3 -3
  19. package/dist/random/index.d.ts.map +1 -0
  20. package/dist/{random.js → random/index.js} +2 -1
  21. package/dist/replacer/index.d.ts +31 -0
  22. package/dist/replacer/index.d.ts.map +1 -0
  23. package/dist/str.d.ts +308 -173
  24. package/dist/str.d.ts.map +1 -1
  25. package/dist/str.js +510 -661
  26. package/dist/stringable/index.d.ts +952 -0
  27. package/dist/stringable/index.d.ts.map +1 -0
  28. package/dist/{stringable.js → stringable/index.js} +400 -13
  29. package/dist/transliterate/index.d.ts +14 -0
  30. package/dist/transliterate/index.d.ts.map +1 -0
  31. package/dist/transliterate/index.js +7 -0
  32. package/dist/trimmer/index.d.ts +25 -0
  33. package/dist/trimmer/index.d.ts.map +1 -0
  34. package/dist/ulid/index.d.ts +79 -0
  35. package/dist/ulid/index.d.ts.map +1 -0
  36. package/dist/ulid/index.js +58 -0
  37. package/dist/uuid/index.d.ts +92 -0
  38. package/dist/uuid/index.d.ts.map +1 -0
  39. package/dist/uuid/index.js +50 -0
  40. package/package.json +78 -21
  41. package/dist/base64.d.ts +0 -7
  42. package/dist/base64.d.ts.map +0 -1
  43. package/dist/base64.js +0 -123
  44. package/dist/convertcase.d.ts.map +0 -1
  45. package/dist/markdown.d.ts +0 -26
  46. package/dist/markdown.d.ts.map +0 -1
  47. package/dist/markdown.js +0 -55
  48. package/dist/pluralizer.d.ts +0 -38
  49. package/dist/pluralizer.d.ts.map +0 -1
  50. package/dist/random.d.ts.map +0 -1
  51. package/dist/replacer.d.ts +0 -31
  52. package/dist/replacer.d.ts.map +0 -1
  53. package/dist/stringable.d.ts +0 -555
  54. package/dist/stringable.d.ts.map +0 -1
  55. package/dist/trimmer.d.ts +0 -4
  56. package/dist/trimmer.d.ts.map +0 -1
  57. /package/dist/{convertcase.js → convertcase/index.js} +0 -0
  58. /package/dist/{replacer.js → replacer/index.js} +0 -0
  59. /package/dist/{trimmer.js → trimmer/index.js} +0 -0
package/dist/str.d.ts CHANGED
@@ -1,6 +1,10 @@
1
1
  /**
2
2
  * Return the remainder of a string after the last occurrence of a given value.
3
3
  *
4
+ * @param subject - The string to search in
5
+ * @param search - The value to search for
6
+ * @returns The portion of the string after the last occurrence of the search value
7
+ *
4
8
  * @example
5
9
  *
6
10
  * after('A house on a lake', 'house '); -> 'on a lake'
@@ -9,30 +13,22 @@ export declare function after(subject: string, search: string | number): string;
9
13
  /**
10
14
  * Return the remainder of a string after the last occurrence of a given value.
11
15
  *
16
+ * @param subject - The string to search in
17
+ * @param search - The value to search for
18
+ * @returns The portion of the string after the last occurrence of the search value
19
+ *
12
20
  * @example
13
21
  *
14
22
  * afterLast('A house on a lake', 'a'); -> ' lake'
15
23
  */
16
24
  export declare function afterLast(subject: string, search: string | number): string;
17
- /**
18
- * Transliterate a UTF-8 value to ASCII.
19
- *
20
- * @example
21
- *
22
- * ascii('Héllo Wörld'); -> 'Hello World'
23
- */
24
- export declare function ascii(value: string): string;
25
- /**
26
- * Transliterate a string to its closest ASCII representation.
27
- *
28
- * @example
29
- *
30
- * transliterate('ⓣⓔⓢⓣ@ⓛⓐⓡⓐⓥⓔⓛ.ⓒⓞⓜ'); -> 'test@laravel.com'
31
- */
32
- export declare function transliterate(value: string): string;
33
25
  /**
34
26
  * Get the portion of a string before the first occurrence of a given value.
35
27
  *
28
+ * @param subject - The string to search in
29
+ * @param search - The value to search for
30
+ * @returns The portion of the string before the first occurrence of the search value
31
+ *
36
32
  * @example
37
33
  *
38
34
  * before('hannah', 'nah'); -> 'han'
@@ -41,6 +37,10 @@ export declare function before(subject: string, search: string | number): string
41
37
  /**
42
38
  * Get the portion of a string before the last occurrence of a given value.
43
39
  *
40
+ * @param subject - The string to search in
41
+ * @param search - The value to search for
42
+ * @returns The portion of the string before the last occurrence of the search value
43
+ *
44
44
  * @example
45
45
  *
46
46
  * beforeLast('yvette', 'tte'); -> 'yve'
@@ -49,6 +49,11 @@ export declare function beforeLast(subject: string, search: string | number): st
49
49
  /**
50
50
  * Get the portion of a string between two given values.
51
51
  *
52
+ * @param subject - The string to search in
53
+ * @param from - The starting value
54
+ * @param to - The ending value
55
+ * @returns The portion of the string between the two given values
56
+ *
52
57
  * @example
53
58
  *
54
59
  * between('foofoobar', 'foo', 'bar'); -> 'foo'
@@ -57,6 +62,11 @@ export declare function between(subject: string, from: string | number, to: stri
57
62
  /**
58
63
  * Get the smallest possible portion of a string between two given values.
59
64
  *
65
+ * @param subject - The string to search in
66
+ * @param from - The starting value
67
+ * @param to - The ending value
68
+ * @returns The smallest portion of the string between the two given values
69
+ *
60
70
  * @example
61
71
  *
62
72
  * betweenFirst('foofoobar', 'foo', 'bar'); -> 'foo'
@@ -65,6 +75,9 @@ export declare function betweenFirst(subject: string, from: string | number, to:
65
75
  /**
66
76
  * Convert a value to camel case.
67
77
  *
78
+ * @param value - The string to convert
79
+ * @returns The camel-cased string
80
+ *
68
81
  * @example
69
82
  *
70
83
  * camel('foo_bar'); -> 'fooBar'
@@ -73,6 +86,10 @@ export declare function camel(value: string): string;
73
86
  /**
74
87
  * Get the character at the specified index.
75
88
  *
89
+ * @param subject - The string to get the character from
90
+ * @param index - The index of the character to get
91
+ * @returns The character at the specified index, or false if the index is out of bounds
92
+ *
76
93
  * @example
77
94
  *
78
95
  * charAt('hello', 1); -> 'e'
@@ -81,6 +98,10 @@ export declare function charAt(subject: string, index: number): string | false;
81
98
  /**
82
99
  * Remove the given string(s) if it exists at the start of the haystack.
83
100
  *
101
+ * @param subject - The string to chop from
102
+ * @param needle - The string or strings to remove
103
+ * @returns The string with the given string(s) removed from the start
104
+ *
84
105
  * @example
85
106
  *
86
107
  * chopStart('foobar', 'foo'); -> 'bar'
@@ -89,6 +110,10 @@ export declare function chopStart(subject: string, needle: string | string[]): s
89
110
  /**
90
111
  * Remove the given string(s) if it exists at the end of the haystack.
91
112
  *
113
+ * @param subject - The string to chop from
114
+ * @param needle - The string or strings to remove
115
+ * @returns The string with the given string(s) removed from the end
116
+ *
92
117
  * @example
93
118
  *
94
119
  * chopEnd('foobar', 'bar'); -> 'foo'
@@ -97,6 +122,10 @@ export declare function chopEnd(subject: string, needle: string | string[]): str
97
122
  /**
98
123
  * Determine if a given string contains a given substring.
99
124
  *
125
+ * @param haystack - The string to search in
126
+ * @param needles - The substring or substrings to search for
127
+ * @param ignoreCase - Whether to ignore case when searching
128
+ *
100
129
  * @example
101
130
  *
102
131
  * contains('Minion', 'ni'); -> true
@@ -107,6 +136,11 @@ export declare function contains(haystack: string, needles: string | Iterable<st
107
136
  /**
108
137
  * Extracts an excerpt from text that matches the first instance of a phrase.
109
138
  *
139
+ * @param text - The text to extract the excerpt from
140
+ * @param phrase - The phrase to search for
141
+ * @param options - Additional options for excerpt extraction
142
+ * @returns The extracted excerpt, or null if the phrase is not found
143
+ *
110
144
  * @example
111
145
  * excerpt('The quick brown fox', 'brown', { radius: 5 });
112
146
  */
@@ -117,6 +151,11 @@ export declare function excerpt(text: string | null, phrase?: string | null, opt
117
151
  /**
118
152
  * Determine if a given string contains all array values.
119
153
  *
154
+ * @param haystack - The string to search in
155
+ * @param needles - The substrings to search for
156
+ * @param ignoreCase - Whether to ignore case when searching
157
+ * @returns True if all substrings are found, false otherwise
158
+ *
120
159
  * @example
121
160
  *
122
161
  * containsAll('Taylor Otwell', ['taylor', 'otwell'], false); -> true
@@ -126,6 +165,11 @@ export declare function containsAll(haystack: string, needles: Iterable<string>,
126
165
  /**
127
166
  * Determine if a given string doesn't contain a given substring.
128
167
  *
168
+ * @param haystack - The string to search in
169
+ * @param needles - The substring or substrings to search for
170
+ * @param ignoreCase - Whether to ignore case when searching
171
+ * @returns True if the substring is not found, false otherwise
172
+ *
129
173
  * @example
130
174
  *
131
175
  * doesntContain('Minion', 'ni'); -> false
@@ -136,6 +180,10 @@ export declare function doesntContain(haystack: string, needles: string | Iterab
136
180
  /**
137
181
  * Replace consecutive instances of a given character with a single character in the given string.
138
182
  *
183
+ * @param value - The string to process
184
+ * @param character - The character or characters to deduplicate
185
+ * @returns The string with consecutive instances of the character(s) replaced by a single instance
186
+ *
139
187
  * @example
140
188
  *
141
189
  * deduplicate('hello world'); -> 'hello world'
@@ -147,6 +195,10 @@ export declare function deduplicate(value: string, character?: string | string[]
147
195
  /**
148
196
  * Determine if a given string ends with a given substring.
149
197
  *
198
+ * @param haystack - The string to search in
199
+ * @param needles - The substring or substrings to search for
200
+ * @returns True if the string ends with any of the substrings, false otherwise
201
+ *
150
202
  * @example
151
203
  *
152
204
  * endsWith("Jason", "on"); -> true
@@ -156,6 +208,10 @@ export declare function endsWith(haystack: string | number | null, needles: stri
156
208
  /**
157
209
  * Determine if a given string doesn't end with a given substring.
158
210
  *
211
+ * @param haystack - The string to search in
212
+ * @param needles - The substring or substrings to search for
213
+ * @returns True if the string does not end with any of the substrings, false otherwise
214
+ *
159
215
  * @example
160
216
  *
161
217
  * doesntEndWith("Jason", "on"); -> false
@@ -165,6 +221,10 @@ export declare function doesntEndWith(haystack: string | number | null, needles:
165
221
  /**
166
222
  * Cap a string with a single instance of a given value.
167
223
  *
224
+ * @param value - The string to cap
225
+ * @param cap - The string to cap with
226
+ * @returns The capped string
227
+ *
168
228
  * @example
169
229
  *
170
230
  * finish('hello', '!'); -> 'hello!'
@@ -173,6 +233,11 @@ export declare function finish(value: string, cap: string): string;
173
233
  /**
174
234
  * Wrap the string with the given strings.
175
235
  *
236
+ * @param value - The string to wrap
237
+ * @param before - The string to prepend
238
+ * @param after - The string to append (if null, use the 'before' string)
239
+ * @returns The wrapped string
240
+ *
176
241
  * @example
177
242
  *
178
243
  * wrap('hello', '[', ']'); -> '[hello]'
@@ -181,6 +246,11 @@ export declare function wrap(value: string, before: string, after?: string | nul
181
246
  /**
182
247
  * Unwrap the string with the given strings.
183
248
  *
249
+ * @param value - The string to unwrap
250
+ * @param before - The string to remove from the start
251
+ * @param after - The string to remove from the end (if null, use the 'before' string)
252
+ * @returns The unwrapped string
253
+ *
184
254
  * @example
185
255
  *
186
256
  * unwrap('[hello]', '[', ']'); -> 'hello'
@@ -189,6 +259,11 @@ export declare function unwrap(value: string, before: string, after?: string | n
189
259
  /**
190
260
  * Determine if a given string matches a given pattern.
191
261
  *
262
+ * @param pattern - The pattern or patterns to match against
263
+ * @param value - The string or number to check
264
+ * @param ignoreCase - Whether to ignore case when matching
265
+ * @return True if the string matches the pattern, false otherwise
266
+ *
192
267
  * @example
193
268
  *
194
269
  * is('hello', 'hello'); -> true
@@ -199,6 +274,9 @@ export declare function is(pattern: string | Iterable<string>, value: string | n
199
274
  /**
200
275
  * Determine if a given string is 7 bit ASCII.
201
276
  *
277
+ * @param value - The string to check
278
+ * @returns True if the string is ASCII, false otherwise
279
+ *
202
280
  * @example
203
281
  *
204
282
  * isAscii("Hello World"); -> true
@@ -211,6 +289,9 @@ export declare function isAscii(value: string): boolean;
211
289
  /**
212
290
  * Determine if a given value is valid JSON.
213
291
  *
292
+ * @param value - The value to check if it's JSON
293
+ * @returns True if the value is valid JSON, false otherwise
294
+ *
214
295
  * @example
215
296
  *
216
297
  * isJson('{"name": "John", "age": 30}'); -> true
@@ -223,6 +304,7 @@ export declare function isJson(value: unknown): boolean;
223
304
  *
224
305
  * @param value - The value to check if it's URL
225
306
  * @param protocols - An optional array of allowed protocols (e.g., ['http', 'https'])
307
+ * @return True if the value is a valid URL, false otherwise
226
308
  *
227
309
  * @example
228
310
  *
@@ -231,26 +313,12 @@ export declare function isJson(value: unknown): boolean;
231
313
  * isUrl('invalid url'); -> false
232
314
  */
233
315
  export declare function isUrl(value: string | unknown, protocols?: string[]): boolean;
234
- /**
235
- * Determine if a given value is a valid UUID.
236
- *
237
- * @example
238
- *
239
- * isUuid("550e8400-e29b-41d4-a716-446655440000", 4); -> true
240
- * isUuid("550e8400-e29b-41d4-a716-446655440000", 5); -> false
241
- */
242
- export declare function isUuid(value: string | unknown, version?: number | "nil" | "max" | null): boolean;
243
- /**
244
- * Determine if a given value is a valid ULID.
245
- *
246
- * @example
247
- *
248
- * isUlid("01F8MECHZX2D7J8F8C8D4B8F8C"); -> true
249
- */
250
- export declare function isUlid(value: unknown): boolean;
251
316
  /**
252
317
  * Convert a string to kebab case.
253
318
  *
319
+ * @param value - The string to convert
320
+ * @returns The kebab-cased string
321
+ *
254
322
  * @example
255
323
  *
256
324
  * kebab("Laravel PHP Framework"); -> "laravel-php-framework"
@@ -259,6 +327,9 @@ export declare function kebab(value: string): string;
259
327
  /**
260
328
  * Return the length of the given string.
261
329
  *
330
+ * @param value - The string to measure
331
+ * @returns The length of the string
332
+ *
262
333
  * @example
263
334
  *
264
335
  * length("Hello World"); -> 11
@@ -267,16 +338,19 @@ export declare function length(value: string): number;
267
338
  /**
268
339
  * Limit the number of characters in a string.
269
340
  *
270
- * @param string $value
271
- * @param int $limit
272
- * @param string $end
273
- * @param bool $preserveWords
274
- * @return string
341
+ * @param value - The string to limit
342
+ * @param limit - The maximum number of characters
343
+ * @param end - The string to append if the value is truncated
344
+ * @param preserveWords - Whether to preserve whole words when truncating
345
+ * @returns The limited string
275
346
  */
276
347
  export declare function limit(value: string, limit?: number, end?: string, preserveWords?: boolean): string;
277
348
  /**
278
349
  * Convert the given string to lower-case.
279
350
  *
351
+ * @param value - The string to convert
352
+ * @returns The lower-cased string
353
+ *
280
354
  * @example
281
355
  *
282
356
  * lower("Hello World"); -> "hello world"
@@ -285,6 +359,11 @@ export declare function lower(value: string): string;
285
359
  /**
286
360
  * Limit the number of words in a string.
287
361
  *
362
+ * @param value - The string to limit
363
+ * @param words - The maximum number of words
364
+ * @param end - The string to append if the value is truncated
365
+ * @returns The limited string
366
+ *
288
367
  * @example
289
368
  *
290
369
  * words("Laravel PHP Framework", 2); -> "Laravel PHP Framework"
@@ -294,6 +373,12 @@ export declare function words(value: string, words?: number, end?: string): stri
294
373
  /**
295
374
  * Masks a portion of a string with a repeated character.
296
375
  *
376
+ * @param value - The string to mask
377
+ * @param character - The character to use for masking
378
+ * @param index - The starting index to begin masking (can be negative)
379
+ * @param length - The number of characters to mask (if null, mask to the end of the string)
380
+ * @returns The masked string
381
+ *
297
382
  * @example
298
383
  *
299
384
  * mask("taylor@email.com", "*", 3); -> "tay*************"
@@ -305,14 +390,18 @@ export declare function mask(value: string, character: string, index: number, le
305
390
  /**
306
391
  * Get the string matching the given pattern.
307
392
  *
308
- * @param string $pattern
309
- * @param string $subject
310
- * @return string
393
+ * @param pattern - The regex pattern to match
394
+ * @param subject - The string to search within
395
+ * @returns The matched string or an empty string if no match
311
396
  */
312
397
  export declare function match(pattern: string, subject: string): string;
313
398
  /**
314
399
  * Determine if a given string matches a given pattern.
315
400
  *
401
+ * @param pattern - The pattern or patterns to match against
402
+ * @param value - The string to check
403
+ * @return True if the string matches the pattern, false otherwise
404
+ *
316
405
  * @example
317
406
  *
318
407
  * Str::isMatch('/foo/', 'foo bar'); // true
@@ -322,6 +411,10 @@ export declare function isMatch(pattern: string | Iterable<string>, value: strin
322
411
  /**
323
412
  * Get the string matching the given pattern.
324
413
  *
414
+ * @param pattern - The regex pattern to match
415
+ * @param subject - The string to search within
416
+ * @returns An array of all matched strings
417
+ *
325
418
  * @example
326
419
  *
327
420
  * matchAll("/foo (.*)/", "foo bar baz"); -> ["foo bar baz"]
@@ -330,6 +423,9 @@ export declare function matchAll(pattern: string, subject: string): string[];
330
423
  /**
331
424
  * Remove all non-numeric characters from a string.
332
425
  *
426
+ * @param value - The string or array of strings to process
427
+ * @returns The numeric-only string or array of strings
428
+ *
333
429
  * @example
334
430
  *
335
431
  * numbers("foo123bar"); -> "123"
@@ -339,15 +435,20 @@ export declare function numbers(value: string | string[]): string | string[];
339
435
  /**
340
436
  * Pad both sides of a string with another.
341
437
  *
342
- * @param string $value
343
- * @param int $length
344
- * @param string $pad
345
- * @return string
438
+ * @param value - The string to pad
439
+ * @param length - The desired total length after padding
440
+ * @param pad - The string to use for padding
441
+ * @returns The padded string
346
442
  */
347
443
  export declare function padBoth(value: string, length: number, pad?: string): string;
348
444
  /**
349
445
  * Pad the left side of a string with another.
350
446
  *
447
+ * @param value - The string to pad
448
+ * @param length - The desired total length after padding
449
+ * @param pad - The string to use for padding
450
+ * @returns The padded string
451
+ *
351
452
  * @example
352
453
  *
353
454
  * padLeft("Alien", 10, "-="); -> "-=-=-Alien"
@@ -359,6 +460,11 @@ export declare function padLeft(value: string, length: number, pad?: string): st
359
460
  /**
360
461
  * Pad the right side of a string with another.
361
462
  *
463
+ * @param value - The string to pad
464
+ * @param length - The desired total length after padding
465
+ * @param pad - The string to use for padding
466
+ * @returns The padded string
467
+ *
362
468
  * @example
363
469
  *
364
470
  * padRight("Alien", 10, "-="); -> "Alien-=-="
@@ -370,6 +476,10 @@ export declare function padRight(value: string, length: number, pad?: string): s
370
476
  /**
371
477
  * Create a padding string.
372
478
  *
479
+ * @param padStr - The string to use for padding
480
+ * @param needed - The total length of padding needed
481
+ * @returns The generated padding string
482
+ *
373
483
  * @example
374
484
  *
375
485
  * makePad(" ", 5); -> " "
@@ -377,22 +487,6 @@ export declare function padRight(value: string, length: number, pad?: string): s
377
487
  * makePad("❤", 5); -> "❤❤❤❤❤"
378
488
  */
379
489
  export declare function makePad(padStr: string, needed: number): string;
380
- /**
381
- * Pluralize the last word of an English, studly caps case string.
382
- *
383
- * @example
384
- *
385
- * pluralStudly("These are the school", 4); -> "These are the schools"
386
- */
387
- export declare function pluralStudly(value: string, count?: number): string;
388
- /**
389
- * Pluralize the last word of an English, Pascal caps case string.
390
- *
391
- * @example
392
- *
393
- * pluralPascal("These are the school", 4); -> "These are the schools"
394
- */
395
- export declare function pluralPascal(value: string, count?: number): string;
396
490
  /**
397
491
  * Generate a random, secure password.
398
492
  *
@@ -412,6 +506,11 @@ export declare function password(length?: number, letters?: boolean, numbers?: b
412
506
  /**
413
507
  * Find the multi-byte safe position of the first occurrence of a given substring in a string.
414
508
  *
509
+ * @param haystack - The string to search within
510
+ * @param needle - The substring to search for
511
+ * @param offset - The position to start searching from (can be negative)
512
+ * @returns The position of the first occurrence or false if not found
513
+ *
415
514
  * @example
416
515
  *
417
516
  * position('Hello, World!', 'World!'); -> 7
@@ -421,6 +520,9 @@ export declare function position(haystack: string, needle: string, offset?: numb
421
520
  /**
422
521
  * Generate a more truly "random" alpha-numeric string.
423
522
  *
523
+ * @param length - The desired length of the random string (default: 16)
524
+ * @returns The generated random string
525
+ *
424
526
  * @example
425
527
  *
426
528
  * random(); -> "a1b2c3d4e5f6g7h8"
@@ -429,6 +531,9 @@ export declare function random(length?: number): string;
429
531
  /**
430
532
  * Set the callable that will be used to generate random strings.
431
533
  *
534
+ * @param factory - The factory function to generate random strings
535
+ * @returns void
536
+ *
432
537
  * @example
433
538
  *
434
539
  * createRandomStringsUsing((length) => "x".repeat(length));
@@ -437,6 +542,10 @@ export declare function createRandomStringsUsing(factory: ((length: number) => s
437
542
  /**
438
543
  * Set the sequence that will be used to generate random strings.
439
544
  *
545
+ * @param sequence - An array of strings to use in sequence
546
+ * @param whenMissing - An optional callable to generate strings when the sequence is exhausted
547
+ * @returns void
548
+ *
440
549
  * @example
441
550
  *
442
551
  * createRandomStringsUsingSequence(['a', 'b', 'c']);
@@ -446,6 +555,8 @@ export declare function createRandomStringsUsingSequence(sequence: string[], whe
446
555
  /**
447
556
  * Indicate that random strings should be created normally and not using a custom factory.
448
557
  *
558
+ * @returns void
559
+ *
449
560
  * @example
450
561
  *
451
562
  * createRandomStringsNormally();
@@ -454,6 +565,10 @@ export declare function createRandomStringsNormally(): void;
454
565
  /**
455
566
  * Repeat the given string.
456
567
  *
568
+ * @param string - The string to repeat
569
+ * @param times - The number of times to repeat the string
570
+ * @returns The repeated string
571
+ *
457
572
  * @example
458
573
  *
459
574
  * repeat("foo", 3); -> "foofoofoo"
@@ -462,6 +577,11 @@ export declare function repeat(string: string, times: number): string;
462
577
  /**
463
578
  * Replace a given value in the string sequentially with an array.
464
579
  *
580
+ * @param search - The value to search for
581
+ * @param replace - The array or record of replacements
582
+ * @param subject - The string to perform replacements on
583
+ * @returns The resulting string after replacements
584
+ *
465
585
  * @example
466
586
  *
467
587
  * replaceArray('?', ['foo', 'bar', 'baz'], '?/?/?'); -> 'foo/bar/baz'
@@ -472,6 +592,10 @@ export declare function replaceArray(search: string, replace: Record<string, str
472
592
  /**
473
593
  * Convert the given value to a string or return the given fallback on failure.
474
594
  *
595
+ * @param value - The value to convert
596
+ * @param fallback - The fallback string to return on failure
597
+ * @returns The converted string or the fallback
598
+ *
475
599
  * @example
476
600
  *
477
601
  * toStringOr(123);
@@ -480,6 +604,12 @@ export declare function toStringOr(value: unknown, fallback: string): string;
480
604
  /**
481
605
  * Replace the given value in the given string.
482
606
  *
607
+ * @param search - The value or values to search for
608
+ * @param replacement - The value or values to replace with
609
+ * @param subject - The string or array of strings to perform replacements on
610
+ * @param caseSensitive - Whether the search should be case-sensitive (default: true)
611
+ * @returns The resulting string or array of strings after replacements
612
+ *
483
613
  * @example
484
614
  *
485
615
  * replace("foo", "bar", "foo baz"); -> "bar baz"
@@ -488,6 +618,11 @@ export declare function replace<T extends string | Iterable<string>>(search: str
488
618
  /**
489
619
  * Replace the first occurrence of a given value in the string.
490
620
  *
621
+ * @param search - The value to search for
622
+ * @param replace - The value to replace with
623
+ * @param subject - The string to perform the replacement on
624
+ * @returns The resulting string after replacement
625
+ *
491
626
  * @example
492
627
  *
493
628
  * replaceFirst('bar', 'qux', 'foobar foobar'); -> 'fooqux foobar'
@@ -496,15 +631,20 @@ export declare function replaceFirst(search: string | number, replace: string, s
496
631
  /**
497
632
  * Replace the first occurrence of the given value if it appears at the start of the string.
498
633
  *
499
- * @param string $search
500
- * @param string $replace
501
- * @param string $subject
502
- * @return string
634
+ * @param search - The value to search for
635
+ * @param replace - The value to replace with
636
+ * @param subject - The string to perform the replacement on
637
+ * @returns The resulting string after replacement
503
638
  */
504
639
  export declare function replaceStart(search: string | number, replace: string, subject: string): string;
505
640
  /**
506
641
  * Replace the last occurrence of a given value in the string.
507
642
  *
643
+ * @param search - The value to search for
644
+ * @param replace - The value to replace with
645
+ * @param subject - The string to perform the replacement on
646
+ * @returns The resulting string after replacement
647
+ *
508
648
  * @example
509
649
  *
510
650
  * replaceLast('bar', 'qux', 'foobar foobar'); -> 'foobar foobarqux'
@@ -513,6 +653,11 @@ export declare function replaceLast(search: string | number, replace: string, su
513
653
  /**
514
654
  * Replace the last occurrence of a given value if it appears at the end of the string.
515
655
  *
656
+ * @param search - The value to search for
657
+ * @param replace - The value to replace with
658
+ * @param subject - The string to perform the replacement on
659
+ * @returns The resulting string after replacement
660
+ *
516
661
  * @example
517
662
  *
518
663
  * replaceEnd('bar', 'qux', 'foobar foobar'); -> 'foobar fooqux'
@@ -521,6 +666,12 @@ export declare function replaceEnd(search: string | number, replace: string, sub
521
666
  /**
522
667
  * Replace the patterns matching the given regular expression.
523
668
  *
669
+ * @param pattern - The regex pattern or patterns to search for
670
+ * @param replace - The replacement string, array of strings, or function
671
+ * @param subject - The string or array of strings to perform replacements on
672
+ * @param limit - The maximum number of replacements per pattern (-1 for no limit)
673
+ * @returns The resulting string, array of strings, or null on error
674
+ *
524
675
  * @example
525
676
  *
526
677
  * replaceMatches(/foo/, 'bar', 'foobar'); -> 'barbar'
@@ -531,6 +682,9 @@ export declare function replaceMatches(pattern: string | string[] | RegExp | Reg
531
682
  /**
532
683
  * Strip HTML tags from a string.
533
684
  *
685
+ * @param value - The string to process
686
+ * @returns The string with HTML tags removed
687
+ *
534
688
  * @example
535
689
  *
536
690
  * stripTags("<p>Hello World</p>"); -> "Hello World"
@@ -539,6 +693,11 @@ export declare function stripTags(value: string): string;
539
693
  /**
540
694
  * Remove any occurrence of the given string in the subject.
541
695
  *
696
+ * @param search - The string or strings to remove
697
+ * @param subject - The string or strings to process
698
+ * @param caseSensitive - Whether the search should be case-sensitive (default: true)
699
+ * @returns The resulting string or array of strings after removal
700
+ *
542
701
  * @example
543
702
  *
544
703
  * remove("foo", "foobar"); -> "bar"
@@ -548,6 +707,9 @@ export declare function remove(search: string | Iterable<string>, subject: strin
548
707
  /**
549
708
  * Reverse the given string.
550
709
  *
710
+ * @param value - The string to reverse
711
+ * @returns The reversed string
712
+ *
551
713
  * @example
552
714
  *
553
715
  * reverse("hello"); -> "olleh"
@@ -558,6 +720,10 @@ export declare function reverse(value: string): string;
558
720
  /**
559
721
  * Begin a string with a single instance of a given value.
560
722
  *
723
+ * @param value - The string to process
724
+ * @param prefix - The prefix to ensure at the start
725
+ * @returns The resulting string starting with the prefix
726
+ *
561
727
  * @example
562
728
  *
563
729
  * start("test/string", "/"); -> "/test/string"
@@ -568,6 +734,9 @@ export declare function start(value: string, prefix: string): string;
568
734
  /**
569
735
  * Convert the given string to proper case for each word.
570
736
  *
737
+ * @param value - The string to convert
738
+ * @returns The converted string in headline case
739
+ *
571
740
  * @example
572
741
  *
573
742
  * headline("foo bar baz"); -> "Foo Bar Baz"
@@ -577,7 +746,10 @@ export declare function headline(value: string): string;
577
746
  /**
578
747
  * Convert the given string to APA-style title case.
579
748
  *
580
- * See: https://apastyle.apa.org/style-grammar-guidelines/capitalization/title-case
749
+ * @param value - The string to convert
750
+ * @returns The converted string in APA title case
751
+ *
752
+ * @see https://apastyle.apa.org/style-grammar-guidelines/capitalization/title-case
581
753
  *
582
754
  * @example
583
755
  *
@@ -588,34 +760,41 @@ export declare function apa(value: string): string;
588
760
  /**
589
761
  * Generate a URL friendly "slug" from a given string.
590
762
  *
591
- * @param string $title
592
- * @param string $separator
593
- * @param array<string, string> $dictionary
594
- * @return string
763
+ * @param title - The string to convert to a slug
764
+ * @param separator - The word separator to use (default: "-")
765
+ * @param dictionary - An optional dictionary of replacements
766
+ * @returns The generated slug string
595
767
  */
596
768
  export declare function slug(title: string, separator?: string, dictionary?: Record<string, string>): string;
597
769
  /**
598
770
  * Convert a string to snake case.
599
771
  *
600
- * @param string $value
601
- * @param string $delimiter
602
- * @return string
772
+ * @param value - The string to convert
773
+ * @param delimiter - The word delimiter to use (default: "_")
774
+ * @returns The converted string in snake case
603
775
  */
604
776
  export declare function snake(value: string, delimiter?: string): string;
605
777
  /**
606
- * Remove all "extra" blank space from the given string.
607
- *
608
- * @example
609
- *
610
- * squish(`
611
- foo
612
- bar
613
- `); -> "foo bar"
614
- */
778
+ * Remove all "extra" blank space from the given string.
779
+ *
780
+ * @param value - The string to process
781
+ * @returns The resulting string with extra spaces removed
782
+ *
783
+ * @example
784
+ *
785
+ * squish(`
786
+ foo
787
+ bar
788
+ `); -> "foo bar"
789
+ */
615
790
  export declare function squish(value: string): string;
616
791
  /**
617
792
  * Determine if a given string starts with a given substring.
618
793
  *
794
+ * @param haystack - The string to search in
795
+ * @param needles - The substring or substrings to search for
796
+ * @returns True if the haystack starts with any of the needles, false otherwise
797
+ *
619
798
  * @example
620
799
  *
621
800
  * startsWith("hello world", "hello"); -> true
@@ -625,6 +804,10 @@ export declare function startsWith(haystack: string | number | null, needles: st
625
804
  /**
626
805
  * Determine if a given string doesn't start with a given substring.
627
806
  *
807
+ * @param haystack - The string to search in
808
+ * @param needles - The substring or substrings to search for
809
+ * @returns True if the haystack doesn't start with any of the needles, false otherwise
810
+ *
628
811
  * @example
629
812
  *
630
813
  * expect(doesntStartWith("jason", ["day"])).toBe(true);
@@ -633,6 +816,9 @@ export declare function doesntStartWith(haystack: string | number | null, needle
633
816
  /**
634
817
  * Convert a value to studly caps case.
635
818
  *
819
+ * @param value - The string to convert
820
+ * @returns The converted string in studly caps case
821
+ *
636
822
  * @example
637
823
  *
638
824
  * studly("fooBar"); -> "FooBar"
@@ -643,13 +829,17 @@ export declare function studly(value: string): string;
643
829
  /**
644
830
  * Convert a value to Pascal case.
645
831
  *
646
- * @param string $value
647
- * @return string
832
+ * @param value - The string to convert
833
+ * @returns The converted string in Pascal case
648
834
  */
649
835
  export declare function pascal(value: string): string;
650
836
  /**
651
837
  * Swap multiple keywords in a string with other keywords.
652
838
  *
839
+ * @param map - The record of replacements
840
+ * @param subject - The string to perform replacements on
841
+ * @returns The resulting string after replacements
842
+ *
653
843
  * @example
654
844
  *
655
845
  * swap(
@@ -664,6 +854,10 @@ export declare function swap(map: Record<string, string>, subject: string): stri
664
854
  /**
665
855
  * Take the first or last {$limit} characters of a string.
666
856
  *
857
+ * @param value - The string to process
858
+ * @param limit - The number of characters to take (negative for from end)
859
+ * @returns The resulting substring
860
+ *
667
861
  * @example
668
862
  *
669
863
  * take("hello world", 5); -> "hello"
@@ -673,6 +867,9 @@ export declare function take(value: string, limit: number): string;
673
867
  /**
674
868
  * Make a string's first character lowercase.
675
869
  *
870
+ * @param value - The string to process
871
+ * @returns The resulting string with the first character in lowercase
872
+ *
676
873
  * @example
677
874
  *
678
875
  * lcfirst('Hello World'); -> 'hello World'
@@ -681,6 +878,9 @@ export declare function lcfirst(value: string): string;
681
878
  /**
682
879
  * Make a string's first character uppercase.
683
880
  *
881
+ * @param value - The string to process
882
+ * @returns The resulting string with the first character in uppercase
883
+ *
684
884
  * @example
685
885
  *
686
886
  * ucfirst('hello world'); -> 'Hello world'
@@ -689,6 +889,9 @@ export declare function ucfirst(value: string): string;
689
889
  /**
690
890
  * Split a string into pieces by uppercase characters.
691
891
  *
892
+ * @param value - The string to split
893
+ * @returns An array of string segments split at uppercase characters
894
+ *
692
895
  * @example
693
896
  *
694
897
  * ucsplit('laravelPHPFramework'); -> ['laravel', 'P', 'H', 'P', 'Framework']
@@ -699,6 +902,10 @@ export declare function ucsplit(value: string): string[];
699
902
  /**
700
903
  * Uppercase the first letter of each word in a string.
701
904
  *
905
+ * @param value - The string to process
906
+ * @param separators - The word separators to use (default: whitespace characters)
907
+ * @returns The resulting string with each word capitalized
908
+ *
702
909
  * @example
703
910
  *
704
911
  * ucwords('hello world'); -> 'Hello World'
@@ -709,6 +916,10 @@ export declare function ucwords(value: string, separators?: string | string[]):
709
916
  /**
710
917
  * Get the number of words a string contains.
711
918
  *
919
+ * @param value - The string to analyze
920
+ * @param characters - Additional characters to consider as part of words
921
+ * @returns The word count in the string
922
+ *
712
923
  * @example
713
924
  *
714
925
  * wordCount('Hello, world!'); -> 2
@@ -718,6 +929,12 @@ export declare function wordCount(value: string, characters?: string | null): nu
718
929
  /**
719
930
  * Wrap a string to a given number of characters.
720
931
  *
932
+ * @param value - The string to wrap
933
+ * @param characters - The maximum number of characters per line (default: 75)
934
+ * @param breakStr - The string to insert as a line break (default: "\n")
935
+ * @param cutLongWords - Whether to cut words longer than the limit (default: false)
936
+ * @returns The resulting wrapped string
937
+ *
721
938
  * @example
722
939
  *
723
940
  * wordWrap("Hello World", 3, "<br />"); -> "Hello<br />World"
@@ -725,97 +942,11 @@ export declare function wordCount(value: string, characters?: string | null): nu
725
942
  * wordWrap("❤Multi Byte☆❤☆❤☆❤", 3, "<br />"); -> "❤Multi<br />Byte☆❤☆❤☆❤"
726
943
  */
727
944
  export declare function wordWrap(value: string, characters?: number, breakStr?: string, cutLongWords?: boolean): string;
728
- /**
729
- * Generate a UUID (version 4).
730
- *
731
- * @example
732
- *
733
- * uuid(); -> "550e8400-e29b-41d4-a716-446655440000"
734
- */
735
- export declare function uuid(): string;
736
- /**
737
- * Generate a UUID (version 7).
738
- *
739
- * @example
740
- *
741
- * uuid7(); -> "550e8400-e29b-41d4-a716-446655440000"
742
- */
743
- export declare function uuid7(): string;
744
- /**
745
- * Set the callable that will be used to generate UUIDs.
746
- *
747
- * @example
748
- *
749
- * createUuidsUsing(() => "custom-uuid");
750
- */
751
- export declare function createUuidsUsing(factory?: (() => string) | null): void;
752
- /**
753
- * Set the sequence that will be used to generate UUIDs.
754
- *
755
- * @example
756
- *
757
- * createUuidsUsingSequence(["uuid1", "uuid2"], () => "custom-uuid");
758
- */
759
- export declare function createUuidsUsingSequence(sequence: string[], whenMissing?: (() => string) | null): void;
760
- /**
761
- * Always return the same UUID when generating new UUIDs.
762
- *
763
- * @example
764
- *
765
- * freezeUuids();
766
- */
767
- export declare function freezeUuids(callback?: ((value: string) => string) | null): string;
768
- /**
769
- * Indicate that UUIDs should be created normally and not using a custom factory.
770
- *
771
- * @example
772
- *
773
- * createUuidsNormally();
774
- */
775
- export declare function createUuidsNormally(): void;
776
- /**
777
- * Generate a ULID.
778
- *
779
- * @example
780
- *
781
- * ulid(); -> "01F8MECHZX2D7J8F8C8D4B8F8C"
782
- */
783
- export declare function ulid(time?: Date | number | null): string;
784
- /**
785
- * Indicate that ULIDs should be created normally and not using a custom factory.
786
- *
787
- * @example
788
- *
789
- * createUlidsNormally();
790
- */
791
- export declare function createUlidsNormally(): void;
792
- /**
793
- * Set the callable that will be used to generate ULIDs.
794
- *
795
- * @example
796
- *
797
- * createUlidsUsing(() => of("1234").toString());
798
- */
799
- export declare function createUlidsUsing(factory?: (() => string) | null): void;
800
- /**
801
- * Set the sequence that will be used to generate ULIDs.
802
- *
803
- * @example
804
- *
805
- * createUlidsUsingSequence(["ulid1", "ulid2"], () => "custom-ulid");
806
- */
807
- export declare function createUlidsUsingSequence(sequence: string[], whenMissing?: (() => string) | null): void;
808
- /**
809
- * Always return the same ULID when generating new ULIDs.
810
- *
811
- * @example
812
- *
813
- * freezeUlids(() => "custom-ulid");
814
- */
815
- export declare function freezeUlids(callback?: ((value: string) => string) | null): string;
816
945
  /**
817
946
  * Get the size of the snake cache.
818
947
  *
948
+ * @returns The size of the snake cache
949
+ *
819
950
  * @example
820
951
  *
821
952
  * snakeCacheSize();
@@ -824,6 +955,8 @@ export declare function snakeCacheSize(): number;
824
955
  /**
825
956
  * Get the size of the camel cache.
826
957
  *
958
+ * @returns The size of the camel cache
959
+ *
827
960
  * @example
828
961
  *
829
962
  * camelCacheSize();
@@ -832,6 +965,8 @@ export declare function camelCacheSize(): number;
832
965
  /**
833
966
  * Get the size of the studly cache.
834
967
  *
968
+ * @returns The size of the studly cache
969
+ *
835
970
  * @example
836
971
  *
837
972
  * studlyCacheSize();
@@ -840,7 +975,7 @@ export declare function studlyCacheSize(): number;
840
975
  /**
841
976
  * Remove all strings from the casing caches.
842
977
  *
843
- * @return void
978
+ * @returns void
844
979
  */
845
980
  export declare function flushCache(): void;
846
981
  //# sourceMappingURL=str.d.ts.map