@h3ravel/support 0.10.4 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -1,6 +1,10 @@
1
1
  /// <reference path="./app.globals.d.ts" />
2
+ import "node:module";
2
3
  import { DotFlatten, DotNestedKeys, DotNestedValue } from "@h3ravel/shared";
4
+ import dayjs, { ConfigType, Dayjs, OpUnitType } from "dayjs";
3
5
 
6
+ //#region rolldown:runtime
7
+ //#endregion
4
8
  //#region src/Contracts/StrContract.d.ts
5
9
  /**
6
10
  * Converts CamelCased strings to snake_case
@@ -14,6 +18,17 @@ type SnakeToCamelCase<S extends string> = S extends `${infer T}_${infer U}` ? `$
14
18
  * Converts snake_cased strings to TitleCasea
15
19
  */
16
20
  type SnakeToTitleCase<S extends string> = S extends `${infer First}_${infer Rest}` ? `${Capitalize<Lowercase<First>>}${SnakeToTitleCase<Rest>}` : Capitalize<Lowercase<S>>;
21
+ type HtmlStringType = HTMLElement | Node | string;
22
+ type ExcerptOptions = {
23
+ radius?: number;
24
+ omission?: string;
25
+ };
26
+ type Value<T> = boolean | ((instance: T) => boolean);
27
+ type Callback<T> = (instance: T, value: boolean) => T | void | undefined;
28
+ type Fallback<T> = Callback<T> | null;
29
+ interface Function {
30
+ (...args: any[]): any;
31
+ }
17
32
  //#endregion
18
33
  //#region src/Contracts/ObjContract.d.ts
19
34
  /**
@@ -24,8 +39,9 @@ type TGeneric<V = any, K extends string = string> = Record<K, V>;
24
39
  type XGeneric<V = TGeneric, T = any> = {
25
40
  [key: string]: T;
26
41
  } & V;
27
- //#endregion
28
- //#region src/Helpers/Arr.d.ts
42
+ declare namespace Arr_d_exports {
43
+ export { alternate, chunk, collapse, combine, find, first, flatten, forget, isEmpty, isNotEmpty, last, pop, prepend, range, reverse, shift, take };
44
+ }
29
45
  /**
30
46
  * Splits an array into chunks of a specified size.
31
47
  *
@@ -35,6 +51,40 @@ type XGeneric<V = TGeneric, T = any> = {
35
51
  * @returns An array of chunks (arrays)
36
52
  */
37
53
  declare const chunk: <T>(arr: T[], size?: number) => T[][];
54
+ /**
55
+ * Collapse an array of arrays into a single array.
56
+ */
57
+ declare const collapse: <T>(arr: (T | T[])[]) => T[];
58
+ /**
59
+ * Alternates between two arrays, creating a zipped result.
60
+ */
61
+ declare const alternate: <T>(a: T[], b: T[]) => T[];
62
+ /**
63
+ * Combine arrays and sum their values element by element.
64
+ */
65
+ declare const combine: (...arr: number[][]) => number[];
66
+ /** Find the value associated with a given key. */
67
+ declare const find: <T>(key: T, arr: T[]) => T | null;
68
+ /** Returns a new array without the given indices. */
69
+ declare const forget: <T>(arr: T[], keys: number[]) => T[];
70
+ /** Remove the first element and return tuple [el, rest]. */
71
+ declare const first: <T>(arr: T[]) => [T, T[]];
72
+ /** Remove the last element and return tuple [el, rest]. */
73
+ declare const last: <T>(arr: T[]) => [T, T[]];
74
+ /** Check if array is empty. */
75
+ declare const isEmpty: <T>(arr: T[]) => boolean;
76
+ /** Check if array is empty. */
77
+ declare const isNotEmpty: <T>(arr: T[]) => boolean;
78
+ /** Pop the element off the end of array. */
79
+ declare const pop: <T>(arr: T[]) => T[];
80
+ /** Add elements to the beginning of array. */
81
+ declare const prepend: <T>(arr: T[], ...elements: T[]) => T[];
82
+ /** Take first n elements of array. */
83
+ declare const take: <T>(amount: number, arr: T[]) => T[];
84
+ /** Create a new array in reverse order. */
85
+ declare const reverse: <T>(arr: T[]) => T[];
86
+ /** Alias for first element removal. */
87
+ declare const shift: <T>(arr: T[]) => [T, T[]];
38
88
  /**
39
89
  * Generates an array of sequential numbers.
40
90
  *
@@ -43,8 +93,126 @@ declare const chunk: <T>(arr: T[], size?: number) => T[][];
43
93
  * @returns An array of numbers from startAt to startAt + size - 1
44
94
  */
45
95
  declare const range: (size: number, startAt?: number) => number[];
46
- //#endregion
47
- //#region src/Helpers/DumpDie.d.ts
96
+ /** Flatten multi-dimensional arrays into single level. */
97
+ declare const flatten: <T>(arr: T[]) => T[];
98
+ declare namespace Crypto_d_exports {
99
+ export { base64Decode, base64Encode, caesarCipher, checksum, hash, hmac, random, randomColor, randomPassword, randomSecure, secureToken, uuid, verifyChecksum, xor };
100
+ }
101
+ /**
102
+ * Generate a random UUID string.
103
+ *
104
+ * @returns A random UUID string
105
+ */
106
+ declare const uuid: () => string;
107
+ /**
108
+ * Generate a random string of specified length.
109
+ *
110
+ * @param length - Length of the random string (default: 16)
111
+ * @param charset - Character set to use (default: alphanumeric)
112
+ * @returns A random string
113
+ */
114
+ declare const random: (length?: number, charset?: string) => string;
115
+ /**
116
+ * Secure random string generator that uses crypto.randomBytes.
117
+ *
118
+ * @param length - Length of the random string (default: 32)
119
+ * @returns A cryptographically secure random string
120
+ */
121
+ declare const randomSecure: (length?: number) => string;
122
+ /**
123
+ * Hash a string using the specified algorithm.
124
+ *
125
+ * @param data - Data to hash
126
+ * @param algorithm - Hash algorithm (default: 'sha256')
127
+ * @returns Hexadecimal hash string
128
+ */
129
+ declare const hash: (data: string, algorithm?: string) => string;
130
+ /**
131
+ * Hash a string with salt using HMAC.
132
+ *
133
+ * @param data - Data to hash
134
+ * @param key - Secret key for HMAC
135
+ * @param algorithm - Hash algorithm (default: 'sha256')
136
+ * @returns Hexadecimal hash string
137
+ */
138
+ declare const hmac: (data: string, key: string, algorithm?: string) => string;
139
+ /**
140
+ * Encode data to base64.
141
+ *
142
+ * @param data - Data to encode
143
+ * @returns Base64 encoded string
144
+ */
145
+ declare const base64Encode: (data: string) => string;
146
+ /**
147
+ * Decode base64 data.
148
+ *
149
+ * @param data - Base64 string to decode
150
+ * @returns Decoded string
151
+ */
152
+ declare const base64Decode: (data: string) => string;
153
+ /**
154
+ * Simple XOR encryption/decryption.
155
+ *
156
+ * @param data - Data to encrypt/decrypt
157
+ * @param key - Encryption key
158
+ * @returns Encrypted/decrypted string
159
+ */
160
+ declare const xor: (data: string, key: string) => string;
161
+ /**
162
+ * Generate a random hex color code.
163
+ *
164
+ * @returns A hex color code string (e.g., '#a3b2f3')
165
+ */
166
+ declare const randomColor: () => string;
167
+ /**
168
+ * Generate a secure password using configurable parameters.
169
+ *
170
+ * @param length - Password length (default: 16)
171
+ * @param options - Character options
172
+ * @returns A secure password string
173
+ */
174
+ interface PasswordOptions {
175
+ useUppercase?: boolean;
176
+ useLowercase?: boolean;
177
+ useNumbers?: boolean;
178
+ useSymbols?: boolean;
179
+ }
180
+ declare const randomPassword: (length?: number, options?: PasswordOptions) => string;
181
+ /**
182
+ * Generate a cryptographically secure token for APIs, sessions, etc.
183
+ *
184
+ * @param strength - Token strength (bytes) (default: 32)
185
+ * @returns A secure token string
186
+ */
187
+ declare const secureToken: (strength?: number) => string;
188
+ /**
189
+ * Create a checksum for data integrity verification.
190
+ *
191
+ * @param data - Data to create checksum for
192
+ * @param algorithm - Hash algorithm (default: 'sha256')
193
+ * @returns SHA256 checksum
194
+ */
195
+ declare const checksum: (data: string, algorithm?: string) => string;
196
+ /**
197
+ * Verify data integrity using checksum.
198
+ *
199
+ * @param data - Data to verify
200
+ * @param expectedChecksum - Expected checksum
201
+ * @param algorithm - Hash algorithm (default: 'sha256')
202
+ * @returns True if checksums match
203
+ */
204
+ declare const verifyChecksum: (data: string, expectedChecksum: string, algorithm?: string) => boolean;
205
+ /**
206
+ * Simple Caesar cipher implementation.
207
+ *
208
+ * @param text - Text to encrypt/decrypt
209
+ * @param shift - Number of positions to shift (default: 13)
210
+ * @returns Encrypted/decrypted text
211
+ */
212
+ declare const caesarCipher: (text: string, shift?: number) => string;
213
+ declare namespace DumpDie_d_exports {
214
+ export { dd, dump };
215
+ }
48
216
  /**
49
217
  * Dump something and kill the process for quick debugging. Based on Laravel's dd()
50
218
  *
@@ -57,8 +225,9 @@ declare const dd: (...args: unknown[]) => never;
57
225
  * @param args
58
226
  */
59
227
  declare const dump: (...args: unknown[]) => void;
60
- //#endregion
61
- //#region src/Helpers/Number.d.ts
228
+ declare namespace Number_d_exports {
229
+ export { abbreviate, humanize, toBytes, toHumanTime };
230
+ }
62
231
  /**
63
232
  * Abbreviates large numbers using SI symbols (K, M, B...)
64
233
  * and formats the output according to the given locale.
@@ -95,8 +264,9 @@ declare const toBytes: (bytes?: number, decimals?: number, bits?: boolean) => st
95
264
  * @returns A formatted time string
96
265
  */
97
266
  declare const toHumanTime: (seconds?: number, worded?: boolean) => string;
98
- //#endregion
99
- //#region src/Helpers/Obj.d.ts
267
+ declare namespace Obj_d_exports {
268
+ export { dot, extractProperties, getValue, modObj, safeDot, setNested, slugifyKeys };
269
+ }
100
270
  /**
101
271
  * Flattens a nested object into a single-level object
102
272
  * with dot-separated keys.
@@ -177,101 +347,2395 @@ declare const setNested: (obj: Record<string, any>, key: string, value: any) =>
177
347
  declare const slugifyKeys: <T extends object>(obj: T, only?: string[], separator?: string) => KeysToSnakeCase<T>;
178
348
  //#endregion
179
349
  //#region src/Helpers/Str.d.ts
350
+ declare enum Mode {
351
+ MB_CASE_UPPER = 0,
352
+ MB_CASE_LOWER = 1,
353
+ MB_CASE_TITLE = 2,
354
+ MB_CASE_FOLD = 3,
355
+ MB_CASE_UPPER_SIMPLE = 4,
356
+ MB_CASE_LOWER_SIMPLE = 5,
357
+ MB_CASE_TITLE_SIMPLE = 6,
358
+ MB_CASE_FOLD_SIMPLE = 7,
359
+ }
360
+ declare class Str {
361
+ /**
362
+ * The callback that should be used to generate UUIDs.
363
+ *
364
+ * @type { Function | null }
365
+ */
366
+ protected static uuidFactory: Function | null;
367
+ /**
368
+ * The callback that should be used to generate ULIDs.
369
+ *
370
+ * @type { Function | null }
371
+ */
372
+ protected static ulidFactory: Function | null;
373
+ /**
374
+ * The callback that should be used to generate random strings.
375
+ *
376
+ * @type { Function | null }
377
+ */
378
+ protected static randomStringFactory: Function | null;
379
+ /**
380
+ * Get a new Stringable object from the given string.
381
+ *
382
+ * @param { string } string
383
+ */
384
+ static of(string: string): Stringable;
385
+ /**
386
+ * Return the remainder of a string after the first occurrence of a given value.
387
+ *
388
+ * @param { string } subject
389
+ * @param { string } search
390
+ *
391
+ * @return { string }
392
+ */
393
+ static after(subject: string, search: string): string;
394
+ /**
395
+ * Return the remainder of a string after the last occurrence of a given value.
396
+ *
397
+ * @param { string } subject
398
+ * @param { string } search
399
+ *
400
+ * @return { string }
401
+ */
402
+ static afterLast(subject: string, search: string): string;
403
+ /**
404
+ * Transliterate a UTF-8 value to ASCII.
405
+ *
406
+ * @param { string } value
407
+ *
408
+ * @return { string }
409
+ */
410
+ static ascii(value: string): string;
411
+ /**
412
+ * Get the portion of a string before the first occurrence of a given value.
413
+ *
414
+ * @param { string } subject
415
+ * @param { string } search
416
+ *
417
+ * @return { string }
418
+ */
419
+ static before(subject: string, search: string): string;
420
+ /**
421
+ * Get the portion of a string before the last occurrence of a given value.
422
+ *
423
+ * @param { string } subject
424
+ * @param { string } search
425
+ *
426
+ * @return { string }
427
+ */
428
+ static beforeLast(subject: string, search: string): string;
429
+ /**
430
+ * Get the portion of a string between two given values.
431
+ *
432
+ * @param { string } subject
433
+ * @param { string } from
434
+ * @param { string } to
435
+ *
436
+ * @return { string }
437
+ */
438
+ static between(subject: string, from: string, to: string): string;
439
+ /**
440
+ * Get the smallest possible portion of a string between two given values.
441
+ *
442
+ * @param { string } subject
443
+ * @param { string } from
444
+ * @param { string } to
445
+ *
446
+ * @return { string }
447
+ */
448
+ static betweenFirst(subject: string, from: string, to: string): string;
449
+ /**
450
+ * Convert a value to camel case.
451
+ *
452
+ * @param { string } value
453
+ *
454
+ * @return { string }
455
+ */
456
+ static camel(value: string): string;
457
+ /**
458
+ * Get the character at the specified index.
459
+ *
460
+ * @param { string } subject
461
+ * @param { number } index
462
+ *
463
+ * @return { string | false }
464
+ */
465
+ static charAt(subject: string, index: number): string | false;
466
+ /**
467
+ * Remove the given string(s) if it exists at the start of the haystack.
468
+ *
469
+ * @param { string } subject
470
+ * @param { string | string[] } needle
471
+ *
472
+ * @return string
473
+ */
474
+ static chopStart(subject: string, needle: string | string[]): string;
475
+ /**
476
+ * Remove the given string(s) if it exists at the end of the haystack.
477
+ *
478
+ * @param { string } subject
479
+ * @param { string | string[] } needle
480
+ *
481
+ * @return string
482
+ *
483
+ */
484
+ static chopEnd(subject: string, needle: string | string[]): string;
485
+ /**
486
+ * Determine if a given string contains a given substring.
487
+ *
488
+ * @param { string } haystack
489
+ * @param { string | string[] } needles
490
+ * @param { boolean } ignoreCase
491
+ *
492
+ * @return { boolean }
493
+ */
494
+ static contains(haystack: string, needles: string | string[], ignoreCase?: boolean): boolean;
495
+ /**
496
+ * Determine if a given string contains all array values.
497
+ *
498
+ * @param { string } haystack
499
+ * @param { string[] } needles
500
+ * @param { boolean } ignoreCase
501
+ *
502
+ * @return { boolean }
503
+ */
504
+ static containsAll(haystack: string, needles: string[], ignoreCase?: boolean): boolean;
505
+ /**
506
+ * Determine if a given string doesn't contain a given substring.
507
+ *
508
+ * @param { string } haystack
509
+ * @param { string | string[] } needles
510
+ * @param { boolean } ignoreCase
511
+ *
512
+ * @return { boolean }
513
+ */
514
+ static doesntContain(haystack: string, needles: string | string[], ignoreCase?: boolean): boolean;
515
+ /**
516
+ * Convert the case of a string.
517
+ *
518
+ * @param { string } string
519
+ * @param { Mode | number } mode
520
+ *
521
+ * @return { string }
522
+ */
523
+ static convertCase(string: string, mode?: Mode | number): string;
524
+ /**
525
+ * Replace consecutive instances of a given character with a single character in the given string.
526
+ *
527
+ * @param { string } string
528
+ * @param { string | string[] } characters
529
+ *
530
+ * @return { string }
531
+ */
532
+ static deduplicate(string: string, characters?: string | string[]): string;
533
+ /**
534
+ * Determine if a given string ends with a given substring.
535
+ *
536
+ * @param { string } haystack
537
+ * @param { string | string[] } needles
538
+ *
539
+ * @return { boolean }
540
+ */
541
+ static endsWith(haystack: string, needles: string | string[]): boolean;
542
+ /**
543
+ * Determine if a given string doesn't end with a given substring.
544
+ *
545
+ * @param { string } haystack
546
+ * @param { string | string[] } needles
547
+ *
548
+ * @return { boolean }
549
+ */
550
+ static doesntEndWith(haystack: string, needles: string | string[]): boolean;
551
+ /**
552
+ * Returns all the characters except the last.
553
+ *
554
+ * @param string
555
+ * @returns
556
+ */
557
+ static chop(string: string): string;
558
+ /**
559
+ * Escape string for JSON encoding (returns string without quotes).
560
+ *
561
+ * @param string
562
+ * @returns
563
+ */
564
+ static esc(string: string): string;
565
+ /**
566
+ * Extracts an excerpt from text that matches the first instance of a phrase.
567
+ *
568
+ * @param { string } text
569
+ * @param { string } phrase
570
+ * @param { ExcerptOptions } options
571
+ *
572
+ * @return { string | null }
573
+ */
574
+ static excerpt(text: string, phrase?: string, options?: ExcerptOptions): string | null;
575
+ /**
576
+ * Explode the string into an array.
577
+ *
578
+ * @param { string } string
579
+ * @param { string } delimiter
580
+ * @param { number } limit
581
+ *
582
+ * @return { string[] }
583
+ */
584
+ static explode(string: string, delimiter: string, limit?: number): string[];
585
+ /**
586
+ * Cap a string with a single instance of a given value.
587
+ *
588
+ * @param { string } value
589
+ * @param { string } cap
590
+ *
591
+ * @return { string }
592
+ */
593
+ static finish(value: string, cap: string): string;
594
+ /**
595
+ * Wrap the string with the given strings.
596
+ *
597
+ * @param { string } value
598
+ * @param { string } before
599
+ * @param { string | null } after
600
+ *
601
+ * @return string
602
+ */
603
+ static wrap(value: string, before: string, after?: string | null): string;
604
+ /**
605
+ * Unwrap the string with the given strings.
606
+ *
607
+ * @param { string } value
608
+ * @param { string } before
609
+ * @param { string | null } after
610
+ *
611
+ * @return { string }
612
+ */
613
+ static unwrap(value: string, before: string, after?: string | null): string;
614
+ /**
615
+ * Determine if a given string matches a given pattern.
616
+ *
617
+ * @param { string | string[] } pattern
618
+ * @param { string } value
619
+ * @param { boolean } ignoreCase
620
+ *
621
+ * @return { boolean }
622
+ */
623
+ static is(pattern: string | string[], value: string, ignoreCase?: boolean): boolean;
624
+ /**
625
+ * Determine if a given string is 7-bit ASCII.
626
+ *
627
+ * @param { string } value
628
+ *
629
+ * @return { boolean }
630
+ */
631
+ static isAscii(value: string): boolean;
632
+ /**
633
+ * Determine if a given string is valid JSON.
634
+ *
635
+ * @param { string } value
636
+ *
637
+ * @return { boolean }
638
+ */
639
+ static isJson(value: string): boolean;
640
+ /**
641
+ * Determine if a given value is a valid URL.
642
+ *
643
+ * @param { string } value
644
+ * @param { string[] } protocols
645
+ *
646
+ * @return { boolean }
647
+ */
648
+ static isUrl(value: string, protocols?: string[]): boolean;
649
+ /**
650
+ * Determine if a given string is a valid UUID.
651
+ *
652
+ * @param { string } value
653
+ *
654
+ * @return { boolean }
655
+ */
656
+ static isUuid(value: string): boolean;
657
+ /**
658
+ * Determine if a given string is a valid ULID.
659
+ *
660
+ * @param { string } value
661
+ *
662
+ * @return { boolean }
663
+ */
664
+ static isUlid(value: string): boolean;
665
+ /**
666
+ * Convert a string to kebab case.
667
+ *
668
+ * @param { string } value
669
+ *
670
+ * @return { string }
671
+ */
672
+ static kebab(value: string): string;
673
+ /**
674
+ * Return the length of the given string.
675
+ *
676
+ * @param { string } value
677
+ *
678
+ * @return { number }
679
+ */
680
+ static length(value: string): number;
681
+ /**
682
+ * Limit the number of characters in a string.
683
+ *
684
+ * @param { string } value
685
+ * @param { number } limit
686
+ * @param { string } end
687
+ * @param { boolean } preserveWords
688
+ *
689
+ * @return { string }
690
+ */
691
+ static limit(value: string, limit?: number, end?: string, preserveWords?: boolean): string;
692
+ /**
693
+ * Limit the number of characters in a string.
694
+ *
695
+ * @param { string } value
696
+ * @param { number } limit
697
+ * @param { string } end
698
+ * @param { boolean } preserveWords
699
+ *
700
+ * @alias limit
701
+ * @return { string }
702
+ */
703
+ static truncate(value: string, limit?: number, end?: string, preserveWords?: boolean): string;
704
+ /**
705
+ * Convert the given string to lower-case.
706
+ *
707
+ * @param { string } value
708
+ *
709
+ * @return { string }
710
+ */
711
+ static lower(value: string): string;
712
+ /**
713
+ * Get substring by start/stop indexes.
714
+ *
715
+ * @param string
716
+ * @param start
717
+ * @param stop
718
+ * @returns
719
+ */
720
+ static sub(string: string, start: number, stop: number): string;
721
+ /**
722
+ * Limit the number of words in a string.
723
+ *
724
+ * @param { string } value
725
+ * @param { number } words
726
+ * @param { string } end
727
+ *
728
+ * @return { string }
729
+ */
730
+ static words(value: string, words?: number, end?: string): string;
731
+ /**
732
+ * Masks a portion of a string with a repeated character.
733
+ *
734
+ * @param { string } string
735
+ * @param { string } character
736
+ * @param { number } index
737
+ * @param { number | null } length
738
+ *
739
+ * @return { string }
740
+ */
741
+ static mask(string: string, character: string, index: number, length?: number | null): string;
742
+ /**
743
+ * Get the string matching the given pattern.
744
+ *
745
+ * @param { string } pattern
746
+ * @param { string } subject
747
+ *
748
+ * @return { string }
749
+ */
750
+ static match(pattern: string, subject: string): string;
751
+ /**
752
+ * Determine if a given string matches a given pattern.
753
+ *
754
+ * @param { string | string[] } pattern
755
+ * @param { string } value
756
+ *
757
+ * @return { boolean }
758
+ */
759
+ static isMatch(pattern: string | string[], value: string): boolean;
760
+ /**
761
+ * Get the string matching the given pattern.
762
+ *
763
+ * @param { string } pattern
764
+ * @param { string } subject
765
+ *
766
+ * @return { string[] }
767
+ */
768
+ static matchAll(pattern: string, subject: string): string[];
769
+ /**
770
+ * Remove all non-numeric characters from a string.
771
+ *
772
+ * @param { string } value
773
+ *
774
+ * @return { string }
775
+ */
776
+ static numbers(value: string): string;
777
+ /**
778
+ * Pad both sides of a string with another.
779
+ *
780
+ * @param { string } value
781
+ * @param { number } length
782
+ * @param { string } pad
783
+ *
784
+ * @return { string }
785
+ */
786
+ static padBoth(value: string, length: number, pad?: string): string;
787
+ /**
788
+ * Pad the left side of a string with another.
789
+ *
790
+ * @param { string } value
791
+ * @param { number } length
792
+ * @param { string } pad
793
+ *
794
+ * @return { string }
795
+ */
796
+ static padLeft(value: string, length: number, pad?: string): string;
797
+ /**
798
+ * Pad the right side of a string with another.
799
+ *
800
+ * @param { string } value
801
+ * @param { number } length
802
+ * @param { string } pad
803
+ *
804
+ * @return { string }
805
+ */
806
+ static padRight(value: string, length: number, pad?: string): string;
807
+ /**
808
+ * Get the plural form of an English word.
809
+ *
810
+ * @param { string } value
811
+ * @param { number | array } count
812
+ *
813
+ * @return { string }
814
+ */
815
+ static plural(value: string, count?: number | number[]): string;
816
+ /**
817
+ * Get the plural form of an English word.
818
+ *
819
+ * @param { string } value
820
+ * @param { number | array } count
821
+ *
822
+ * @alias plural
823
+ *
824
+ * @return { string }
825
+ */
826
+ static pluralize: (value: string, count?: number | number[]) => string;
827
+ /**
828
+ * Pluralize the last word of an English, studly caps case string.
829
+ *
830
+ * @param { string } value
831
+ * @param { number | array } count
832
+ *
833
+ * @return { string }
834
+ */
835
+ static pluralStudly(value: string, count?: number | number[]): string;
836
+ /**
837
+ * Pluralize the last word of an English, Pascal case string.
838
+ *
839
+ * @param { string } value
840
+ * @param { number | array } count
841
+ *
842
+ * @return { string }
843
+ */
844
+ static pluralPascal(value: string, count?: number | number[]): string;
845
+ /**
846
+ * Generate a random, secure password.
847
+ *
848
+ * @param { number } length
849
+ * @param { boolean } letters
850
+ * @param { boolean } numbers
851
+ * @param { boolean } symbols
852
+ * @param { boolean } spaces
853
+ *
854
+ * @return { string }
855
+ */
856
+ static password(length?: number, letters?: boolean, numbers?: boolean, symbols?: boolean, spaces?: boolean): string;
857
+ /**
858
+ * Find the position of the first occurrence of a given substring in a string.
859
+ *
860
+ * @param { string } haystack
861
+ * @param { string } needle
862
+ * @param { number } offset
863
+ *
864
+ * @return { number | false }
865
+ */
866
+ static position(haystack: string, needle: string, offset?: number): number | false;
867
+ /**
868
+ * Generate a more truly "random" alpha-numeric string.
869
+ *
870
+ * @param { number } length
871
+ *
872
+ * @return { string }
873
+ */
874
+ static random(length?: number): string;
875
+ /**
876
+ * Set the callable that will be used to generate random strings.
877
+ *
878
+ * @param { ((length: number) => string) | null } factory
879
+ *
880
+ * @return { void }
881
+ */
882
+ static createRandomStringsUsing(factory?: ((length: number) => string) | null): void;
883
+ /**
884
+ * Set the sequence that will be used to generate random strings.
885
+ *
886
+ * @param { (string | undefined)[] } sequence
887
+ * @param { Function | null } whenMissing
888
+ *
889
+ * @return { void }
890
+ */
891
+ static createRandomStringsUsingSequence(sequence: (string | undefined)[], whenMissing?: Function | null): void;
892
+ /**
893
+ * Indicate that random strings should be created normally and not using a custom factory.
894
+ *
895
+ * @return { void }
896
+ */
897
+ static createRandomStringsNormally(): void;
898
+ /**
899
+ * Repeat the given string.
900
+ *
901
+ * @param { string } string
902
+ * @param { number } times
903
+ *
904
+ * @return { string }
905
+ */
906
+ static repeat(string: string, times?: number): string;
907
+ /**
908
+ * Replace a given value in the string sequentially with an array.
909
+ *
910
+ * @param { string[] } replace
911
+ * @param { string } subject
912
+ * @param { string } search
913
+ *
914
+ * @return { string }
915
+ */
916
+ static replaceArray(search: string, replace: string[], subject: string): string;
917
+ /**
918
+ * Convert the given value to a string or return the given fallback on failure.
919
+ *
920
+ * @param { * } value
921
+ * @param { string } fallback
922
+ *
923
+ * @return { string }
924
+ */
925
+ static toStringOr(value: any, fallback: string): string;
926
+ /**
927
+ * Replace the given value in the given string.
928
+ *
929
+ * @param { string | string[] } search
930
+ * @param { string } replace
931
+ * @param { string } subject
932
+ * @param { boolean } caseSensitive
933
+ *
934
+ * @return { string }
935
+ */
936
+ static replace(search: string | string[], replace: string, subject: string, caseSensitive?: boolean): string;
937
+ /**
938
+ * Replace the first occurrence of a given value in the string.
939
+ *
940
+ * @param { string } search
941
+ * @param { string } replace
942
+ * @param { string } subject
943
+ *
944
+ * @return { string }
945
+ */
946
+ static replaceFirst(search: string, replace: string, subject: string): string;
947
+ /**
948
+ * Replace the first occurrence of the given value if it appears at the start of the string.
949
+ *
950
+ * @param { string } search
951
+ * @param { string } replace
952
+ * @param { string } subject
953
+ *
954
+ * @return { string }
955
+ */
956
+ static replaceStart(search: string, replace: string, subject: string): string;
957
+ /**
958
+ * Replace the last occurrence of a given value in the string.
959
+ *
960
+ * @param { string } search
961
+ * @param { string } replace
962
+ * @param { string } subject
963
+ *
964
+ * @return { string }
965
+ */
966
+ static replaceLast(search: string, replace: string, subject: string): string;
967
+ /**
968
+ * Replace the last occurrence of a given value if it appears at the end of the string.
969
+ *
970
+ * @param { string } search
971
+ * @param { string } replace
972
+ * @param { string } subject
973
+ *
974
+ * @return { string }
975
+ */
976
+ static replaceEnd(search: string, replace: string, subject: string): string;
977
+ /**
978
+ * Replace the patterns matching the given regular expression.
979
+ *
980
+ * @param { string } pattern
981
+ * @param { string | function } replace
982
+ * @param { string } subject
983
+ *
984
+ * @return { string }
985
+ */
986
+ static replaceMatches(pattern: string, replace: string | Function, subject: string): string;
987
+ /**
988
+ * Remove any occurrence of the given string in the subject.
989
+ *
990
+ * @param { string } search
991
+ * @param { string } subject
992
+ * @param { boolean } caseSensitive
993
+ *
994
+ * @return { string }
995
+ */
996
+ static remove(search: string, subject: string, caseSensitive?: boolean): string;
997
+ /**
998
+ * Reverse the given string.
999
+ *
1000
+ * @param { string } value
1001
+ *
1002
+ * @return { string }
1003
+ */
1004
+ static reverse(value: string): string;
1005
+ /**
1006
+ * Begin a string with a single instance of a given value.
1007
+ *
1008
+ * @param { string } value
1009
+ * @param { string } prefix
1010
+ *
1011
+ * @return { string }
1012
+ */
1013
+ static start(value: string, prefix: string): string;
1014
+ /**
1015
+ * Substitute placeholders { key } using object with dot notation.
1016
+ *
1017
+ * @param str
1018
+ * @param data
1019
+ * @param def
1020
+ * @returns
1021
+ */
1022
+ static substitute(str: string, data?: Record<string, unknown>, def?: string): string | undefined;
1023
+ /**
1024
+ * Convert the given string to upper-case.
1025
+ *
1026
+ * @param { string } value
1027
+ *
1028
+ * @return { string }
1029
+ */
1030
+ static upper(value: string): string;
1031
+ /**
1032
+ * Convert the given string to title case.
1033
+ *
1034
+ * @param { string } value
1035
+ *
1036
+ * @return { string }
1037
+ */
1038
+ static title(value: string): string;
1039
+ /**
1040
+ * Convert the given string to title case for each word.
1041
+ *
1042
+ * @param { string } value
1043
+ *
1044
+ * @return { string }
1045
+ */
1046
+ static headline(value: string): string;
1047
+ /**
1048
+ * Convert the given string to APA-style title case.
1049
+ *
1050
+ * @see https://apastyle.apa.org/style-grammar-guidelines/capitalization/title-case
1051
+ *
1052
+ * @param { string } value
1053
+ *
1054
+ * @return { string }
1055
+ */
1056
+ static apa(value: string): string;
1057
+ /**
1058
+ * Get the singular form of an English word.
1059
+ *
1060
+ * @param { string } value
1061
+ *
1062
+ * @return { string }
1063
+ */
1064
+ static singular(value: string): string;
1065
+ /**
1066
+ * Get the singular form of an English word.
1067
+ *
1068
+ * @param { string } value
1069
+ *
1070
+ * @alias singular
1071
+ *
1072
+ * @return { string }
1073
+ */
1074
+ static singularize(value: string): string;
1075
+ /**
1076
+ * Generate a URL friendly "slug" from a given string.
1077
+ *
1078
+ * @param { string } title
1079
+ * @param { string } separator
1080
+ * @param { object } dictionary
1081
+ *
1082
+ * @return { string }
1083
+ */
1084
+ static slug(title: string, separator?: string, dictionary?: {
1085
+ [key: string]: string;
1086
+ }): string;
1087
+ /**
1088
+ * Generate a URL friendly "slug" from a given string.
1089
+ *
1090
+ * @param { string } separator
1091
+ * @param { string } title
1092
+ * @param { object } dictionary
1093
+ *
1094
+ * @alias singular
1095
+ *
1096
+ * @return { string }
1097
+ */
1098
+ static slugify(title: string, separator?: string, dictionary?: {
1099
+ [key: string]: string;
1100
+ }): string;
1101
+ /**
1102
+ * Convert a string to snake case.
1103
+ *
1104
+ * @param { string } value
1105
+ * @param { string } delimiter
1106
+ *
1107
+ * @return { string }
1108
+ */
1109
+ static snake(value: string, delimiter?: string): string;
1110
+ /**
1111
+ * Uppercase the first character of each word in a string
1112
+ *
1113
+ * @param { string } string The input string.
1114
+ * @param { string } separators The optional separators contains the word separator characters.
1115
+
1116
+ * @return { string } String the modified string.
1117
+ */
1118
+ static capitalize(string: string, separators?: string): string;
1119
+ /**
1120
+ * Uppercase the first character of each word in a string
1121
+ *
1122
+ * @param { string } string The input string.
1123
+ * @param { string } separators The optional separators contains the word separator characters.
1124
+
1125
+ * @return { string } String the modified string.
1126
+ */
1127
+ static ucwords(string: string, separators?: string): string;
1128
+ /**
1129
+ * Remove all whitespace from both ends of a string.
1130
+ *
1131
+ * @param { string } value
1132
+ * @param { string | null } characters
1133
+ *
1134
+ * @return { string }
1135
+ */
1136
+ static trim(value: string, characters?: string | null): string;
1137
+ /**
1138
+ * Remove all whitespace from the beginning of a string.
1139
+ *
1140
+ * @param { string } value
1141
+ * @param { string | null } characters
1142
+ *
1143
+ * @return { string }
1144
+ */
1145
+ static ltrim(value: string, characters?: string | null): string;
1146
+ /**
1147
+ * Remove all whitespace from the end of a string.
1148
+ *
1149
+ * @param { string } value
1150
+ * @param { string | null } characters
1151
+ *
1152
+ * @return { string }
1153
+ */
1154
+ static rtrim(value: string, characters?: string | null): string;
1155
+ /**
1156
+ * Remove all "extra" blank space from the given string.
1157
+ *
1158
+ * @param { string } value
1159
+ *
1160
+ * @return { string }
1161
+ */
1162
+ static squish(value: string): string;
1163
+ /**
1164
+ * Determine if a given string starts with a given substring.
1165
+ *
1166
+ * @param { string } haystack
1167
+ * @param { string | string[] } needles
1168
+ *
1169
+ * @return { boolean }
1170
+ */
1171
+ static startsWith(haystack: string, needles: string | string[]): boolean;
1172
+ /**
1173
+ * Determine if a given string doesn't start with a given substring.
1174
+ *
1175
+ * @param { string } haystack
1176
+ * @param { string | string[] } needles
1177
+ *
1178
+ * @return { boolean }
1179
+ */
1180
+ static doesntStartWith(haystack: string, needles: string | string[]): boolean;
1181
+ /**
1182
+ * Convert a value to studly caps case.
1183
+ *
1184
+ * @param { string } value
1185
+ *
1186
+ * @return { string }
1187
+ */
1188
+ static studly(value: string): string;
1189
+ /**
1190
+ * Convert a value to Pascal case.
1191
+ *
1192
+ * @param { string } value
1193
+ *
1194
+ * @return { string }
1195
+ */
1196
+ static pascal(value: string): string;
1197
+ /**
1198
+ * Returns the portion of the string specified by the start and length parameters.
1199
+ *
1200
+ * @param { string } string
1201
+ * @param { number } start
1202
+ * @param { number | null } length
1203
+ *
1204
+ * @return { string }
1205
+ */
1206
+ static substr(string: string, start: number, length?: number | null): string;
1207
+ /**
1208
+ * Returns the number of substring occurrences.
1209
+ *
1210
+ * @param { string } haystack
1211
+ * @param { string } needle
1212
+ * @param { number } offset
1213
+ * @param { number | null } length
1214
+ *
1215
+ * @return { number }
1216
+ */
1217
+ static substrCount(haystack: string, needle: string, offset?: number, length?: number | null): number;
1218
+ /**
1219
+ * Replace text within a portion of a string.
1220
+ *
1221
+ * @param { string } string
1222
+ * @param { string } replace
1223
+ * @param { number } offset
1224
+ * @param { number | null } length
1225
+ *
1226
+ * @return { string }
1227
+ */
1228
+ static substrReplace(string: string, replace: string, offset?: number, length?: number | null): string;
1229
+ /**
1230
+ * Swap multiple keywords in a string with other keywords.
1231
+ *
1232
+ * @param { object } map
1233
+ * @param { string } subject
1234
+ *
1235
+ * @return { string }
1236
+ */
1237
+ static swap(map: Record<string, string>, subject: string): string;
1238
+ /**
1239
+ * Take the first or last {limit} characters of a string.
1240
+ *
1241
+ * @param { string } string
1242
+ * @param { number } limit
1243
+ *
1244
+ * @return { string }
1245
+ */
1246
+ static take(string: string, limit: number): string;
1247
+ /**
1248
+ * Convert the given string to Base64 encoding.
1249
+ *
1250
+ * @param { string } string
1251
+ *
1252
+ * @return { string }
1253
+ */
1254
+ static toBase64(string: string): string;
1255
+ /**
1256
+ * Decode the given Base64 encoded string.
1257
+ *
1258
+ * @param { string } string
1259
+ *
1260
+ * @return { string }
1261
+ */
1262
+ static fromBase64(string: string): string;
1263
+ /**
1264
+ * Checks if a string is numeric
1265
+ *
1266
+ * @param string
1267
+ * @returns
1268
+ */
1269
+ static isNumber(string: string): boolean;
1270
+ /**
1271
+ * Checks if a string is an integer
1272
+ *
1273
+ * @param string
1274
+ * @returns
1275
+ */
1276
+ static isInteger(string: string): boolean;
1277
+ /**
1278
+ * ROT-N cipher.
1279
+ *
1280
+ * @param string
1281
+ * @param n
1282
+ * @returns
1283
+ */
1284
+ static rot(string: string, n?: number): string;
1285
+ /**
1286
+ * Replace trailing punctuation with new format.
1287
+ *
1288
+ * @param string
1289
+ * @param newFormat
1290
+ * @returns
1291
+ */
1292
+ static replacePunctuation(string: string, newFormat: string): string;
1293
+ /**
1294
+ * Array/object driven text replacement.
1295
+ *
1296
+ * @param string
1297
+ * @param replacements
1298
+ * @returns
1299
+ */
1300
+ static translate(string: string, replacements: Record<string, string> | Array<[string, string]>): string;
1301
+ /**
1302
+ * Strip slashes recursively.
1303
+ *
1304
+ * @param string
1305
+ * @returns
1306
+ */
1307
+ static ss(string: string): string;
1308
+ /**
1309
+ * First and last N lines.
1310
+ *
1311
+ * @param string
1312
+ * @param amount
1313
+ * @returns
1314
+ */
1315
+ static firstLines(string: string, amount?: number): string;
1316
+ /**
1317
+ * Last and first N lines.
1318
+ *
1319
+ * @param string
1320
+ * @param amount
1321
+ * @returns
1322
+ */
1323
+ static lastLines(string: string, amount?: number): string;
1324
+ /**
1325
+ * Make a string's first character lowercase.
1326
+ *
1327
+ * @param { string } string
1328
+ *
1329
+ * @return { string }
1330
+ */
1331
+ static lcfirst(string: string): string;
1332
+ /**
1333
+ * Make a string's first character uppercase.
1334
+ *
1335
+ * @param { string } string
1336
+ *
1337
+ * @return { string }
1338
+ */
1339
+ static ucfirst(string: string): string;
1340
+ /**
1341
+ * Split a string into pieces by uppercase characters.
1342
+ *
1343
+ * @param { string } string
1344
+ *
1345
+ * @return { string[] }
1346
+ */
1347
+ static ucsplit(string: string): string[];
1348
+ /**
1349
+ * Get the number of words a string contains.
1350
+ *
1351
+ * @param { string } string
1352
+ *
1353
+ * @return { number }
1354
+ */
1355
+ static wordCount(string: string): number;
1356
+ /**
1357
+ * Wrap a string to a given number of characters.
1358
+ *
1359
+ * @param { string } string
1360
+ * @param { number } characters
1361
+ * @param { string } breakStr
1362
+ * @param { boolean } cutLongWords
1363
+ *
1364
+ * @returns { string }
1365
+ */
1366
+ static wordWrap(string: string, characters?: number, breakStr?: string, cutLongWords?: boolean): string;
1367
+ /**
1368
+ * Generate a UUID (version 4).
1369
+ *
1370
+ * @return { string }
1371
+ */
1372
+ static uuid(): string;
1373
+ /**
1374
+ * Generate a UUID (version 7).
1375
+ *
1376
+ * @return { string }
1377
+ */
1378
+ static uuid7(time?: Date | null): string;
1379
+ /**
1380
+ * Generate a time-ordered UUID (version 4).
1381
+ *
1382
+ * @return { string }
1383
+ */
1384
+ static orderedUuid(): string;
1385
+ /**
1386
+ * Set the callable that will be used to generate UUIDs.
1387
+ *
1388
+ * @param { Function | null } factory
1389
+ *
1390
+ * @return { void }
1391
+ */
1392
+ static createUuidsUsing(factory?: Function | null): void;
1393
+ /**
1394
+ * Set the sequence that will be used to generate random strings.
1395
+ *
1396
+ * @param { (string | undefined)[] } sequence
1397
+ * @param { Function | null } whenMissing
1398
+ *
1399
+ * @return { void }
1400
+ */
1401
+ static createUuidsUsingSequence(sequence: (string | undefined)[], whenMissing?: Function | null): void;
1402
+ /**
1403
+ * Always return the same UUID when generating new UUIDs.
1404
+ *
1405
+ * @param { Function | null } callback
1406
+ *
1407
+ * @return { string }
1408
+ */
1409
+ static freezeUuids(callback?: Function | null): string;
1410
+ /**
1411
+ * Indicate that UUIDs should be created normally and not using a custom factory.
1412
+ *
1413
+ * @return { void }
1414
+ */
1415
+ static createUuidsNormally(): void;
1416
+ /**
1417
+ * Generate a ULID.
1418
+ *
1419
+ * @return { string }
1420
+ */
1421
+ static ulid(): string;
1422
+ /**
1423
+ * Set the callable that will be used to generate ULIDs.
1424
+ *
1425
+ * @param { Function | null } factory
1426
+ *
1427
+ * @return { void }
1428
+ */
1429
+ static createUlidsUsing(factory?: Function | null): void;
1430
+ /**
1431
+ * Set the sequence that will be used to generate ULIDs.
1432
+ *
1433
+ * @param { (string | undefined)[] } sequence
1434
+ * @param { Function | null } whenMissing
1435
+ *
1436
+ * @return { void }
1437
+ */
1438
+ static createUlidsUsingSequence(sequence: (string | undefined)[], whenMissing?: Function | null): void;
1439
+ /**
1440
+ * Always return the same UUID when generating new UUIDs.
1441
+ *
1442
+ * @param { Function | null } callback
1443
+ *
1444
+ * @return { string }
1445
+ */
1446
+ static freezeUlids(callback?: Function | null): string;
1447
+ /**
1448
+ * Indicate that ULIDs should be created normally and not using a custom factory.
1449
+ *
1450
+ * @return { void }
1451
+ */
1452
+ static createUlidsNormally(): void;
1453
+ }
1454
+ declare class Stringable {
1455
+ #private;
1456
+ /**
1457
+ * Create a new instance of the class.
1458
+ *
1459
+ * @param { string } value
1460
+ */
1461
+ constructor(value?: string);
1462
+ /**
1463
+ * Return the remainder of a string after the first occurrence of a given value.
1464
+ *
1465
+ * @param { string } search
1466
+ *
1467
+ * @return { Stringable }
1468
+ */
1469
+ after(search: string): Stringable;
1470
+ /**
1471
+ * Return the remainder of a string after the last occurrence of a given value.
1472
+ *
1473
+ * @param { string } search
1474
+ *
1475
+ * @return { Stringable }
1476
+ */
1477
+ afterLast(search: string): Stringable;
1478
+ /**
1479
+ * Append the given values to the string.
1480
+ *
1481
+ * @param { string | string[] } values
1482
+ *
1483
+ * @return { Stringable }
1484
+ */
1485
+ append(...values: string[]): Stringable;
1486
+ /**
1487
+ * Append a new line to the string.
1488
+ *
1489
+ * @param { number } count
1490
+ *
1491
+ * @return { Stringable }
1492
+ */
1493
+ newLine(count?: number): Stringable;
1494
+ /**
1495
+ * Transliterate a UTF-8 value to ASCII.
1496
+ *
1497
+ * @return { Stringable }
1498
+ */
1499
+ ascii(): Stringable;
1500
+ /**
1501
+ * Get the trailing name component of the path.
1502
+ *
1503
+ * @param { string } suffix
1504
+ *
1505
+ * @return { Stringable }
1506
+ */
1507
+ basename(suffix?: string): Stringable;
1508
+ /**
1509
+ * Get the character at the specified index.
1510
+ *
1511
+ * @param { number } index
1512
+ *
1513
+ * @return { string | false }
1514
+ */
1515
+ charAt(index: number): string | false;
1516
+ /**
1517
+ * Remove the given string if it exists at the start of the current string.
1518
+ *
1519
+ * @param { string | string[] } needle
1520
+ *
1521
+ * @return { Stringable }
1522
+ */
1523
+ chopStart(needle: string | string[]): Stringable;
1524
+ /**
1525
+ * Remove the given string if it exists at the end of the current string.
1526
+ *
1527
+ * @param { string | string[] } needle
1528
+ *
1529
+ * @return { Stringable }
1530
+ */
1531
+ chopEnd(needle: string | string[]): Stringable;
1532
+ /**
1533
+ * Get the basename of the class path.
1534
+ *
1535
+ * @return { Stringable }
1536
+ */
1537
+ classBasename(): Stringable;
1538
+ /**
1539
+ * Get the portion of a string before the first occurrence of a given value.
1540
+ *
1541
+ * @param { string } search
1542
+ *
1543
+ * @return { Stringable }
1544
+ */
1545
+ before(search: string): Stringable;
1546
+ /**
1547
+ * Get the portion of a string before the last occurrence of a given value.
1548
+ *
1549
+ * @param { string } search
1550
+ *
1551
+ * @return { Stringable }
1552
+ */
1553
+ beforeLast(search: string): Stringable;
1554
+ /**
1555
+ * Get the portion of a string between two given values.
1556
+ *
1557
+ * @param { string } from
1558
+ * @param { string } to
1559
+ *
1560
+ * @return { Stringable }
1561
+ */
1562
+ between(from: string, to: string): Stringable;
1563
+ /**
1564
+ * Get the smallest possible portion of a string between two given values.
1565
+ *
1566
+ * @param { string } from
1567
+ * @param { string } to
1568
+ *
1569
+ * @return { Stringable }
1570
+ */
1571
+ betweenFirst(from: string, to: string): Stringable;
1572
+ /**
1573
+ * Convert a value to camel case.
1574
+ *
1575
+ * @return { Stringable }
1576
+ */
1577
+ camel(): Stringable;
1578
+ /**
1579
+ * Determine if a given string contains a given substring.
1580
+ *
1581
+ * @param { string | string[] } needles
1582
+ * @param { boolean } ignoreCase
1583
+ *
1584
+ * @return { boolean }
1585
+ */
1586
+ contains(needles: string | string[], ignoreCase?: boolean): boolean;
1587
+ /**
1588
+ * Determine if a given string contains all array values.
1589
+ *
1590
+ * @param { string[] } needles
1591
+ * @param { boolean } ignoreCase
1592
+ *
1593
+ * @return { boolean }
1594
+ */
1595
+ containsAll(needles: string[], ignoreCase?: boolean): boolean;
1596
+ /**
1597
+ * Determine if a given string doesn't contain a given substring.
1598
+ *
1599
+ * @param { string | string[] } needles
1600
+ * @param { boolean } ignoreCase
1601
+ *
1602
+ * @return { boolean }
1603
+ */
1604
+ doesntContain(needles: string | string[], ignoreCase?: boolean): boolean;
1605
+ /**
1606
+ * Convert the case of a string.
1607
+ *
1608
+ * @param { Mode | number } mode
1609
+ *
1610
+ * @return { Stringable }
1611
+ */
1612
+ convertCase(mode?: Mode | number): Stringable;
1613
+ /**
1614
+ * Replace consecutive instances of a given character with a single character in the given string.
1615
+ *
1616
+ * @param { string | string[] } characters
1617
+ *
1618
+ * @return { string }
1619
+ */
1620
+ deduplicate(characters?: string | string[]): Stringable;
1621
+ /**
1622
+ * Get the parent directory's path.
1623
+ *
1624
+ * @param { number } levels
1625
+ *
1626
+ * @return { Stringable }
1627
+ */
1628
+ dirname(levels?: number): Stringable;
1629
+ /**
1630
+ * Determine if a given string ends with a given substring.
1631
+ *
1632
+ * @param { string | string[] } needles
1633
+ *
1634
+ * @return { boolean }
1635
+ */
1636
+ endsWith(needles: string | string[]): boolean;
1637
+ /**
1638
+ * Determine if a given string doesn't end with a given substring.
1639
+ *
1640
+ * @param { string | string[] } needles
1641
+ *
1642
+ * @return { boolean }
1643
+ */
1644
+ doesntEndWith(needles: string | string[]): boolean;
1645
+ /**
1646
+ * Returns all the characters except the last.
1647
+ *
1648
+ * @returns
1649
+ */
1650
+ chop(): Stringable;
1651
+ /**
1652
+ * Escape string for JSON encoding (returns string without quotes).
1653
+ *
1654
+ * @param string
1655
+ * @returns
1656
+ */
1657
+ esc(): Stringable;
1658
+ /**
1659
+ * Determine if the string is an exact match with the given value.
1660
+ *
1661
+ * @param { Stringable | string } value
1662
+ *
1663
+ * @return { boolean }
1664
+ */
1665
+ exactly(value: Stringable | string): boolean;
1666
+ /**
1667
+ * Extracts an excerpt from text that matches the first instance of a phrase.
1668
+ *
1669
+ * @param { string } phrase
1670
+ * @param { ExcerptOptions } options
1671
+ *
1672
+ * @return { string | null }
1673
+ */
1674
+ excerpt(phrase?: string, options?: ExcerptOptions): string | null;
1675
+ /**
1676
+ * Explode the string into an array.
1677
+ *
1678
+ * @param { string } delimiter
1679
+ * @param { number } limit
1680
+ *
1681
+ * @return { string[] }
1682
+ */
1683
+ explode(delimiter: string, limit?: number): string[];
1684
+ /**
1685
+ * Split a string using a regular expression or by length.
1686
+ *
1687
+ * @param { string } pattern
1688
+ * @param { number } limit
1689
+ *
1690
+ * @return { string[] }
1691
+ */
1692
+ split(pattern: string, limit?: number): string[];
1693
+ /**
1694
+ * Cap a string with a single instance of a given value.
1695
+ *
1696
+ * @param { string } cap
1697
+ *
1698
+ * @return { Stringable }
1699
+ */
1700
+ finish(cap: string): Stringable;
1701
+ /**
1702
+ * Determine if a given string matches a given pattern.
1703
+ *
1704
+ * @param { string | string[] } pattern
1705
+ * @param { boolean } ignoreCase
1706
+ *
1707
+ * @return { boolean }
1708
+ */
1709
+ is(pattern: string | string[], ignoreCase?: boolean): boolean;
1710
+ /**
1711
+ * Determine if a given string is 7-bit ASCII.
1712
+ *
1713
+ * @return { boolean }
1714
+ */
1715
+ isAscii(): boolean;
1716
+ /**
1717
+ * Determine if a given string is valid JSON.
1718
+ *
1719
+ * @return { boolean }
1720
+ */
1721
+ isJson(): boolean;
1722
+ /**
1723
+ * Determine if a given value is a valid URL.
1724
+ *
1725
+ * @return { boolean }
1726
+ */
1727
+ isUrl(): boolean;
1728
+ /**
1729
+ * Determine if a given string is a valid UUID.
1730
+ *
1731
+ * @return { boolean }
1732
+ */
1733
+ isUuid(): boolean;
1734
+ /**
1735
+ * Determine if a given string is a valid ULID.
1736
+ *
1737
+ * @return { boolean }
1738
+ */
1739
+ isUlid(): boolean;
1740
+ /**
1741
+ * Determine if the given string is empty.
1742
+ *
1743
+ * @return { boolean }
1744
+ */
1745
+ isEmpty(): boolean;
1746
+ /**
1747
+ * Determine if the given string is not empty.
1748
+ *
1749
+ * @return { boolean }
1750
+ */
1751
+ isNotEmpty(): boolean;
1752
+ /**
1753
+ * Convert a string to kebab case.
1754
+ *
1755
+ * @return { Stringable }
1756
+ */
1757
+ kebab(): Stringable;
1758
+ /**
1759
+ * Return the length of the given string.
1760
+ *
1761
+ * @return { number }
1762
+ */
1763
+ length(): number;
1764
+ /**
1765
+ * Limit the number of characters in a string.
1766
+ *
1767
+ * @param { number } limit
1768
+ * @param { string } end
1769
+ * @param { boolean } preserveWords
1770
+ *
1771
+ * @return { Stringable }
1772
+ */
1773
+ limit(limit?: number, end?: string, preserveWords?: boolean): Stringable;
1774
+ /**
1775
+ * Get substring by start/stop indexes.
1776
+ *
1777
+ * @param start
1778
+ * @param stop
1779
+ * @returns
1780
+ */
1781
+ sub(start: number, stop: number): Stringable;
1782
+ /**
1783
+ * Limit the number of characters in a string.
1784
+ *
1785
+ * @param { number } limit
1786
+ * @param { string } end
1787
+ * @param { boolean } preserveWords
1788
+ *
1789
+ * @alias limit
1790
+ *
1791
+ * @return { Stringable }
1792
+ */
1793
+ truncate(limit?: number, end?: string, preserveWords?: boolean): Stringable;
1794
+ /**
1795
+ * Convert the given string to lower-case.
1796
+ *
1797
+ * @return { Stringable }
1798
+ */
1799
+ lower(): Stringable;
1800
+ /**
1801
+ * Masks a portion of a string with a repeated character.
1802
+ *
1803
+ * @param { string } character
1804
+ * @param { number } index
1805
+ * @param { number | null }length
1806
+ *
1807
+ * @return { Stringable }
1808
+ */
1809
+ mask(character: string, index: number, length?: number | null): Stringable;
1810
+ /**
1811
+ * Get the string matching the given pattern.
1812
+ *
1813
+ * @param { string } pattern
1814
+ *
1815
+ * @return { Stringable }
1816
+ */
1817
+ match(pattern: string): Stringable;
1818
+ /**
1819
+ * Determine if a given string matches a given pattern.
1820
+ *
1821
+ * @param { string | string[] } pattern
1822
+ *
1823
+ * @return { boolean }
1824
+ */
1825
+ isMatch(...pattern: string[]): boolean;
1826
+ /**
1827
+ * Get the string matching the given pattern.
1828
+ *
1829
+ * @param { string } pattern
1830
+ *
1831
+ * @return { string[] }
1832
+ */
1833
+ matchAll(pattern: string): string[];
1834
+ /**
1835
+ * Determine if the string matches the given pattern.
1836
+ *
1837
+ * @param { string } pattern
1838
+ *
1839
+ * @return { boolean }
1840
+ */
1841
+ test(pattern: string): boolean;
1842
+ /**
1843
+ * Remove all non-numeric characters from a string.
1844
+ *
1845
+ * @return { Stringable }
1846
+ */
1847
+ numbers(): Stringable;
1848
+ /**
1849
+ * Pad both sides of the string with another.
1850
+ *
1851
+ * @param { number } length
1852
+ * @param { string } pad
1853
+ *
1854
+ * @return { Stringable }
1855
+ */
1856
+ padBoth(length: number, pad?: string): Stringable;
1857
+ /**
1858
+ * Pad the left side of the string with another.
1859
+ *
1860
+ * @param { number } length
1861
+ * @param { string } pad
1862
+ *
1863
+ * @return { Stringable }
1864
+ */
1865
+ padLeft(length: number, pad?: string): Stringable;
1866
+ /**
1867
+ * Pad the right side of the string with another.
1868
+ *
1869
+ * @param { number } length
1870
+ * @param { string } pad
1871
+ *
1872
+ * @return { Stringable }
1873
+ */
1874
+ padRight(length: number, pad?: string): Stringable;
1875
+ /**
1876
+ * Call the given callback and return a new string.
1877
+ *
1878
+ * @param { keyof string | ((instance: this) => any) } callback
1879
+ *
1880
+ * @return { Stringable }
1881
+ */
1882
+ pipe(callback: keyof string | ((instance: this) => any)): Stringable;
1883
+ /**
1884
+ * Get the plural form of an English word.
1885
+ *
1886
+ * @param { number } count
1887
+ *
1888
+ * @return { Stringable }
1889
+ */
1890
+ plural(count?: number): Stringable;
1891
+ /**
1892
+ * Pluralize the last word of an English, studly caps case string.
1893
+ *
1894
+ * @param { number } count
1895
+ *
1896
+ * @return { Stringable }
1897
+ */
1898
+ pluralStudly(count?: number): Stringable;
1899
+ /**
1900
+ * Pluralize the last word of an English, Pascal case string.
1901
+ *
1902
+ * @param { number } count
1903
+ *
1904
+ * @return { Stringable }
1905
+ */
1906
+ pluralPascal(count?: number): Stringable;
1907
+ /**
1908
+ * Find the multibyte safe position of the first occurrence of the given substring.
1909
+ *
1910
+ * @param { string } needle
1911
+ * @param { number } offset
1912
+ *
1913
+ * @return { number | false }
1914
+ */
1915
+ position(needle: string, offset?: number): number | false;
1916
+ /**
1917
+ * Prepend the given values to the string.
1918
+ *
1919
+ * @param { string | string[] } values
1920
+ *
1921
+ * @return { Stringable }
1922
+ */
1923
+ prepend(...values: string[]): Stringable;
1924
+ /**
1925
+ * Remove any occurrence of the given string in the subject.
1926
+ *
1927
+ * @param { string } search
1928
+ * @param { boolean } caseSensitive
1929
+ *
1930
+ * @return { Stringable }
1931
+ */
1932
+ remove(search: string, caseSensitive?: boolean): Stringable;
1933
+ /**
1934
+ * Reverse the string.
1935
+ *
1936
+ * @return { Stringable }
1937
+ */
1938
+ reverse(): Stringable;
1939
+ /**
1940
+ * Substitute placeholders { key } using object with dot notation.
1941
+ *
1942
+ * @param data
1943
+ * @param def
1944
+ * @returns
1945
+ */
1946
+ substitute(data?: Record<string, unknown>, def?: string): Stringable;
1947
+ /**
1948
+ * Repeat the string.
1949
+ *
1950
+ * @param { number } times
1951
+ *
1952
+ * @return { Stringable }
1953
+ */
1954
+ repeat(times: number): Stringable;
1955
+ /**
1956
+ * Replace the given value in the given string.
1957
+ *
1958
+ * @param { string | string[] } search
1959
+ * @param { string } replace
1960
+ * @param { boolean } caseSensitive
1961
+ *
1962
+ * @return { Stringable }
1963
+ */
1964
+ replace(search: string | string[], replace: string, caseSensitive?: boolean): Stringable;
1965
+ /**
1966
+ * Replace a given value in the string sequentially with an array.
1967
+ *
1968
+ * @param { string } search
1969
+ * @param { string[] } replace
1970
+ *
1971
+ * @return { Stringable }
1972
+ */
1973
+ replaceArray(search: string, replace: string[]): Stringable;
1974
+ /**
1975
+ * Replace the first occurrence of a given value in the string.
1976
+ *
1977
+ * @param { string } search
1978
+ * @param { string } replace
1979
+ *
1980
+ * @return { Stringable }
1981
+ */
1982
+ replaceFirst(search: string, replace: string): Stringable;
1983
+ /**
1984
+ * Replace the first occurrence of the given value if it appears at the start of the string.
1985
+ *
1986
+ * @param { string } search
1987
+ * @param { string } replace
1988
+ *
1989
+ * @return { Stringable }
1990
+ */
1991
+ replaceStart(search: string, replace: string): Stringable;
1992
+ /**
1993
+ * Replace the last occurrence of a given value in the string.
1994
+ *
1995
+ * @param { string } search
1996
+ * @param { string } replace
1997
+ *
1998
+ * @return { Stringable }
1999
+ */
2000
+ replaceLast(search: string, replace: string): Stringable;
2001
+ /**
2002
+ * Replace the last occurrence of a given value if it appears at the end of the string.
2003
+ *
2004
+ * @param { string } search
2005
+ * @param { string } replace
2006
+ *
2007
+ * @return { Stringable }
2008
+ */
2009
+ replaceEnd(search: string, replace: string): Stringable;
2010
+ /**
2011
+ * Replace the patterns matching the given regular expression.
2012
+ *
2013
+ * @param { string } pattern
2014
+ * @param { string | function } replace
2015
+ *
2016
+ * @return { Stringable }
2017
+ */
2018
+ replaceMatches(pattern: string, replace: string | Function): Stringable;
2019
+ /**
2020
+ * Remove all "extra" blank space from the given string.
2021
+ *
2022
+ * @return { Stringable }
2023
+ */
2024
+ squish(): Stringable;
2025
+ /**
2026
+ * Begin a string with a single instance of a given value.
2027
+ *
2028
+ * @param { string } prefix
2029
+ *
2030
+ * @return { Stringable }
2031
+ */
2032
+ start(prefix: string): Stringable;
2033
+ /**
2034
+ * Convert the given string to upper-case.
2035
+ *
2036
+ * @return { Stringable }
2037
+ */
2038
+ upper(): Stringable;
2039
+ /**
2040
+ * Convert the given string to title case.
2041
+ *
2042
+ * @return { Stringable }
2043
+ */
2044
+ title(): Stringable;
2045
+ /**
2046
+ * Convert the given string to title case for each word.
2047
+ *
2048
+ * @return { Stringable }
2049
+ */
2050
+ headline(): Stringable;
2051
+ /**
2052
+ * Convert the given string to APA-style title case.
2053
+ *
2054
+ * @see https://apastyle.apa.org/style-grammar-guidelines/capitalization/title-case
2055
+ *
2056
+ * @return { Stringable }
2057
+ */
2058
+ apa(): Stringable;
2059
+ /**
2060
+ * Get the singular form of an English word.
2061
+ *
2062
+ * @return { Stringable }
2063
+ */
2064
+ singular(): Stringable;
2065
+ /**
2066
+ * Generate a URL friendly "slug" from a given string.
2067
+ *
2068
+ * @param { string } separator
2069
+ * @param { object } dictionary
2070
+ *
2071
+ * @return { Stringable }
2072
+ */
2073
+ slug(separator?: string, dictionary?: {
2074
+ [key: string]: string;
2075
+ }): Stringable;
2076
+ /**
2077
+ * Convert a string to snake case.
2078
+ *
2079
+ * @param { string } delimiter
2080
+ *
2081
+ * @return { Stringable }
2082
+ */
2083
+ snake(delimiter?: string): Stringable;
2084
+ /**
2085
+ * Determine if a given string starts with a given substring.
2086
+ *
2087
+ * @param { string | string[] } needles
2088
+ *
2089
+ * @return { boolean }
2090
+ */
2091
+ startsWith(needles: string | string[]): boolean;
2092
+ /**
2093
+ * Determine if a given string doesn't start with a given substring.
2094
+ *
2095
+ * @param { string | string[] } needles
2096
+ *
2097
+ * @return { boolean }
2098
+ */
2099
+ doesntStartWith(needles: string | string[]): boolean;
2100
+ /**
2101
+ * Convert a value to studly caps case.
2102
+ *
2103
+ * @return { Stringable }
2104
+ */
2105
+ studly(): Stringable;
2106
+ /**
2107
+ * Convert a value to Pascal case.
2108
+ *
2109
+ * @return { Stringable }
2110
+ */
2111
+ pascal(): Stringable;
2112
+ /**
2113
+ * Returns the portion of the string specified by the start and length parameters.
2114
+ *
2115
+ * @param { number } start
2116
+ * @param { number | null } length
2117
+ *
2118
+ * @return { Stringable }
2119
+ */
2120
+ substr(start: number, length?: number | null): Stringable;
2121
+ /**
2122
+ * Returns the number of substring occurrences.
2123
+ *
2124
+ * @param { string } needle
2125
+ * @param { number } offset
2126
+ * @param { number | null } length
2127
+ *
2128
+ * @return { number }
2129
+ */
2130
+ substrCount(needle: string, offset?: number, length?: number | null): number;
2131
+ /**
2132
+ * Replace text within a portion of a string.
2133
+ *
2134
+ * @param { string } replace
2135
+ * @param { number } offset
2136
+ * @param { number | null } length
2137
+ *
2138
+ * @return { Stringable }
2139
+ */
2140
+ substrReplace(replace: string, offset?: number, length?: number | null): Stringable;
2141
+ /**
2142
+ * Swap multiple keywords in a string with other keywords.
2143
+ *
2144
+ * @param { Record<string, string> } map
2145
+ *
2146
+ * @return { Stringable }
2147
+ */
2148
+ swap(map: Record<string, string>): Stringable;
2149
+ /**
2150
+ * Take the first or last {limit} characters.
2151
+ *
2152
+ * @param { number } limit
2153
+ *
2154
+ * @return { Stringable }
2155
+ */
2156
+ take(limit: number): Stringable;
2157
+ /**
2158
+ * Call the given Closure with this instance then return the instance.
2159
+ *
2160
+ * @param { ((instance: this) => any) } callback
2161
+ *
2162
+ * @return { Stringable }
2163
+ */
2164
+ tap(callback: ((instance: this) => any)): this;
2165
+ /**
2166
+ * Trim the string of the given characters.
2167
+ *
2168
+ * @param { string | null } characters
2169
+ *
2170
+ * @return { Stringable }
2171
+ */
2172
+ trim(characters?: string | null): Stringable;
2173
+ /**
2174
+ * Left trim the string of the given characters.
2175
+ *
2176
+ * @param { string | string[]|null } characters
2177
+ *
2178
+ * @return { Stringable }
2179
+ */
2180
+ ltrim(characters?: string | null): Stringable;
2181
+ /**
2182
+ * Right trim the string of the given characters.
2183
+ *
2184
+ * @param { string | string[]|null } characters
2185
+ *
2186
+ * @return { Stringable }
2187
+ */
2188
+ rtrim(characters?: string | null): Stringable;
2189
+ /**
2190
+ * Make a string's first character lowercase.
2191
+ *
2192
+ * @return { Stringable }
2193
+ */
2194
+ lcfirst(): Stringable;
2195
+ /**
2196
+ * Make a string's first character uppercase.
2197
+ *
2198
+ * @return { Stringable }
2199
+ */
2200
+ ucfirst(): Stringable;
2201
+ /**
2202
+ * Split a string by uppercase characters.
2203
+ *
2204
+ * @return { string[] }
2205
+ */
2206
+ ucsplit(): string[];
2207
+ /**
2208
+ * Apply the callback if the given "value" is (or resolves to) truthy.
2209
+ *
2210
+ * @param { Value<this> } value
2211
+ * @param { Callback<this> } callback
2212
+ * @param { Fallback<this> } fallback
2213
+ *
2214
+ * @return { Stringable }
2215
+ */
2216
+ when(value: Value<this>, callback: Callback<this>, fallback?: Fallback<this>): this;
2217
+ /**
2218
+ * Apply the callback if the given "value" is (or resolves to) falsy.
2219
+ *
2220
+ * @param { Value<this> } value
2221
+ * @param { Callback<this> } callback
2222
+ * @param { Fallback<this> } fallback
2223
+ *
2224
+ * @return { this }
2225
+ */
2226
+ unless(value: Value<this>, callback: Callback<this>, fallback?: Fallback<this>): this;
2227
+ /**
2228
+ * Execute the given callback if the string contains a given substring.
2229
+ *
2230
+ * @param { string | string[] } needles
2231
+ * @param { Callback<this> } callback
2232
+ * @param { Fallback<this> } fallback
2233
+ *
2234
+ * @return { this }
2235
+ */
2236
+ whenContains(needles: string | string[], callback: Callback<this>, fallback?: Fallback<this>): this;
2237
+ /**
2238
+ * Execute the given callback if the string contains all array values.
2239
+ *
2240
+ * @param { string[] } needles
2241
+ * @param { Callback<this> } callback
2242
+ * @param { Fallback<this> } fallback
2243
+ *
2244
+ * @return { this }
2245
+ */
2246
+ whenContainsAll(needles: string[], callback: Callback<this>, fallback?: Fallback<this>): this;
2247
+ /**
2248
+ * Execute the given callback if the string is empty.
2249
+ *
2250
+ * @param { Callback<this> } callback
2251
+ * @param { Fallback<this> } fallback
2252
+ *
2253
+ * @return { this }
2254
+ */
2255
+ whenEmpty(callback: Callback<this>, fallback?: Fallback<this>): this;
2256
+ /**
2257
+ * Execute the given callback if the string is not empty.
2258
+ *
2259
+ * @param { Callback<this> } callback
2260
+ * @param { Fallback<this> } fallback
2261
+ *
2262
+ * @return { this }
2263
+ */
2264
+ whenNotEmpty(callback: Callback<this>, fallback?: Fallback<this>): this;
2265
+ /**
2266
+ * Execute the given callback if the string ends with a given substring.
2267
+ *
2268
+ * @param { string | string[] } needles
2269
+ * @param { Callback<this> } callback
2270
+ * @param { Fallback<this> } fallback
2271
+ *
2272
+ * @return { this }
2273
+ */
2274
+ whenEndsWith(needles: string | string[], callback: Callback<this>, fallback?: Fallback<this>): this;
2275
+ /**
2276
+ * Execute the given callback if the string doesn't end with a given substring.
2277
+ *
2278
+ * @param { string | string[] } needles
2279
+ * @param { Callback<this> } callback
2280
+ * @param { Fallback<this> } fallback
2281
+ *
2282
+ * @return { this }
2283
+ */
2284
+ whenDoesntEndWith(needles: string | string[], callback: Callback<this>, fallback?: Fallback<this>): this;
2285
+ /**
2286
+ * Execute the given callback if the string is an exact match with the given value.
2287
+ *
2288
+ * @param { string } value
2289
+ * @param { Callback<this> } callback
2290
+ * @param { Fallback<this> } fallback
2291
+ *
2292
+ * @return { this }
2293
+ */
2294
+ whenExactly(value: string, callback: Callback<this>, fallback?: Fallback<this>): this;
2295
+ /**
2296
+ * Execute the given callback if the string is not an exact match with the given value.
2297
+ *
2298
+ * @param { string } value
2299
+ * @param { Callback<this> } callback
2300
+ * @param { Fallback<this> } fallback
2301
+ *
2302
+ * @return { this }
2303
+ */
2304
+ whenNotExactly(value: string, callback: Callback<this>, fallback?: Fallback<this>): this;
2305
+ /**
2306
+ * Execute the given callback if the string matches a given pattern.
2307
+ *
2308
+ * @param { string | string[] } pattern
2309
+ * @param { Callback<this> } callback
2310
+ * @param { Fallback<this> } fallback
2311
+ *
2312
+ * @return { this }
2313
+ */
2314
+ whenIs(pattern: string | string[], callback: Callback<this>, fallback?: Fallback<this>): this;
2315
+ /**
2316
+ * Execute the given callback if the string is 7-bit ASCII.
2317
+ *
2318
+ * @param { Callback<this> } callback
2319
+ * @param { Fallback<this> } fallback
2320
+ *
2321
+ * @return { this }
2322
+ */
2323
+ whenIsAscii(callback: Callback<this>, fallback?: Fallback<this>): this;
2324
+ /**
2325
+ * Execute the given callback if the string is a valid UUID.
2326
+ *
2327
+ * @param { Callback<this> } callback
2328
+ * @param { Fallback<this> } fallback
2329
+ *
2330
+ * @return { this }
2331
+ */
2332
+ whenIsUuid(callback: Callback<this>, fallback?: Fallback<this>): this;
2333
+ /**
2334
+ * Execute the given callback if the string is a valid ULID.
2335
+ *
2336
+ * @param { Callback<this> } callback
2337
+ * @param { Fallback<this> } fallback
2338
+ *
2339
+ * @return { this }
2340
+ */
2341
+ whenIsUlid(callback: Callback<this>, fallback?: Fallback<this>): this;
2342
+ /**
2343
+ * Execute the given callback if the string starts with a given substring.
2344
+ *
2345
+ * @param { string | string[] } needles
2346
+ * @param { Callback<this> } callback
2347
+ * @param { Fallback<this> } fallback
2348
+ *
2349
+ * @return { this }
2350
+ */
2351
+ whenStartsWith(needles: string | string[], callback: Callback<this>, fallback?: Fallback<this>): this;
2352
+ /**
2353
+ * Execute the given callback if the string doesn't start with a given substring.
2354
+ *
2355
+ * @param { string | string[] } needles
2356
+ * @param { Callback<this> } callback
2357
+ * @param { Fallback<this> } fallback
2358
+ *
2359
+ * @return { this }
2360
+ */
2361
+ whenDoesntStartWith(needles: string | string[], callback: Callback<this>, fallback?: Fallback<this>): this;
2362
+ /**
2363
+ * Execute the given callback if the string matches the given pattern.
2364
+ *
2365
+ * @param { string } pattern
2366
+ * @param { Callback<this> } callback
2367
+ * @param { Fallback<this> } fallback
2368
+ *
2369
+ * @return { this }
2370
+ */
2371
+ whenTest(pattern: string, callback: Callback<this>, fallback?: Fallback<this>): this;
2372
+ /**
2373
+ * Limit the number of words in a string.
2374
+ *
2375
+ * @param { number } words
2376
+ * @param { string } end
2377
+ *
2378
+ * @return { Stringable }
2379
+ */
2380
+ words(words?: number, end?: string): Stringable;
2381
+ /**
2382
+ * Get the number of words a string contains.
2383
+ *
2384
+ * @return { number }
2385
+ */
2386
+ wordCount(): number;
2387
+ /**
2388
+ * Wrap a string to a given number of characters.
2389
+ *
2390
+ * @param { number } characters
2391
+ * @param { string } breakStr
2392
+ * @param { boolean } cutLongWords
2393
+ *
2394
+ * @returns { this }
2395
+ */
2396
+ wordWrap(characters?: number, breakStr?: string, cutLongWords?: boolean): Stringable;
2397
+ /**
2398
+ * Wrap the string with the given strings.
2399
+ *
2400
+ * @param { string } before
2401
+ * @param { string | null } after
2402
+ *
2403
+ * @return { Stringable }
2404
+ */
2405
+ wrap(before: string, after?: string | null): Stringable;
2406
+ /**
2407
+ * Unwrap the string with the given strings.
2408
+ *
2409
+ * @param { string } before
2410
+ * @param { string | null } after
2411
+ *
2412
+ * @return { Stringable }
2413
+ */
2414
+ unwrap(before: string, after?: string | null): Stringable;
2415
+ /**
2416
+ * Convert the string into a `HtmlString` instance.
2417
+ *
2418
+ * @return { HtmlStringType }
2419
+ */
2420
+ toHtmlString(): HtmlStringType;
2421
+ /**
2422
+ * Convert the string to Base64 encoding.
2423
+ *
2424
+ * @return { Stringable }
2425
+ */
2426
+ toBase64(): Stringable;
2427
+ /**
2428
+ * Decode the Base64 encoded string.
2429
+ *
2430
+ * @return { Stringable }
2431
+ */
2432
+ fromBase64(): Stringable;
2433
+ /**
2434
+ * Checks if a string is numeric
2435
+ *
2436
+ * @return { boolean }
2437
+ */
2438
+ isNumber(): boolean;
2439
+ /**
2440
+ * Checks if a string is an integer
2441
+ *
2442
+ * @return { boolean }
2443
+ */
2444
+ isInteger(): boolean;
2445
+ /**
2446
+ * ROT-N cipher.
2447
+ *
2448
+ * @param n
2449
+ * @returns
2450
+ */
2451
+ rot(n?: number): Stringable;
2452
+ /**
2453
+ * Replace trailing punctuation with new format.
2454
+ *
2455
+ * @param newFormat
2456
+ * @returns
2457
+ */
2458
+ replacePunctuation(newFormat: string): Stringable;
2459
+ /**
2460
+ * Array/object driven text replacement.
2461
+ *
2462
+ * @param replacements
2463
+ * @returns
2464
+ */
2465
+ translate(replacements: Record<string, string> | Array<[string, string]>): Stringable;
2466
+ /**
2467
+ * Strip slashes recursively.
2468
+ *
2469
+ * @returns
2470
+ */
2471
+ ss(): Stringable;
2472
+ /**
2473
+ * First and last N lines.
2474
+ *
2475
+ * @param amount
2476
+ * @returns
2477
+ */
2478
+ firstLines(amount?: number): Stringable;
2479
+ /**
2480
+ * Last and first N lines.
2481
+ *
2482
+ * @param amount
2483
+ * @returns
2484
+ */
2485
+ lastLines(amount?: number): Stringable;
2486
+ /**
2487
+ * Dump the string.
2488
+ *
2489
+ * @return { void }
2490
+ */
2491
+ dump(): void;
2492
+ /**
2493
+ * Dump the string and end the script.
2494
+ *
2495
+ * @return { never }
2496
+ */
2497
+ dd(): never;
2498
+ /**
2499
+ * Get the underlying string value.
2500
+ *
2501
+ * @return { string }
2502
+ */
2503
+ value(): string;
2504
+ /**
2505
+ * Get the raw string value.
2506
+ *
2507
+ * @return { string }
2508
+ */
2509
+ toString(): string;
2510
+ /**
2511
+ * Get the underlying string value as an integer.
2512
+ *
2513
+ * @param { number } base
2514
+ *
2515
+ * @return { number }
2516
+ */
2517
+ toInteger(base?: number): number;
2518
+ /**
2519
+ * Get the underlying string value as a float.
2520
+ *
2521
+ * @return { number }
2522
+ */
2523
+ toFloat(): number;
2524
+ /**
2525
+ * Get the underlying string value as a boolean.
2526
+ *
2527
+ * Returns true when value is "1", "true", "on", and "yes". Otherwise, returns false.
2528
+ *
2529
+ * @return { boolean }
2530
+ */
2531
+ toBoolean(): boolean;
2532
+ /**
2533
+ * Get the underlying string value as a formatted Date string.
2534
+ *
2535
+ * @param { string | null } format
2536
+ * @param { string | null } tz
2537
+ */
2538
+ toDate(format?: string | null, tz?: string | null): string;
2539
+ }
2540
+ declare class HtmlString {
2541
+ /**
2542
+ * The HTML string.
2543
+ *
2544
+ * @type { string }
2545
+ */
2546
+ private readonly html;
2547
+ /**
2548
+ * Create a new HTML string instance.
2549
+ *
2550
+ * @param { string } html
2551
+ *
2552
+ * @return void
2553
+ */
2554
+ constructor(html?: string);
2555
+ /**
2556
+ * Get the HTML string.
2557
+ *
2558
+ * @return { HtmlStringType }
2559
+ */
2560
+ toHtml(): HtmlStringType;
2561
+ /**
2562
+ * Determine if the given HTML string is empty.
2563
+ *
2564
+ * @return { boolean }
2565
+ */
2566
+ isEmpty(): boolean;
2567
+ /**
2568
+ * Determine if the given HTML string is not empty.
2569
+ *
2570
+ * @return { boolean }
2571
+ */
2572
+ isNotEmpty(): boolean;
2573
+ /**
2574
+ * Get the HTML string.
2575
+ *
2576
+ * @return { string }
2577
+ */
2578
+ toString(): string;
2579
+ }
180
2580
  /**
181
- * Get the portion of the string after the first occurrence of the given value.
2581
+ * Get a new Stringable object from the given string.
182
2582
  *
183
- * @param value
184
- * @param search
185
- * @returns
186
- */
187
- declare const after: (value: string, search: string) => string;
188
- /**
189
- * Get the portion of the string after the last occurrence of the given value.
2583
+ * @param { string } string
190
2584
  *
191
- * @param value
192
- * @param search
193
- * @returns
2585
+ * @return Stringable
194
2586
  */
195
- declare const afterLast: (value: string, search: string) => string;
196
- /**
197
- * Get the portion of the string before the first occurrence of the given value.
198
- *
199
- * @param value
200
- * @param search
201
- * @returns
202
- */
203
- declare const before: (value: string, search: string) => string;
204
- /**
205
- * Get the portion of the string before the last occurrence of the given value.
206
- *
207
- * @param value
208
- * @param search
209
- * @returns
210
- */
211
- declare const beforeLast: (value: string, search: string) => string;
212
- /**
213
- * Capitalizes the first character of a string.
214
- *
215
- * @param str - The input string
216
- * @returns The string with the first character capitalized
217
- */
218
- declare function capitalize(str: string): string;
219
- /**
220
- * Returns the pluralized form of a word based on the given number.
221
- *
222
- * @param word - The word to pluralize
223
- * @param count - The number determining pluralization
224
- * @returns Singular if count === 1, otherwise plural form
225
- */
226
- declare const pluralize: (word: string, count: number) => string;
2587
+ declare function str(string?: string): Stringable;
2588
+ //#endregion
2589
+ //#region src/Helpers/Time.d.ts
2590
+ declare function format(date: ConfigType, fmt: string): string;
2591
+ declare const TimeClass: {
2592
+ new (date?: dayjs.ConfigType): Dayjs;
2593
+ } & typeof Dayjs;
2594
+ declare class Time extends TimeClass {
2595
+ private instance;
2596
+ constructor(config?: ConfigType);
2597
+ /**
2598
+ * Start time of a specific unit.
2599
+ *
2600
+ * @returns
2601
+ */
2602
+ start(unit?: OpUnitType): dayjs.Dayjs;
2603
+ /**
2604
+ * End time of a specific unit.
2605
+ *
2606
+ * @returns
2607
+ */
2608
+ end(unit?: OpUnitType): dayjs.Dayjs;
2609
+ /**
2610
+ * Get the first day of the month of the given date
2611
+ *
2612
+ * @returns
2613
+ */
2614
+ firstDayOfMonth(): Time;
2615
+ carbonFormat(template?: string | undefined): string;
2616
+ /**
2617
+ * Get the last day of the month of the given date
2618
+ *
2619
+ * @returns
2620
+ */
2621
+ lastDayOfMonth(): Time;
2622
+ /**
2623
+ * Get a random time between the specified hour and minute.
2624
+ *
2625
+ * @param startHour
2626
+ * @param startMinute
2627
+ * @param endHour
2628
+ * @param endMinute
2629
+ * @returns
2630
+ */
2631
+ randomTime(startHour?: number, startMinute?: number, endHour?: number, endMinute?: number): Time;
2632
+ /**
2633
+ * Create a date for a given timestamp.
2634
+ *
2635
+ * @param timestamp - Unix timestamp
2636
+ *
2637
+ * @return {Date} object
2638
+ */
2639
+ static fromTimestamp(timestamp: number): Date;
2640
+ /**
2641
+ * Get current time instance.
2642
+ *
2643
+ * @returns Current time
2644
+ */
2645
+ static now(): Time;
2646
+ /**
2647
+ * Parse the time
2648
+ *
2649
+ * @param date
2650
+ * @returns
2651
+ */
2652
+ static parse(date: dayjs.ConfigType): Time;
2653
+ /**
2654
+ * Get the formatted date according to the string of tokens passed in.
2655
+ *
2656
+ * To escape characters, wrap them in square brackets (e.g. [MM]).
2657
+ *
2658
+ * @param time - current time
2659
+ * @param template - time format
2660
+ */
2661
+ static format(time?: ConfigType, template?: string | undefined): string;
2662
+ /**
2663
+ * Get the difference in days from today.
2664
+ *
2665
+ * @param time
2666
+ * @param startHour
2667
+ * @param startMinute
2668
+ * @param endHour
2669
+ * @param endMinute
2670
+ * @returns
2671
+ */
2672
+ static randomTime(time?: ConfigType, startHour?: number, startMinute?: number, endHour?: number, endMinute?: number): Time;
2673
+ /**
2674
+ * Get the first day of the month of the given date
2675
+ *
2676
+ * @param time
2677
+ *
2678
+ * @returns
2679
+ */
2680
+ static firstDayOfMonth(time: ConfigType): Time;
2681
+ /**
2682
+ * Get the last day of the month of the given date
2683
+ *
2684
+ * @param time
2685
+ *
2686
+ * @returns
2687
+ */
2688
+ static lastDayOfMonth(time: ConfigType): Time;
2689
+ }
2690
+ //#endregion
2691
+ //#region src/GlobalBootstrap.d.ts
2692
+ type CollapseStatics<T extends Record<string, any>> = { [K in keyof T]: T[K] };
2693
+ type Omitables = 'start' | 'take' | 'reverse' | 'chunk' | 'find' | 'pop' | 'end' | 'shift' | 'push' | 'at' | 'prototype' | 'concat' | 'join' | 'slice' | 'sort' | 'splice' | 'includes' | 'indexOf' | 'lastIndexOf' | 'findIndex' | 'every' | 'some' | 'forEach' | 'map' | 'filter' | 'reduce' | 'unshift' | 'flat' | 'flatMap' | 'keys' | 'fill' | 'copyWithin' | 'entries' | 'values' | 'reduceRight' | 'length' | 'of' | typeof Symbol.unscopables | typeof Symbol.iterator;
2694
+ type TakeTime = Pick<typeof Time, 'now' | 'format' | 'fromTimestamp' | 'randomTime' | 'firstDayOfMonth' | 'lastDayOfMonth' | 'parse'>;
2695
+ type TakeString = Pick<typeof Str, 'after' | 'afterLast' | 'apa' | 'ascii' | 'before' | 'beforeLast' | 'between' | 'betweenFirst' | 'capitalize' | 'plural' | 'singular' | 'title'>;
227
2696
  /**
228
- * Converts a plural English word into its singular form.
229
- *
230
- * @param word - The word to singularize
231
- * @returns The singular form of the word
2697
+ * Global helpers interface that mirrors Laravel's helpers
2698
+ * and provides convenient access to all utility functions
232
2699
  */
233
- declare const singularize: (word: string) => string;
2700
+ interface GlobalHelpers extends Omit<CollapseStatics<typeof Arr_d_exports>, Omitables>, Omit<CollapseStatics<TakeString>, Omitables | 'random' | 'uuid'>, Omit<CollapseStatics<TakeTime>, Omitables>, Omit<CollapseStatics<typeof Obj_d_exports>, Omitables>, Omit<CollapseStatics<typeof Crypto_d_exports>, Omitables>, Omit<CollapseStatics<typeof Number_d_exports>, Omitables>, Omit<CollapseStatics<typeof DumpDie_d_exports>, Omitables> {
2701
+ Arr: typeof Arr_d_exports;
2702
+ Str: typeof Str;
2703
+ Obj: typeof Obj_d_exports;
2704
+ Crypto: typeof Crypto_d_exports;
2705
+ Time: typeof Time;
2706
+ Number: typeof Number_d_exports;
2707
+ DumpDie: typeof DumpDie_d_exports;
2708
+ }
234
2709
  /**
235
- * Converts a string into a slug format.
236
- * Handles camelCase, spaces, and non-alphanumeric characters.
2710
+ * Bootstrap the global helpers into the global scope.
2711
+ * This enables optional global access to all helper functions.
237
2712
  *
238
- * @param str - The input string to slugify
239
- * @param joiner - The character used to join words (default: "_")
240
- * @returns A slugified string
241
- */
242
- declare const slugify: (str: string, joiner?: string) => string;
243
- /**
244
- * Truncates a string to a specified length and appends an ellipsis if needed.
2713
+ * Example usage:
2714
+ * ```typescript
2715
+ * import { loadHelpers } from '@h3ravel/support'
245
2716
  *
246
- * @param str - The input string
247
- * @param len - Maximum length of the result (including ellipsis)
248
- * @param ellipsis - String to append if truncated (default: "...")
249
- * @returns The truncated string
250
- */
251
- declare const subString: (str: string, len: number, ellipsis?: string) => string;
252
- /**
253
- * Replaces placeholders in a string with corresponding values from a data object.
2717
+ * // Make helpers globally available
2718
+ * loadHelpers()
254
2719
  *
255
- * Example:
256
- * substitute("Hello { user.name }!", { user: { name: "John" } })
257
- * // "Hello John!"
2720
+ * // Now you can use:
2721
+ * Arr.chunk([1, 2, 3, 4], 2)
2722
+ * // or directly:
2723
+ * chunk([1, 2, 3, 4], 2)
2724
+ * Str.capitalize('hello world')
2725
+ * // or directly:
2726
+ * capitalize('hello world')
2727
+ * ```
258
2728
  *
259
- * @param str - The string containing placeholders wrapped in { } braces.
260
- * @param data - Object containing values to substitute. Supports nested keys via dot notation.
261
- * @param def - Default value to use if a key is missing. (Optional)
262
- * @returns The substituted string or undefined if the input string or data is invalid.
2729
+ * @param target - The target object to attach helpers to (default: globalThis)
263
2730
  */
264
- declare const substitute: (str: string, data?: Record<string, unknown>, def?: string) => string | undefined;
2731
+ declare function loadHelpers(target?: any): void;
265
2732
  /**
266
- * Truncates a string to a specified length, removing HTML tags and
267
- * appending a suffix if the string exceeds the length.
2733
+ * Clean up global helpers by removing them from the global scope.
2734
+ * This function removes all global helper attachments.
268
2735
  *
269
- * @param str - The string to truncate
270
- * @param len - Maximum length (default: 20)
271
- * @param suffix - Suffix to append if truncated (default: "...")
272
- * @returns The truncated string
2736
+ * @param target - The target object to clean up (default: globalThis)
273
2737
  */
274
- declare const truncate: (str: string, len?: number, suffix?: string) => string;
2738
+ declare function cleanHelpers(target?: any): void;
275
2739
  //#endregion
276
- export { CamelToSnakeCase, KeysToSnakeCase, SnakeToCamelCase, SnakeToTitleCase, TGeneric, XGeneric, abbreviate, after, afterLast, before, beforeLast, capitalize, chunk, dd, dot, dump, extractProperties, getValue, humanize, modObj, pluralize, range, safeDot, setNested, singularize, slugify, slugifyKeys, subString, substitute, toBytes, toHumanTime, truncate };
2740
+ export { Arr_d_exports as Arr, Callback, CamelToSnakeCase, Crypto_d_exports as Crypto, DumpDie_d_exports as DumpDie, ExcerptOptions, Fallback, Function, GlobalHelpers, HtmlString, HtmlStringType, KeysToSnakeCase, Mode, Number_d_exports as Number, Obj_d_exports as Obj, SnakeToCamelCase, SnakeToTitleCase, Str, Stringable, TGeneric, Time, Value, XGeneric, abbreviate, alternate, base64Decode, base64Encode, caesarCipher, checksum, chunk, cleanHelpers, collapse, combine, dd, dot, dump, extractProperties, find, first, flatten, forget, format, getValue, hash, hmac, humanize, isEmpty, isNotEmpty, last, loadHelpers, modObj, pop, prepend, random, randomColor, randomPassword, randomSecure, range, reverse, safeDot, secureToken, setNested, shift, slugifyKeys, str, take, toBytes, toHumanTime, uuid, verifyChecksum, xor };
277
2741
  //# sourceMappingURL=index.d.cts.map