@tolki/str 1.0.8 → 1.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +104 -104
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -8,7 +8,7 @@ The full documentation for the string utilities can be found at [https://tolki.a
8
8
 
9
9
  <!-- AUTO-GENERATED-DOCS:START -->
10
10
 
11
- # String Utilities Installation
11
+ ## String Utilities Installation
12
12
 
13
13
  The [`@tolki/str`](https://www.npmjs.com/package/@tolki/str) package provides a variety of string manipulation utilities inspired by Laravel's Str class. You can install it via npm, yarn, or pnpm:
14
14
 
@@ -24,7 +24,7 @@ yarn add @tolki/str
24
24
  pnpm add @tolki/str
25
25
  ```
26
26
 
27
- ## Importing the Package
27
+ ### Importing the Package
28
28
 
29
29
  You can import individual functions for better tree-shaking or the entire package (not recommended).:
30
30
 
@@ -54,17 +54,17 @@ The reason that importing the entire package is not recommended is that it will
54
54
 
55
55
  However, if you are working on a backend project where bundle size is not a concern, importing the entire package can be more convenient.
56
56
 
57
- # Tolki String Utilities List
57
+ ## Tolki String Utilities List
58
58
 
59
- ## String Utilities List
59
+ ### String Utilities List
60
60
 
61
61
  These are the string utilities that can be used independently as single functions.
62
62
 
63
63
  [after](#after) [afterLast](#afterlast) [apa](#apa) [ascii](#ascii) [before](#before) [beforeLast](#beforelast) [between](#between) [betweenFirst](#betweenfirst) [camel](#camel) [charAt](#charat) [chopEnd](#chopend) [chopStart](#chopstart) [contains](#contains) [containsAll](#containsall) [doesntContain](#doesntcontain) [deduplicate](#deduplicate) [doesntEndWith](#doesntendwith) [doesntStartWith](#doesntstartwith) [endsWith](#endswith) [excerpt](#excerpt) [finish](#finish) [fromBase64](#frombase64) [headline](#headline) [inlineMarkdown](#inlinemarkdown) [is](#is) [isAscii](#isascii) [isJson](#isjson) [isUrl](#isurl) [isUlid](#isulid) [isUuid](#isuuid) [kebab](#kebab) [lcfirst](#lcfirst) [length](#length) [limit](#limit) [lower](#lower) [markdown](#markdown) [mask](#mask) [match](#match) [matchAll](#matchall) [isMatch](#ismatch) [numbers](#numbers) [padBoth](#padboth) [padLeft](#padleft) [padRight](#padright) [pascal](#pascal) [pluralPascal](#pluralpascal) [password](#password) [plural](#plural) [pluralStudly](#pluralstudly) [position](#position) [random](#random) [remove](#remove) [repeat](#repeat) [replace](#replace) [replaceArray](#replacearray) [replaceFirst](#replacefirst) [replaceLast](#replacelast) [replaceMatches](#replacematches) [replaceStart](#replacestart) [replaceEnd](#replaceend) [reverse](#reverse) [singular](#singular) [slug](#slug) [snake](#snake) [squish](#squish) [start](#start) [startsWith](#startswith) [stripTags](#striptags) [studly](#studly) [substr](#substr) [substrCount](#substrcount) [substrReplace](#substrreplace) [swap](#swap) [take](#take) [title](#title) [toBase64](#tobase64) [transliterate](#transliterate) [trim](#trim) [ltrim](#ltrim) [rtrim](#rtrim) [ucfirst](#ucfirst) [ucsplit](#ucsplit) [ucwords](#ucwords) [upper](#upper) [ulid](#ulid) [unwrap](#unwrap) [uuid](#uuid) [uuid7](#uuid7) [wordCount](#wordcount) [wordWrap](#wordwrap) [words](#words) [wrap](#wrap) [str](#str) [of](#of)
64
64
 
65
- ## String Utilities Details
65
+ ### String Utilities Details
66
66
 
67
- ### after
67
+ #### after
68
68
 
69
69
  Return the remainder of a string after the first occurrence of a given value.
70
70
 
@@ -76,7 +76,7 @@ const result = after("This is my name", "This is");
76
76
  // result is " my name"
77
77
  ```
78
78
 
79
- ### afterLast
79
+ #### afterLast
80
80
 
81
81
  Return the remainder of a string after the last occurrence of a given value.
82
82
 
@@ -88,7 +88,7 @@ const result = afterLast("App\Http\Controllers\Controller", "\\");
88
88
  // result is "Controller"
89
89
  ```
90
90
 
91
- ### apa
91
+ #### apa
92
92
 
93
93
  Convert the given string to [APA-style](https://apastyle.apa.org/style-grammar-guidelines/capitalization/title-case) title case.
94
94
 
@@ -100,7 +100,7 @@ const result = apa("Creating A Project");
100
100
  // result is "Creating a Project"
101
101
  ```
102
102
 
103
- ### ascii
103
+ #### ascii
104
104
 
105
105
  Transliterate a UTF-8 value to ASCII.
106
106
 
@@ -114,7 +114,7 @@ const result = ascii("û");
114
114
  // result is "u"
115
115
  ```
116
116
 
117
- ### before
117
+ #### before
118
118
 
119
119
  Get the portion of a string before the first occurrence of a given value.
120
120
 
@@ -126,7 +126,7 @@ const result = before("This is my name", "my");
126
126
  // result is "This is "
127
127
  ```
128
128
 
129
- ### beforeLast
129
+ #### beforeLast
130
130
 
131
131
  Get the portion of a string before the last occurrence of a given value.
132
132
 
@@ -138,7 +138,7 @@ const result = beforeLast("This is my name", "is");
138
138
  // result is "This "
139
139
  ```
140
140
 
141
- ### between
141
+ #### between
142
142
 
143
143
  Get the portion of a string between two given values.
144
144
 
@@ -150,7 +150,7 @@ const result = between("This is my name", "This", "name");
150
150
  // result is " is my "
151
151
  ```
152
152
 
153
- ### betweenFirst
153
+ #### betweenFirst
154
154
 
155
155
  Get the smallest possible portion of a string between two given values.
156
156
 
@@ -162,7 +162,7 @@ const result = betweenFirst("[a] bc [d]", "[", "]");
162
162
  // result is "a"
163
163
  ```
164
164
 
165
- ### camel
165
+ #### camel
166
166
 
167
167
  Convert a value to camel case.
168
168
 
@@ -174,7 +174,7 @@ const result = camel("foo_bar");
174
174
  // result is "fooBar"
175
175
  ```
176
176
 
177
- ### charAt
177
+ #### charAt
178
178
 
179
179
  Get the character at the specified index.
180
180
 
@@ -186,7 +186,7 @@ const result = charAt("This is my name.", 6);
186
186
  // result is "s"
187
187
  ```
188
188
 
189
- ### chopStart
189
+ #### chopStart
190
190
 
191
191
  Remove the given string(s) if it exists at the start of the haystack.
192
192
 
@@ -208,7 +208,7 @@ const result = chopStart("http://laravel.com", ["https://", "http://"]);
208
208
  // result is "laravel.com"
209
209
  ```
210
210
 
211
- ### chopEnd
211
+ #### chopEnd
212
212
 
213
213
  Remove the given string(s) if it exists at the end of the haystack.
214
214
 
@@ -230,7 +230,7 @@ const result = chopEnd("laravel.com/index.php", ["/index.html", "/index.php"]);
230
230
  // result is "laravel.com"
231
231
  ```
232
232
 
233
- ### contains
233
+ #### contains
234
234
 
235
235
  Determine if a given string contains a given substring.
236
236
 
@@ -262,7 +262,7 @@ const result = contains("This is my name", "MY", true);
262
262
  // result is true
263
263
  ```
264
264
 
265
- ### containsAll
265
+ #### containsAll
266
266
 
267
267
  Determine if a given string contains all array values.
268
268
 
@@ -284,7 +284,7 @@ const result = containsAll("This is my name", ["MY", "NAME"], true);
284
284
  // result is true
285
285
  ```
286
286
 
287
- ### doesntContain
287
+ #### doesntContain
288
288
 
289
289
  Determine if a given string doesn't contain a given substring.
290
290
 
@@ -316,7 +316,7 @@ const result = doesntContain("This is name", "MY", true);
316
316
  // result is true
317
317
  ```
318
318
 
319
- ### deduplicate
319
+ #### deduplicate
320
320
 
321
321
  Replace consecutive instances of a given character with a single character in the given string.
322
322
 
@@ -348,7 +348,7 @@ const result = deduplicate("The---Laravel Framework", ["-", " "]);
348
348
  // result is "The-Laravel Framework"
349
349
  ```
350
350
 
351
- ### doesntEndWith
351
+ #### doesntEndWith
352
352
 
353
353
  Determine if a given string doesn't end with a given substring.
354
354
 
@@ -374,7 +374,7 @@ const result2 = doesntEndWith("This is my name", ["name", "foo"]);
374
374
  // result2 is false
375
375
  ```
376
376
 
377
- ### doesntStartWith
377
+ #### doesntStartWith
378
378
 
379
379
  Determine if a given string doesn't start with a given substring.
380
380
 
@@ -400,7 +400,7 @@ const result2 = doesntStartWith("This is my name", ["name", "foo"]);
400
400
  // result2 is true
401
401
  ```
402
402
 
403
- ### endsWith
403
+ #### endsWith
404
404
 
405
405
  Determine if a given string ends with a given substring.
406
406
 
@@ -426,7 +426,7 @@ const result2 = endsWith("This is my name", ["this", "foo"]);
426
426
  // result2 is false
427
427
  ```
428
428
 
429
- ### excerpt
429
+ #### excerpt
430
430
 
431
431
  Extracts an excerpt from text that matches the first instance of a phrase.
432
432
 
@@ -453,7 +453,7 @@ const result = excerpt("This is my name", "name", {
453
453
  // result is "(...) my name"
454
454
  ```
455
455
 
456
- ### finish
456
+ #### finish
457
457
 
458
458
  Cap a string with a single instance of a given value.
459
459
 
@@ -469,7 +469,7 @@ const result2 = finish("this/string/", "/");
469
469
  // result2 is also 'this/string/'
470
470
  ```
471
471
 
472
- ### fromBase64
472
+ #### fromBase64
473
473
 
474
474
  Decode the given Base64 encoded string.
475
475
 
@@ -481,7 +481,7 @@ const result = fromBase64("TGFyYXZlbA==");
481
481
  // result is 'Laravel'
482
482
  ```
483
483
 
484
- ### headline
484
+ #### headline
485
485
 
486
486
  Convert the given string to proper case for each word.
487
487
 
@@ -497,7 +497,7 @@ const result2 = headline("EmailNotificationSent");
497
497
  // result2 is "Email Notification Sent"
498
498
  ```
499
499
 
500
- ### inlineMarkdown
500
+ #### inlineMarkdown
501
501
 
502
502
  Converts inline Markdown into HTML.
503
503
 
@@ -511,7 +511,7 @@ const result = inlineMarkdown("This is **bold** and this is *italic*.");
511
511
  // result is 'This is <strong>bold</strong> and this is <em>italic</em>.'
512
512
  ```
513
513
 
514
- #### Inline Markdown Security
514
+ ##### Inline Markdown Security
515
515
 
516
516
  By default, the `inlineMarkdown` function disables raw HTML and unsafe links (e.g., `javascript:` URLs) to prevent XSS attacks. You can enable raw HTML by passing `{ html: true }` in the options.
517
517
 
@@ -538,7 +538,7 @@ const result = inlineMarkdown("[click me](javascript:alert(1))", {
538
538
  // result is '<a href="javascript:alert(1)">click me</a>'
539
539
  ```
540
540
 
541
- ### is
541
+ #### is
542
542
 
543
543
  Determine if a given string matches a given pattern.
544
544
 
@@ -564,7 +564,7 @@ const result = is("*.jpg", "photo.JPG", true);
564
564
  // result is true
565
565
  ```
566
566
 
567
- ### isAscii
567
+ #### isAscii
568
568
 
569
569
  Determine if a given string is 7 bit ASCII.
570
570
 
@@ -580,7 +580,7 @@ const result2 = isAscii("û");
580
580
  // result2 is false
581
581
  ```
582
582
 
583
- ### isJson
583
+ #### isJson
584
584
 
585
585
  Determine if a given value is valid JSON.
586
586
 
@@ -600,7 +600,7 @@ const result3 = isJson('{first: "John", last: "Doe"}');
600
600
  // result3 is false
601
601
  ```
602
602
 
603
- ### isUrl
603
+ #### isUrl
604
604
 
605
605
  Determine if a given value is a valid URL.
606
606
 
@@ -630,7 +630,7 @@ const result2 = isUrl("http://example.com", ["https"]);
630
630
  // result2 is false
631
631
  ```
632
632
 
633
- ### isUlid
633
+ #### isUlid
634
634
 
635
635
  Determine if a given value is a valid ULID.
636
636
 
@@ -646,7 +646,7 @@ const result2 = isUlid("tolkijs");
646
646
  // result2 is false
647
647
  ```
648
648
 
649
- ### isUuid
649
+ #### isUuid
650
650
 
651
651
  Determine if a given value is a valid UUID.
652
652
 
@@ -678,7 +678,7 @@ const result2 = isUuid("a0a2a2d2-0b87-4a18-83f2-2529882be2de", 5);
678
678
  // result2 is false
679
679
  ```
680
680
 
681
- ### kebab
681
+ #### kebab
682
682
 
683
683
  Convert a string to kebab case.
684
684
 
@@ -690,7 +690,7 @@ const result = kebab("fooBar");
690
690
  // result is "foo-bar"
691
691
  ```
692
692
 
693
- ### lcfirst
693
+ #### lcfirst
694
694
 
695
695
  Make a string's first character lowercase.
696
696
 
@@ -702,7 +702,7 @@ const result = lcfirst("Foo Bar");
702
702
  // result is "foo Bar"
703
703
  ```
704
704
 
705
- ### length
705
+ #### length
706
706
 
707
707
  Return the length of the given string.
708
708
 
@@ -714,7 +714,7 @@ const result = length("Tolki JS");
714
714
  // result is 8
715
715
  ```
716
716
 
717
- ### limit
717
+ #### limit
718
718
 
719
719
  Limit the number of characters in a string.
720
720
 
@@ -751,7 +751,7 @@ const result = limit(
751
751
  // result is "The quick..."
752
752
  ```
753
753
 
754
- ### lower
754
+ #### lower
755
755
 
756
756
  Convert the given string to lower-case.
757
757
 
@@ -763,7 +763,7 @@ const result = lower("LARAVEL");
763
763
  // result is "laravel"
764
764
  ```
765
765
 
766
- ### markdown
766
+ #### markdown
767
767
 
768
768
  Converts GitHub flavored Markdown into HTML.
769
769
 
@@ -777,7 +777,7 @@ const result = markdown("# Laravel");
777
777
  // result is "<h1>Laravel</h1>"
778
778
  ```
779
779
 
780
- #### Markdown Security
780
+ ##### Markdown Security
781
781
 
782
782
  By default, the `markdown` function disables raw HTML and unsafe links (e.g., `javascript:` URLs) to prevent XSS attacks. You can enable raw HTML by passing `{ html: true }` in the options.
783
783
 
@@ -804,7 +804,7 @@ const result = markdown("[click me](javascript:alert(1))", {
804
804
  // result is '<p><a href="javascript:alert(1)">click me</a></p>'
805
805
  ```
806
806
 
807
- ### mask
807
+ #### mask
808
808
 
809
809
  Masks a portion of a string with a repeated character.
810
810
 
@@ -826,7 +826,7 @@ const result = mask("taylor@example.com", "*", -15, 3);
826
826
  // result is "tay***@example.com"
827
827
  ```
828
828
 
829
- ### match
829
+ #### match
830
830
 
831
831
  Get the string matching the given pattern.
832
832
 
@@ -842,7 +842,7 @@ const result2 = match("/foo (.*)/", "foo bar");
842
842
  // result2 is "bar"
843
843
  ```
844
844
 
845
- ### matchAll
845
+ #### matchAll
846
846
 
847
847
  Get the string(s) matching the given pattern.
848
848
 
@@ -856,7 +856,7 @@ const result = matchAll("/bar/", "bar foo bar");
856
856
 
857
857
  If no matches are found, an empty array will be returned.
858
858
 
859
- ### isMatch
859
+ #### isMatch
860
860
 
861
861
  Determine if a given string matches a given pattern.
862
862
 
@@ -872,13 +872,13 @@ const result2 = isMatch("/foo (.*)/", "laravel");
872
872
  // result2 is false
873
873
  ```
874
874
 
875
- ### orderedUuid
875
+ #### orderedUuid
876
876
 
877
877
  This function is purposely not implemented. Use the `uuid7()` function instead to generate a UUIDv7, which is a time-ordered UUID.
878
878
 
879
879
  See more details on this [StackOverflow discussion](https://stackoverflow.com/a/79196945).
880
880
 
881
- ### numbers
881
+ #### numbers
882
882
 
883
883
  Remove all non-numeric characters from a string.
884
884
 
@@ -894,7 +894,7 @@ const result2 = numbers("L4r4v3l!");
894
894
  // result2 is "443"
895
895
  ```
896
896
 
897
- ### padBoth
897
+ #### padBoth
898
898
 
899
899
  Pad both sides of a string with another string to a certain length.
900
900
 
@@ -910,7 +910,7 @@ const result2 = padBoth("James", 10);
910
910
  // result2 is " James "
911
911
  ```
912
912
 
913
- ### padLeft
913
+ #### padLeft
914
914
 
915
915
  Pad the left side of a string with another string to a certain length.
916
916
 
@@ -926,7 +926,7 @@ const result2 = padLeft("James", 10);
926
926
  // result2 is " James"
927
927
  ```
928
928
 
929
- ### padRight
929
+ #### padRight
930
930
 
931
931
  Pad the right side of a string with another string to a certain length.
932
932
 
@@ -942,7 +942,7 @@ const result2 = padRight("James", 10);
942
942
  // result2 is "James "
943
943
  ```
944
944
 
945
- ### pascal
945
+ #### pascal
946
946
 
947
947
  Convert a value to Pascal case.
948
948
 
@@ -954,7 +954,7 @@ const result = pascal("hello world");
954
954
  // result is "HelloWorld"
955
955
  ```
956
956
 
957
- ### pluralPascal
957
+ #### pluralPascal
958
958
 
959
959
  Pluralize the last word of an English, Pascal caps case string.
960
960
 
@@ -966,7 +966,7 @@ const result = pluralPascal("HelloWorld");
966
966
  // result is "HelloWorlds"
967
967
  ```
968
968
 
969
- ### password
969
+ #### password
970
970
 
971
971
  Generate a random, secure password.
972
972
 
@@ -978,7 +978,7 @@ const result = password();
978
978
  // result is a random, secure password
979
979
  ```
980
980
 
981
- ### plural
981
+ #### plural
982
982
 
983
983
  Get the plural form of an English word.
984
984
 
@@ -1018,7 +1018,7 @@ const result = plural("car", 1000, true);
1018
1018
  // result is "1,000 cars"
1019
1019
  ```
1020
1020
 
1021
- ### pluralStudly
1021
+ #### pluralStudly
1022
1022
 
1023
1023
  Pluralize the last word of an English, studly caps case string.
1024
1024
 
@@ -1034,7 +1034,7 @@ const result2 = pluralStudly("UserFeedback");
1034
1034
  // result2 is "UserFeedback"
1035
1035
  ```
1036
1036
 
1037
- ### position
1037
+ #### position
1038
1038
 
1039
1039
  Find the multi-byte safe position of the first occurrence of a given substring in a string.
1040
1040
 
@@ -1050,7 +1050,7 @@ const result2 = position("Hello, World!", "W");
1050
1050
  // result2 is 7
1051
1051
  ```
1052
1052
 
1053
- ### random
1053
+ #### random
1054
1054
 
1055
1055
  Generate a more truly "random" alpha-numeric string.
1056
1056
 
@@ -1096,7 +1096,7 @@ const result2 = random(5);
1096
1096
  // result is a random 5-character alpha-numeric string
1097
1097
  ```
1098
1098
 
1099
- ### remove
1099
+ #### remove
1100
1100
 
1101
1101
  Remove any occurrence of the given string in the subject.
1102
1102
 
@@ -1122,7 +1122,7 @@ const result = remove(
1122
1122
  // result is "Ptr Pipr pickd a pck of pickld ppprs."
1123
1123
  ```
1124
1124
 
1125
- ### repeat
1125
+ #### repeat
1126
1126
 
1127
1127
  Repeat the given string.
1128
1128
 
@@ -1134,7 +1134,7 @@ const result = repeat("a", 5);
1134
1134
  // result is "aaaaa"
1135
1135
  ```
1136
1136
 
1137
- ### replace
1137
+ #### replace
1138
1138
 
1139
1139
  Replace the given value in the given string.
1140
1140
 
@@ -1161,7 +1161,7 @@ const result = replace(
1161
1161
  // result is "Laravel Framework for Web Artisans"
1162
1162
  ```
1163
1163
 
1164
- ### replaceArray
1164
+ #### replaceArray
1165
1165
 
1166
1166
  Replace a given value in the string sequentially with an array.
1167
1167
 
@@ -1177,7 +1177,7 @@ const result = replaceArray(
1177
1177
  // result is "The event will take place between 8:30 and 9:00"
1178
1178
  ```
1179
1179
 
1180
- ### replaceFirst
1180
+ #### replaceFirst
1181
1181
 
1182
1182
  Replace the first occurrence of a given value in the string.
1183
1183
 
@@ -1193,7 +1193,7 @@ const result = replaceFirst(
1193
1193
  // result is "a quick brown fox jumps over the lazy dog"
1194
1194
  ```
1195
1195
 
1196
- ### replaceLast
1196
+ #### replaceLast
1197
1197
 
1198
1198
  Replace the last occurrence of a given value in the string.
1199
1199
 
@@ -1209,7 +1209,7 @@ const result = replaceLast(
1209
1209
  // result is "the quick brown fox jumps over a lazy dog"
1210
1210
  ```
1211
1211
 
1212
- ### replaceMatches
1212
+ #### replaceMatches
1213
1213
 
1214
1214
  Replace the patterns matching the given regular expression.
1215
1215
 
@@ -1235,7 +1235,7 @@ const result = replaceMatches(
1235
1235
  // result is "My numbers are number 123 and number 456."
1236
1236
  ```
1237
1237
 
1238
- ### replaceStart
1238
+ #### replaceStart
1239
1239
 
1240
1240
  Replace the first occurrence of the given value if it appears at the start of the string.
1241
1241
 
@@ -1251,7 +1251,7 @@ const result2 = replaceStart("World", "Laravel", "Hello World");
1251
1251
  // result2 is "Hello World"
1252
1252
  ```
1253
1253
 
1254
- ### replaceEnd
1254
+ #### replaceEnd
1255
1255
 
1256
1256
  Replace the last occurrence of a given value if it appears at the end of the string.
1257
1257
 
@@ -1267,7 +1267,7 @@ const result2 = replaceEnd("Hello", "Laravel", "Hello World");
1267
1267
  // result2 is "Hello World"
1268
1268
  ```
1269
1269
 
1270
- ### reverse
1270
+ #### reverse
1271
1271
 
1272
1272
  Reverse the given string.
1273
1273
 
@@ -1279,7 +1279,7 @@ const result = reverse("Hello World");
1279
1279
  // result is "dlroW olleH"
1280
1280
  ```
1281
1281
 
1282
- ### singular
1282
+ #### singular
1283
1283
 
1284
1284
  Get the singular form of an English word.
1285
1285
 
@@ -1297,7 +1297,7 @@ const result2 = singular("children");
1297
1297
  // result2 is "child"
1298
1298
  ```
1299
1299
 
1300
- ### slug
1300
+ #### slug
1301
1301
 
1302
1302
  Generate a URL friendly "slug" from a given string.
1303
1303
 
@@ -1309,7 +1309,7 @@ const result = slug("Laravel 5 Framework", "-");
1309
1309
  // result is "laravel-5-framework"
1310
1310
  ```
1311
1311
 
1312
- ### snake
1312
+ #### snake
1313
1313
 
1314
1314
  Convert a string to snake case.
1315
1315
 
@@ -1325,7 +1325,7 @@ const result2 = snake("fooBar", "-");
1325
1325
  // result2 is "foo-bar"
1326
1326
  ```
1327
1327
 
1328
- ### squish
1328
+ #### squish
1329
1329
 
1330
1330
  Remove all "extra" blank space from the given string.
1331
1331
 
@@ -1337,7 +1337,7 @@ const result = squish(" laravel framework ");
1337
1337
  // result is "laravel framework"
1338
1338
  ```
1339
1339
 
1340
- ### start
1340
+ #### start
1341
1341
 
1342
1342
  Begin a string with a single instance of a given value.
1343
1343
 
@@ -1353,7 +1353,7 @@ const result2 = start("/this/string", "/");
1353
1353
  // result2 is also '/this/string'
1354
1354
  ```
1355
1355
 
1356
- ### startsWith
1356
+ #### startsWith
1357
1357
 
1358
1358
  Determine if a given string starts with a given substring.
1359
1359
 
@@ -1375,7 +1375,7 @@ const result = startsWith("This is my name", ["This", "That", "There"]);
1375
1375
  // result is true
1376
1376
  ```
1377
1377
 
1378
- ### stripTags
1378
+ #### stripTags
1379
1379
 
1380
1380
  Strip HTML tags from a string.
1381
1381
 
@@ -1387,7 +1387,7 @@ const result = stripTags("<p>Hello <strong>World</strong></p>");
1387
1387
  // result is "Hello World"
1388
1388
  ```
1389
1389
 
1390
- ### studly
1390
+ #### studly
1391
1391
 
1392
1392
  Convert a value to studly caps case.
1393
1393
 
@@ -1399,7 +1399,7 @@ const result = studly("foo_bar");
1399
1399
  // result is "FooBar"
1400
1400
  ```
1401
1401
 
1402
- ### substr
1402
+ #### substr
1403
1403
 
1404
1404
  Returns the portion of the string specified by the start and length parameters.
1405
1405
 
@@ -1411,7 +1411,7 @@ const result = substr("The Laravel Framework", 4, 7);
1411
1411
  // result is "Laravel"
1412
1412
  ```
1413
1413
 
1414
- ### substrCount
1414
+ #### substrCount
1415
1415
 
1416
1416
  Returns the number of substring occurrences.
1417
1417
 
@@ -1426,7 +1426,7 @@ const result = substrCount(
1426
1426
  // result is 2
1427
1427
  ```
1428
1428
 
1429
- ### substrReplace
1429
+ #### substrReplace
1430
1430
 
1431
1431
  Replace text within a portion of a string.
1432
1432
 
@@ -1442,7 +1442,7 @@ const result2 = substrReplace("1300", ":", 2, 0);
1442
1442
  // result2 is also "13:00"
1443
1443
  ```
1444
1444
 
1445
- ### swap
1445
+ #### swap
1446
1446
 
1447
1447
  Swap multiple keywords in a string with other keywords.
1448
1448
 
@@ -1460,7 +1460,7 @@ const result = swap(
1460
1460
  // result is "Burritos are fantastic"
1461
1461
  ```
1462
1462
 
1463
- ### take
1463
+ #### take
1464
1464
 
1465
1465
  Take the first or last {$limit} characters of a string.
1466
1466
 
@@ -1476,7 +1476,7 @@ const result2 = take("Build something amazing!", -5);
1476
1476
  // result2 is "zing!"
1477
1477
  ```
1478
1478
 
1479
- ### title
1479
+ #### title
1480
1480
 
1481
1481
  Convert the given string to proper case.
1482
1482
 
@@ -1488,7 +1488,7 @@ const result = title("a nice title uses the correct case");
1488
1488
  // result is "A Nice Title Uses The Correct Case"
1489
1489
  ```
1490
1490
 
1491
- ### toBase64
1491
+ #### toBase64
1492
1492
 
1493
1493
  Convert the given string to Base64 encoding.
1494
1494
 
@@ -1500,7 +1500,7 @@ const result = toBase64("Laravel");
1500
1500
  // result is "TGFyYXZlbA=="
1501
1501
  ```
1502
1502
 
1503
- ### transliterate
1503
+ #### transliterate
1504
1504
 
1505
1505
  Transliterate a string to its closest ASCII representation.
1506
1506
 
@@ -1518,7 +1518,7 @@ const result2 = transliterate("ⓣⓔⓢⓣ@ⓛⓐⓡⓐⓥⓔⓛ.ⓒⓞⓜ");
1518
1518
  // result2 is "test@laravel.com"
1519
1519
  ```
1520
1520
 
1521
- ### trim
1521
+ #### trim
1522
1522
 
1523
1523
  Remove all whitespace from both ends of a string.
1524
1524
 
@@ -1530,7 +1530,7 @@ const result = trim(" foo bar ");
1530
1530
  // result is "foo bar"
1531
1531
  ```
1532
1532
 
1533
- ### ltrim
1533
+ #### ltrim
1534
1534
 
1535
1535
  Remove all whitespace from the beginning of a string.
1536
1536
 
@@ -1542,7 +1542,7 @@ const result = ltrim(" foo bar ");
1542
1542
  // result is "foo bar "
1543
1543
  ```
1544
1544
 
1545
- ### rtrim
1545
+ #### rtrim
1546
1546
 
1547
1547
  Remove all whitespace from the end of a string.
1548
1548
 
@@ -1554,7 +1554,7 @@ const result = rtrim(" foo bar ");
1554
1554
  // result is " foo bar"
1555
1555
  ```
1556
1556
 
1557
- ### ucfirst
1557
+ #### ucfirst
1558
1558
 
1559
1559
  Make a string's first character uppercase.
1560
1560
 
@@ -1566,7 +1566,7 @@ const result = ucfirst("foo bar");
1566
1566
  // result is "Foo bar"
1567
1567
  ```
1568
1568
 
1569
- ### ucsplit
1569
+ #### ucsplit
1570
1570
 
1571
1571
  Split a string into pieces by uppercase characters.
1572
1572
 
@@ -1578,7 +1578,7 @@ const result = ucsplit("FooBar");
1578
1578
  // result is ["Foo", "Bar"]
1579
1579
  ```
1580
1580
 
1581
- ### ucwords
1581
+ #### ucwords
1582
1582
 
1583
1583
  Uppercase the first letter of each word in a string.
1584
1584
 
@@ -1590,7 +1590,7 @@ const result = ucwords("laravel framework");
1590
1590
  // result is "Laravel Framework"
1591
1591
  ```
1592
1592
 
1593
- ### upper
1593
+ #### upper
1594
1594
 
1595
1595
  Convert the given string to upper-case.
1596
1596
 
@@ -1602,7 +1602,7 @@ const result = upper("laravel");
1602
1602
  // result is "LARAVEL"
1603
1603
  ```
1604
1604
 
1605
- ### ulid
1605
+ #### ulid
1606
1606
 
1607
1607
  Generate a ULID (Universally Unique Lexicographically Sortable Identifier).
1608
1608
 
@@ -1646,7 +1646,7 @@ const result2 = ulid();
1646
1646
  // result is a randomly generated ULID
1647
1647
  ```
1648
1648
 
1649
- ### unwrap
1649
+ #### unwrap
1650
1650
 
1651
1651
  Unwrap the string with the given strings.
1652
1652
 
@@ -1662,7 +1662,7 @@ const result2 = unwrap('{framework: "Laravel"}', "{", "}");
1662
1662
  // result2 is 'framework: "Laravel"'
1663
1663
  ```
1664
1664
 
1665
- ### uuid
1665
+ #### uuid
1666
1666
 
1667
1667
  Generate a UUID (version 4).
1668
1668
 
@@ -1706,7 +1706,7 @@ const result2 = uuid();
1706
1706
  // result is a randomly generated UUID
1707
1707
  ```
1708
1708
 
1709
- ### uuid7
1709
+ #### uuid7
1710
1710
 
1711
1711
  Generate a UUID (version 7).
1712
1712
 
@@ -1722,7 +1722,7 @@ const result = uuid7();
1722
1722
 
1723
1723
  The `uuid7()` function also uses the `createUuidsUsing` and `createUuidsNormally` functions for testing purposes, as described in the `uuid` function above.
1724
1724
 
1725
- ### wordCount
1725
+ #### wordCount
1726
1726
 
1727
1727
  Get the number of words a string contains.
1728
1728
 
@@ -1734,7 +1734,7 @@ const result = wordCount("Hello, world!");
1734
1734
  // result is 2
1735
1735
  ```
1736
1736
 
1737
- ### wordWrap
1737
+ #### wordWrap
1738
1738
 
1739
1739
  Wrap a string to a given number of characters.
1740
1740
 
@@ -1755,7 +1755,7 @@ dog.
1755
1755
  */
1756
1756
  ```
1757
1757
 
1758
- ### words
1758
+ #### words
1759
1759
 
1760
1760
  Limit the number of words in a string.
1761
1761
 
@@ -1767,7 +1767,7 @@ const result = words("Perfectly balanced, as all things should be.", 3, " >>>");
1767
1767
  // result is "Perfectly balanced, as >>>"
1768
1768
  ```
1769
1769
 
1770
- ### wrap
1770
+ #### wrap
1771
1771
 
1772
1772
  Wrap the string with the given strings.
1773
1773
 
@@ -1783,7 +1783,7 @@ const result2 = wrap("is", "This ", " Laravel!");
1783
1783
  // result2 is 'This is Laravel!'
1784
1784
  ```
1785
1785
 
1786
- ### str
1786
+ #### str
1787
1787
 
1788
1788
  Using the `str` or `of` functions is discouraged for frontend projects because it will import the entire `Stringable` class, all of its methods, and all 3rd party dependencies into your final bundle, which may significantly increase its size.
1789
1789
 
@@ -1809,7 +1809,7 @@ const result = str().snake("FooBar");
1809
1809
  // result is a Stringable class instance representing "foo_bar"
1810
1810
  ```
1811
1811
 
1812
- ### of
1812
+ #### of
1813
1813
 
1814
1814
  The `of` function is an alias for the `str` function made for parity with Laravels' `Str::of` method. See the [str](#str) function documentation for details.
1815
1815
 
@@ -1821,9 +1821,9 @@ const result = of("Laravel").upper();
1821
1821
  // result is a Stringable class instance representing "LARAVEL"
1822
1822
  ```
1823
1823
 
1824
- # Tolki Stringable Utilities List
1824
+ ## Tolki Stringable Utilities List
1825
1825
 
1826
- ## Stringable utilities list
1826
+ ### Stringable utilities list
1827
1827
 
1828
1828
  The documentation for fluent string utilities is in the works. In the meantime, I recommend checking out the Laravel documentation for [Fluent strings](https://laravel.com/docs/12.x/strings#fluent-strings-method-list) since the JavaScript utilities are designed to mirror the Laravel ones as closely as possible.
1829
1829
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tolki/str",
3
- "version": "1.0.8",
3
+ "version": "1.0.9",
4
4
  "description": "Utilities for working with strings similar to Laravel's Str & Stringable classes.",
5
5
  "author": "Abraham Arango <https://github.com/abetwothree>",
6
6
  "license": "MIT",
@@ -36,7 +36,7 @@
36
36
  "transliteration": "^2.6.0",
37
37
  "ulid": "^2.4.0",
38
38
  "uuid": "^11.1.0",
39
- "@tolki/num": "^2.0.2",
39
+ "@tolki/num": "^2.0.3",
40
40
  "@tolki/utils": "^1.0.2"
41
41
  },
42
42
  "files": [