@h3ravel/support 0.11.0 → 0.13.0

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