stringzy 3.0.0 → 4.1.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.
Files changed (171) hide show
  1. package/.prettierignore +4 -0
  2. package/.prettierrc +7 -0
  3. package/CONTRIBUTING.md +41 -29
  4. package/README.md +811 -163
  5. package/dist/analyzing/characterCount.d.ts +19 -0
  6. package/dist/analyzing/characterCount.js +21 -2
  7. package/dist/analyzing/characterFrequency.d.ts +19 -0
  8. package/dist/analyzing/characterFrequency.js +22 -3
  9. package/dist/analyzing/checkMultiplePatterns.d.ts +14 -0
  10. package/dist/analyzing/checkMultiplePatterns.js +63 -0
  11. package/dist/analyzing/checkSubsequence.d.ts +14 -0
  12. package/dist/analyzing/checkSubsequence.js +33 -0
  13. package/dist/analyzing/complexity.d.ts +33 -0
  14. package/dist/analyzing/complexity.js +35 -2
  15. package/dist/analyzing/contentWordCount.d.ts +11 -0
  16. package/dist/analyzing/contentWordCount.js +23 -0
  17. package/dist/analyzing/functionWordCount.d.ts +11 -0
  18. package/dist/analyzing/functionWordCount.js +33 -0
  19. package/dist/analyzing/index.d.ts +29 -12
  20. package/dist/analyzing/index.js +26 -2
  21. package/dist/analyzing/patternCount.d.ts +11 -0
  22. package/dist/analyzing/patternCount.js +54 -0
  23. package/dist/analyzing/stringRotation.d.ts +29 -0
  24. package/dist/analyzing/stringRotation.js +44 -0
  25. package/dist/analyzing/stringSimilarity.js +1 -1
  26. package/dist/analyzing/vowelConsonantCount.d.ts +22 -0
  27. package/dist/analyzing/vowelConsonantCount.js +38 -0
  28. package/dist/analyzing/wordCount.d.ts +22 -0
  29. package/dist/analyzing/wordCount.js +24 -2
  30. package/dist/formatting/capitalize.d.ts +21 -0
  31. package/dist/formatting/capitalize.js +22 -1
  32. package/dist/formatting/index.d.ts +6 -6
  33. package/dist/formatting/number.d.ts +23 -0
  34. package/dist/formatting/number.js +24 -1
  35. package/dist/formatting/phone.d.ts +23 -0
  36. package/dist/formatting/phone.js +23 -0
  37. package/dist/index.d.ts +22 -4
  38. package/dist/tests/analyzing/checkMultiplePatterns.test.d.ts +1 -0
  39. package/dist/tests/analyzing/checkMultiplePatterns.test.js +81 -0
  40. package/dist/tests/analyzing/checkSubsequence.test.d.ts +1 -0
  41. package/dist/tests/analyzing/checkSubsequence.test.js +34 -0
  42. package/dist/tests/analyzing/contentWordCount.test.d.ts +1 -0
  43. package/dist/tests/analyzing/contentWordCount.test.js +20 -0
  44. package/dist/tests/analyzing/functionWordCount.test.d.ts +1 -0
  45. package/dist/tests/analyzing/functionWordCount.test.js +20 -0
  46. package/dist/tests/analyzing/patternCount.test.d.ts +1 -0
  47. package/dist/tests/analyzing/patternCount.test.js +34 -0
  48. package/dist/tests/analyzing/readingDuration.test.js +12 -12
  49. package/dist/tests/analyzing/stringRotation.test.d.ts +1 -0
  50. package/dist/tests/analyzing/stringRotation.test.js +42 -0
  51. package/dist/tests/analyzing/vowelConsonantCount.test.d.ts +1 -0
  52. package/dist/tests/analyzing/vowelConsonantCount.test.js +25 -0
  53. package/dist/tests/transformations/numberToText.test.d.ts +1 -0
  54. package/dist/tests/transformations/numberToText.test.js +60 -0
  55. package/dist/tests/transformations/reverseString.test.d.ts +1 -0
  56. package/dist/tests/transformations/reverseString.test.js +41 -0
  57. package/dist/tests/transformations/splitChunks.test.d.ts +1 -0
  58. package/dist/tests/transformations/splitChunks.test.js +31 -0
  59. package/dist/tests/transformations/stringCombinations.test.d.ts +1 -0
  60. package/dist/tests/transformations/stringCombinations.test.js +41 -0
  61. package/dist/tests/transformations/stringPermutations.test.d.ts +1 -0
  62. package/dist/tests/transformations/stringPermutations.test.js +40 -0
  63. package/dist/tests/validations/isAlphaNumeric.test.d.ts +1 -0
  64. package/dist/tests/validations/isAlphaNumeric.test.js +30 -0
  65. package/dist/tests/validations/isAlphabetic.test.d.ts +1 -0
  66. package/dist/tests/validations/isAlphabetic.test.js +32 -0
  67. package/dist/tests/validations/isAnagram.test.d.ts +1 -0
  68. package/dist/tests/validations/isAnagram.test.js +44 -0
  69. package/dist/tests/validations/isCoordinates.test.d.ts +1 -0
  70. package/dist/tests/validations/isCoordinates.test.js +18 -0
  71. package/dist/tests/validations/isEmail.smtpUTF8.test.d.ts +1 -0
  72. package/dist/tests/validations/isEmail.smtpUTF8.test.js +16 -0
  73. package/dist/tests/validations/isEmail.test.js +56 -6
  74. package/dist/tests/validations/isHexColor.test.js +21 -21
  75. package/dist/tests/validations/isLowerCase.test.d.ts +1 -0
  76. package/dist/tests/validations/isLowerCase.test.js +50 -0
  77. package/dist/tests/validations/isMacAddress.test.d.ts +1 -0
  78. package/dist/tests/validations/isMacAddress.test.js +72 -0
  79. package/dist/tests/validations/isPalindrome.test.d.ts +1 -0
  80. package/dist/tests/validations/isPalindrome.test.js +39 -0
  81. package/dist/tests/validations/isPanagram.test.d.ts +1 -0
  82. package/dist/tests/validations/isPanagram.test.js +39 -0
  83. package/dist/tests/validations/isTypeOf.test.d.ts +1 -0
  84. package/dist/tests/validations/isTypeOf.test.js +28 -0
  85. package/dist/tests/validations/isUpperCase.test.d.ts +1 -0
  86. package/dist/tests/validations/isUpperCase.test.js +50 -0
  87. package/dist/transformations/camelCase.d.ts +24 -0
  88. package/dist/transformations/camelCase.js +24 -0
  89. package/dist/transformations/capitalizeWords.d.ts +21 -0
  90. package/dist/transformations/capitalizeWords.js +23 -2
  91. package/dist/transformations/constantCase.d.ts +26 -0
  92. package/dist/transformations/constantCase.js +26 -0
  93. package/dist/transformations/escapeHTML.d.ts +23 -0
  94. package/dist/transformations/escapeHTML.js +24 -2
  95. package/dist/transformations/index.d.ts +12 -0
  96. package/dist/transformations/index.js +18 -2
  97. package/dist/transformations/initials.d.ts +27 -0
  98. package/dist/transformations/initials.js +38 -8
  99. package/dist/transformations/kebabCase.d.ts +26 -0
  100. package/dist/transformations/kebabCase.js +26 -0
  101. package/dist/transformations/maskSegment.js +4 -6
  102. package/dist/transformations/numberToText/helpers.d.ts +10 -0
  103. package/dist/transformations/numberToText/helpers.js +31 -0
  104. package/dist/transformations/numberToText/implementation_EN.d.ts +10 -0
  105. package/dist/transformations/numberToText/implementation_EN.js +45 -0
  106. package/dist/transformations/numberToText/implementation_PL.d.ts +10 -0
  107. package/dist/transformations/numberToText/implementation_PL.js +79 -0
  108. package/dist/transformations/numberToText/main.d.ts +19 -0
  109. package/dist/transformations/numberToText/main.js +67 -0
  110. package/dist/transformations/numberToText/types.d.ts +3 -0
  111. package/dist/transformations/numberToText/types.js +82 -0
  112. package/dist/transformations/pascalCase.d.ts +25 -0
  113. package/dist/transformations/pascalCase.js +25 -0
  114. package/dist/transformations/removeDuplicates.d.ts +21 -0
  115. package/dist/transformations/removeDuplicates.js +25 -4
  116. package/dist/transformations/removeSpecialChars.d.ts +22 -0
  117. package/dist/transformations/removeSpecialChars.js +26 -4
  118. package/dist/transformations/removeWords.d.ts +27 -0
  119. package/dist/transformations/removeWords.js +31 -4
  120. package/dist/transformations/reverseWordsInString .d.ts +9 -0
  121. package/dist/transformations/reverseWordsInString .js +49 -0
  122. package/dist/transformations/snakeCase.d.ts +26 -0
  123. package/dist/transformations/snakeCase.js +26 -0
  124. package/dist/transformations/splitChunks.d.ts +8 -0
  125. package/dist/transformations/splitChunks.js +24 -0
  126. package/dist/transformations/stringCombinations.d.ts +28 -0
  127. package/dist/transformations/stringCombinations.js +44 -0
  128. package/dist/transformations/stringPermutations.d.ts +31 -0
  129. package/dist/transformations/stringPermutations.js +53 -0
  130. package/dist/transformations/titleCase.d.ts +25 -0
  131. package/dist/transformations/titleCase.js +25 -0
  132. package/dist/transformations/toSlug.d.ts +24 -0
  133. package/dist/transformations/toSlug.js +28 -4
  134. package/dist/transformations/truncateText.d.ts +25 -0
  135. package/dist/transformations/truncateText.js +28 -3
  136. package/dist/validations/index.d.ts +27 -0
  137. package/dist/validations/index.js +38 -2
  138. package/dist/validations/isAlphaNumeric.d.ts +11 -0
  139. package/dist/validations/isAlphaNumeric.js +22 -0
  140. package/dist/validations/isAlphabetic.d.ts +9 -0
  141. package/dist/validations/isAlphabetic.js +21 -0
  142. package/dist/validations/isAnagram.d.ts +13 -0
  143. package/dist/validations/isAnagram.js +23 -0
  144. package/dist/validations/isCoordinates.d.ts +8 -0
  145. package/dist/validations/isCoordinates.js +19 -0
  146. package/dist/validations/isDate.d.ts +1 -1
  147. package/dist/validations/isDate.js +6 -8
  148. package/dist/validations/isEmail.d.ts +13 -1
  149. package/dist/validations/isEmail.js +176 -3
  150. package/dist/validations/isEmpty.d.ts +9 -0
  151. package/dist/validations/isEmpty.js +9 -0
  152. package/dist/validations/isHexColor.js +1 -1
  153. package/dist/validations/isIPv4.d.ts +21 -0
  154. package/dist/validations/isIPv4.js +22 -2
  155. package/dist/validations/isLowerCase.d.ts +12 -0
  156. package/dist/validations/isLowerCase.js +32 -0
  157. package/dist/validations/isMacAddress.d.ts +27 -0
  158. package/dist/validations/isMacAddress.js +43 -0
  159. package/dist/validations/isPalindrome.d.ts +10 -0
  160. package/dist/validations/isPalindrome.js +21 -0
  161. package/dist/validations/isPanagram.d.ts +20 -0
  162. package/dist/validations/isPanagram.js +35 -0
  163. package/dist/validations/isSlug.d.ts +27 -0
  164. package/dist/validations/isSlug.js +27 -0
  165. package/dist/validations/isTypeOf.d.ts +9 -0
  166. package/dist/validations/isTypeOf.js +30 -0
  167. package/dist/validations/isURL.d.ts +21 -0
  168. package/dist/validations/isURL.js +21 -0
  169. package/dist/validations/isUpperCase.d.ts +12 -0
  170. package/dist/validations/isUpperCase.js +32 -0
  171. package/package.json +6 -4
package/README.md CHANGED
@@ -1,13 +1,11 @@
1
1
  <div align="center">
2
-
3
-
4
- ![Stringzy banner](./assets/stringzy-banner2.jpg)
5
2
 
3
+ ![Stringzy banner](./assets/stringzy-banner2.jpg)
6
4
 
7
5
  ![NPM Version](https://img.shields.io/npm/v/stringzy)
6
+ ![Typescript](https://img.shields.io/badge/TypeScript-3178C6?style=flat&logo=typescript&logoColor=white)
8
7
  ![Downloads](https://img.shields.io/npm/dt/stringzy)
9
8
  ![License](https://img.shields.io/npm/l/stringzy)
10
- ![Bundle Size](https://img.shields.io/bundlephobia/min/stringzy)
11
9
  [![Open Source Love svg1](https://badges.frapsoft.com/os/v1/open-source.svg?v=103)](https://github.com/ellerbrock/open-source-badges/)
12
10
  [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com)
13
11
 
@@ -15,15 +13,10 @@
15
13
 
16
14
  [Checkout our Contributors!](#contri)
17
15
 
18
-
19
16
  [Join the Community!](#community)
20
17
 
21
-
22
-
23
-
24
18
  </div>
25
19
 
26
-
27
20
  ## ✨ Features
28
21
 
29
22
  - 💪 **Powerful** - Transform, validate, analyze, and format strings with minimal code
@@ -66,7 +59,8 @@ const count = stringzy.analyze.wordCount('Hello world'); // 2
66
59
 
67
60
  ## 📋 Table of Contents
68
61
 
69
- ### Transformations
62
+ ### Transformations
63
+
70
64
  - [truncateText](#truncatetext) - Truncates text to a specified maximum length
71
65
  - [toSlug](#toslug) - Converts a string to a URL-friendly slug
72
66
  - [capitalizeWords](#capitalizewords) - Capitalizes the first letter of each word
@@ -76,31 +70,56 @@ const count = stringzy.analyze.wordCount('Hello world'); // 2
76
70
  - [initials](#initials) - Extracts initials from a text string
77
71
  - [camelCase](#camelcase) - Converts the given string to Camel Case
78
72
  - [pascalCase](#pascalcase) - Converts the given string to Pascal Case
79
- - [snakeCase](#snakecase) - Converts the given string to Snake Case
73
+ - [snakeCase](#snakecase) - Converts the given string to Snake Case
80
74
  - [kebabCase](#kebabcase) - Converts the given string to Kebab Case
81
75
  - [titleCase](#titlecase) - Converts the given string to Title Case
82
76
  - [constantCase](#constantcase) - Converts the given string to Constant Case
83
77
  - [escapeHTML](#escapehtml) - Escapes HTML special characters to prevent XSS attacks
84
78
  - [maskSegment](#masksegment) - Masks a segment of a string by replacing characters between two indices with a specified character
85
79
  - [deburr](#deburr) – Removes accents and diacritical marks from a string
80
+ - [splitChunks](#splitchunks) - Breaks a string down into chunks of specified length.
81
+ - [numberToText](#numbertotext) - Converts a number to its text representation in specified language
82
+ - [reverseWordsInString](#reversewordsinstring) - Reverses the order of words in a given string
83
+ - [stringPermutations](#stringpermutations) - Generates all unique permutations of a given string.
84
+ - [stringCombinations](#stringcombinations) - Generates all unique combinations of a given string.
86
85
 
86
+ ### Validations
87
87
 
88
- ### Validations
89
88
  - [isURL](#isurl) - Checks if a string is a valid URL
90
89
  - [isEmail](#isemail) - Checks if a string is a valid email address
91
90
  - [isDate](#isdate) - Checks if a string is a valid date
92
91
  - [isEmpty](#isempty) - Checks if a string is empty or contains only whitespace
93
92
  - [isSlug](#isslug) - Checks if a string is a valid slug
93
+ - [isTypeOf](#istypeof) - Checks if a file or URL has a valid extension for a given type
94
94
  - [isIPv4](#isipv4) - Checks if a string is a valid IPv4 address
95
95
  - [isHexColor](#ishexcolor) - Checks if the input string is a valid hex color
96
+ - [isPalindrome](#ispalindrome) - Checks if the input string is a palindrome (ignores case, spaces, and punctuation)
97
+ - [isCoordinates](#iscoordinates) - Checks if given latitude and longitude are valid coordinates
98
+ - [isLowerCase](#islowercase) - Checks if given string only has lower case characters.
99
+ - [isUpperCase](#isuppercase) - Checks if given string only has upper case characters.
100
+ - [isAlphabetic](#isalphabetic) - Checks if input string contains only Alphabets (case insensitive)
101
+ - [isAlphaNumeric](#isalphanumeric) - Checks if input string contains only Alphabets and Digits (case insensitive)
102
+ - [isAnagram](#isanagram)- Checks if both strings are anagrams of each other. (ignores case and punctuations)
103
+ - [isMacAddress](#ismacaddress)- Checks if a given string is a valid MAC address.
104
+ - [isPanagram](#ispanagram)- Checks if a given string is a pangram (contains every letter of the English alphabet at least once).
105
+
106
+ ### Analysis
96
107
 
97
- ### Analysis
98
108
  - [wordCount](#wordcount) - Counts the number of words in a string
109
+ - [contentWordCount](#contentwordcount)- Counts the number of content words (nouns, verbs, adjectives, adverbs, etc.) in a string.
110
+ - [functionWordCount](#functionwordcount)- Counts the number of function words (prepositions, pronouns, conjunctions, articles, etc.) in a string.
99
111
  - [readingDuration](#readingduration) - Calculates the reading duration of a given string
100
112
  - [characterCount](#charactercount) - Counts the number of characters in a string
101
113
  - [characterFrequency](#characterfrequency) - Analyzes character frequency in a string
102
114
  - [stringSimilarity](#stringsimilarity) - Calculates the percentage similarity between two strings
103
- ### Formatting
115
+ - [complexity](#complexity) - Analyzes string complexity including score, uniqueness, and length
116
+ - [patternCount](#patterncount) - calculates the number of times a specific pattern occurs in a given text
117
+ - [vowelConsonantCount](#vowelconsonantcount) - Counts the number of vowels and consonants in a given string
118
+ - [checkMultiplePatterns](#checkmultiplepatterns) - Finds occurrences of multiple patterns within a given text using Rabin–Karp algorithm (case sensitive)
119
+ - [checkSubsequence](#checksubsequence) - Checks whether the second string is a subsequence of the first string (case sensitive)
120
+ - [stringRotation](#stringrotation) - Checks if one string is a rotation of another (case sensitive).
121
+ ### Formatting
122
+
104
123
  - [capitalize](#capitalize) - Capitalizes the first letter of each word
105
124
  - [formatNumber](#formatnumber) - Formats a number string with thousand separators
106
125
  - [formatPhone](#formatphone) - Formats a phone number string to standard format
@@ -128,11 +147,11 @@ truncateText('Short', 10);
128
147
  // Returns: 'Short' (no truncation needed)
129
148
  ```
130
149
 
131
- | Parameter | Type | Default | Description |
132
- |-----------|------|---------|-------------|
133
- | text | string | required | The input string to truncate |
150
+ | Parameter | Type | Default | Description |
151
+ | --------- | ------ | -------- | ------------------------------------------------------ |
152
+ | text | string | required | The input string to truncate |
134
153
  | maxLength | number | required | Maximum length of the output string (excluding suffix) |
135
- | suffix | string | '...' | String to append if truncation occurs |
154
+ | suffix | string | '...' | String to append if truncation occurs |
136
155
 
137
156
  #### <a id="toslug"></a>`toSlug(text)`
138
157
 
@@ -151,9 +170,9 @@ toSlug('Special $#@! characters');
151
170
  // Returns: 'special-characters'
152
171
  ```
153
172
 
154
- | Parameter | Type | Default | Description |
155
- |-----------|------|---------|-------------|
156
- | text | string | required | The input string to convert to a slug |
173
+ | Parameter | Type | Default | Description |
174
+ | --------- | ------ | -------- | ------------------------------------- |
175
+ | text | string | required | The input string to convert to a slug |
157
176
 
158
177
  #### <a id="capitalizewords"></a>`capitalizeWords(text)`
159
178
 
@@ -172,9 +191,9 @@ capitalizeWords('already Capitalized');
172
191
  // Returns: 'Already Capitalized'
173
192
  ```
174
193
 
175
- | Parameter | Type | Default | Description |
176
- |-----------|------|---------|-------------|
177
- | text | string | required | The input string to capitalize |
194
+ | Parameter | Type | Default | Description |
195
+ | --------- | ------ | -------- | ------------------------------ |
196
+ | text | string | required | The input string to capitalize |
178
197
 
179
198
  #### <a id="removespecialchars"></a>`removeSpecialChars(text, replacement = '')`
180
199
 
@@ -193,10 +212,10 @@ removeSpecialChars('Phone: (123) 456-7890', '-');
193
212
  // Returns: 'Phone-123-456-7890'
194
213
  ```
195
214
 
196
- | Parameter | Type | Default | Description |
197
- |-----------|------|---------|-------------|
198
- | text | string | required | The input string to process |
199
- | replacement | string | '' | String to replace special characters with |
215
+ | Parameter | Type | Default | Description |
216
+ | ----------- | ------ | -------- | ----------------------------------------- |
217
+ | text | string | required | The input string to process |
218
+ | replacement | string | '' | String to replace special characters with |
200
219
 
201
220
  #### <a id="removewords"></a>`removeWords(text, wordsToRemove)`
202
221
 
@@ -209,20 +228,20 @@ removeWords('Hello world this is a test', ['this', 'is']);
209
228
  // Returns: 'Hello world a test'
210
229
 
211
230
  removeWords('Remove The Quick BROWN fox', ['the', 'brown']);
212
- // Returns: 'Remove Quick fox'
231
+ // Returns: 'Remove Quick fox'
213
232
 
214
233
  removeWords('JavaScript is awesome and JavaScript rocks', ['JavaScript']);
215
234
  // Returns: 'is awesome and rocks'
216
235
  ```
217
236
 
218
- | Parameter | Type | Default | Description |
219
- |-----------|------|---------|-------------|
220
- | text | string | required | The input string to process |
237
+ | Parameter | Type | Default | Description |
238
+ | ------------- | -------- | -------- | ---------------------------------------- |
239
+ | text | string | required | The input string to process |
221
240
  | wordsToRemove | string[] | required | Array of words to remove from the string |
222
241
 
223
242
  #### <a id="removeduplicates"></a>`removeDuplicates(text)`
224
243
 
225
- Removes duplicate case-sensitive words from a given text.
244
+ Removes duplicate case-sensitive words from a given text.
226
245
 
227
246
  ```javascript
228
247
  import { removeDuplicates } from 'stringzy';
@@ -231,15 +250,15 @@ removeDuplicates('Hello world this is a is a test');
231
250
  // Returns: 'Hello world this is a test'
232
251
 
233
252
  removeDuplicates('Remove me me me me or Me');
234
- // Returns: 'Remove me or Me'
253
+ // Returns: 'Remove me or Me'
235
254
 
236
255
  removeDuplicates('JavaScript is not bad and not awesome');
237
256
  // Returns: 'JavaScript is not bad and awesome'
238
257
  ```
239
258
 
240
- | Parameter | Type | Default | Description |
241
- |-----------|------|---------|-------------|
242
- | text | string | required | The input string to process |
259
+ | Parameter | Type | Default | Description |
260
+ | --------- | ------ | -------- | --------------------------- |
261
+ | text | string | required | The input string to process |
243
262
 
244
263
  #### <a id="initials"></a>`initials(text, limit)`
245
264
 
@@ -264,10 +283,10 @@ initials(' Multiple Spaces Between ');
264
283
  // Returns: 'MSB'
265
284
  ```
266
285
 
267
- | Parameter | Type | Default | Description |
268
- |-----------|------|---------|-------------|
269
- | text | string | required | The input string to extract initials from |
270
- | limit | number | undefined | Maximum number of initials to return (optional) |
286
+ | Parameter | Type | Default | Description |
287
+ | --------- | ------ | --------- | ----------------------------------------------- |
288
+ | text | string | required | The input string to extract initials from |
289
+ | limit | number | undefined | Maximum number of initials to return (optional) |
271
290
 
272
291
  #### <a id="camelcase"></a>`camelCase(text)`
273
292
 
@@ -277,43 +296,41 @@ Converts the given string to Camel Case.
277
296
  import { camelCase } from 'stringzy';
278
297
 
279
298
  camelCase('hello world'); // 'helloWorld'
280
- camelCase('this is a test'); // 'thisIsATest'
281
- ```
282
- | Parameter | Type | Default | Description |
283
- |-----------|------|---------|-------------|
284
- | text | string | required | The input string to convert to Camel Case |
299
+ camelCase('this is a test'); // 'thisIsATest'
300
+ ```
285
301
 
302
+ | Parameter | Type | Default | Description |
303
+ | --------- | ------ | -------- | ----------------------------------------- |
304
+ | text | string | required | The input string to convert to Camel Case |
286
305
 
287
306
  #### <a id="pascalcase"></a>`pascalCase(text)`
307
+
288
308
  Converts the given string to Pascal Case.
289
309
 
290
310
  ```javascript
291
311
  import { pascalCase } from 'stringzy';
292
312
 
293
-
294
313
  pascalCase('hello world'); // 'HelloWorld'
295
314
  pascalCase('this is a test'); // 'ThisIsATest'
296
315
  ```
297
- | Parameter | Type | Default | Description |
298
- |-----------|------|---------|-------------|
299
- | text | string | required | The input string to convert to Pascal Case |
316
+
317
+ | Parameter | Type | Default | Description |
318
+ | --------- | ------ | -------- | ------------------------------------------ |
319
+ | text | string | required | The input string to convert to Pascal Case |
300
320
 
301
321
  #### <a id="snakecase"></a>`snakeCase(text)`
302
322
 
303
323
  Converts the given string to Snake Case.
304
324
 
305
- ```javascript
325
+ ```javascript
306
326
  import { snakeCase } from 'stringzy';
307
327
  snakeCase('hello world'); // 'hello_world'
308
328
  snakeCase('this is a test'); // 'this_is_a_test'
309
329
  ```
310
330
 
311
- | Parameter | Type | Default | Description |
312
- |-----------|------|---------|-------------|
313
- | text | string | required | The input string to convert to Snake Case |
314
-
315
-
316
-
331
+ | Parameter | Type | Default | Description |
332
+ | --------- | ------ | -------- | ----------------------------------------- |
333
+ | text | string | required | The input string to convert to Snake Case |
317
334
 
318
335
  #### <a id="kebabcase"></a>`kebabCase(text)`
319
336
 
@@ -322,15 +339,13 @@ Converts the given string to Kebab Case.
322
339
  ```javascript
323
340
  import { kebabCase } from 'stringzy';
324
341
 
325
-
326
342
  kebabCase('hello world'); // 'hello-world'
327
343
  kebabCase('this is a test'); // 'this-is-a-test'
328
- ```
329
- | Parameter | Type | Default | Description |
330
- |-----------|------|---------|-------------|
331
- | text | string | required | The input string to convert to Kebab Case |
332
-
344
+ ```
333
345
 
346
+ | Parameter | Type | Default | Description |
347
+ | --------- | ------ | -------- | ----------------------------------------- |
348
+ | text | string | required | The input string to convert to Kebab Case |
334
349
 
335
350
  #### <a id="titlecase"></a>`titleCase(text)`
336
351
 
@@ -339,28 +354,28 @@ Converts the given string to Title Case.
339
354
  ```javascript
340
355
  import { titleCase } from 'stringzy';
341
356
 
342
-
343
357
  titleCase('hello world'); // 'Hello World'
344
358
  titleCase('this is a test'); // 'This Is A Test'
345
359
  ```
346
- | Parameter | Type | Default | Description |
347
- |-----------|------|---------|-------------|
348
- | text | string | required | The input string to convert to Title Case |
360
+
361
+ | Parameter | Type | Default | Description |
362
+ | --------- | ------ | -------- | ----------------------------------------- |
363
+ | text | string | required | The input string to convert to Title Case |
349
364
 
350
365
  #### <a id="constantcase"></a>`constantCase(text)`
366
+
351
367
  Converts the given string to Constant Case.
352
368
 
353
369
  ```javascript
354
370
  import { constantCase } from 'stringzy';
355
371
 
356
-
357
372
  constantCase('hello world'); // 'HELLO_WORLD'
358
373
  constantCase('this is a test'); // 'THIS_IS_A_TEST'
359
-
360
374
  ```
361
- | Parameter | Type | Default | Description |
362
- |-----------|------|---------|-------------|
363
- | text | string | required | The input string to convert to Constant Case |
375
+
376
+ | Parameter | Type | Default | Description |
377
+ | --------- | ------ | -------- | -------------------------------------------- |
378
+ | text | string | required | The input string to convert to Constant Case |
364
379
 
365
380
  #### <a id="escapehtml"></a>`escapeHTML(text)`
366
381
 
@@ -382,12 +397,13 @@ escapeHTML('Say "Hello" & it\'s < 5 > 2');
382
397
  // Returns: 'Say &quot;Hello&quot; &amp; it&#39;s &lt; 5 &gt; 2'
383
398
  ```
384
399
 
385
- | Parameter | Type | Default | Description |
386
- |-----------|------|---------|-------------|
387
- | text | string | required | The input string to escape HTML characters from |
400
+ | Parameter | Type | Default | Description |
401
+ | --------- | ------ | -------- | ----------------------------------------------- |
402
+ | text | string | required | The input string to escape HTML characters from |
388
403
 
389
404
  #### <a id="masksegment"></a>`maskSegment(text, maskStart, maskEnd, maskChar?)`
390
- Masks a segment of a string by replacing characters between two indices with a specified character (default is '*').
405
+
406
+ Masks a segment of a string by replacing characters between two indices with a specified character (default is '\*').
391
407
 
392
408
  ```javascript
393
409
  import { maskSegment } from 'stringzy';
@@ -400,16 +416,17 @@ maskSegment('abcdef', 1, 4, '#');
400
416
 
401
417
  maskSegment('token');
402
418
  // Returns: '*****'
403
-
404
419
  ```
405
- | Parameter | Type | Default| Description |
406
- |-----------|------|--------|-------------|
407
- |text | string | required | The input string to apply the masking to|
408
- |maskStart |number| `0`| The start index (inclusive) of the segment to mask|
409
- |maskEnd |number| `text.length`| The end index (exclusive) of the segment to mask|
410
- |maskChar |string |`'*'` | The character to use for masking (must be one character)|
411
420
 
412
- #### <a id="deburr"></a>deburr(text)
421
+ | Parameter | Type | Default | Description |
422
+ | --------- | ------ | ------------- | -------------------------------------------------------- |
423
+ | text | string | required | The input string to apply the masking to |
424
+ | maskStart | number | `0` | The start index (inclusive) of the segment to mask |
425
+ | maskEnd | number | `text.length` | The end index (exclusive) of the segment to mask |
426
+ | maskChar | string | `'*'` | The character to use for masking (must be one character) |
427
+
428
+ #### <a id="deburr"></a>`deburr(text)`
429
+
413
430
  Removes accents and diacritics from letters in a string (e.g. déjà vu → deja vu).
414
431
 
415
432
  ```javascript
@@ -423,14 +440,137 @@ deburr('Élève São Paulo');
423
440
 
424
441
  deburr('über cool');
425
442
  // Returns: 'uber cool'
426
-
427
443
  ```
428
- | Parameter | Type | Default | Description |
444
+
445
+ | Parameter | Type | Default | Description |
429
446
  | --------- | ------ | -------- | ----------------------------------------- |
430
447
  | text | string | required | The input string to strip diacritics from |
431
448
 
432
449
  ---
433
450
 
451
+ #### <a id="splitchunks"></a>`splitChunks(text, chunkSize)`
452
+
453
+ Takes a string and chunk size as the argument and splits the string into chunks of given size.
454
+
455
+ ```javascript
456
+ import { splitChunks } from 'stringzy';
457
+
458
+ splitChunks('helloworld', 2);
459
+ // Returns: ['he', 'll', 'ow', 'or', 'ld']
460
+
461
+ splitChunks('helloworld', 3);
462
+ // Returns: ['hel', 'low', 'orl', 'd']
463
+
464
+ splitChunks('helloworld');
465
+ // Returns: ['h', 'e', 'l', 'l', 'o', 'w', 'o', 'r', 'l', 'd']
466
+ ```
467
+
468
+ | Parameter | Type | Default | Description |
469
+ | --------- | ------ | -------- | --------------------------------------------------------- |
470
+ | text | string | required | The input string that needs to be chunked |
471
+ | chunkSize | number | `1` | The size of each chunk in which the string is to be split |
472
+
473
+ ---
474
+
475
+ #### <a id="numbertotext"></a>`numberToText(num, lang)`
476
+
477
+ Converts a number to its text representation in the specified language.
478
+
479
+ ```javascript
480
+ import { numberToText } from 'stringzy';
481
+ numberToText(12345); // Returns: 'twelve thousand three hundred forty-five'
482
+ numberToText(12345, 'en'); // Returns: 'twelve thousand three hundred forty-five'
483
+ numberToText(12345, 'pl'); // Returns: 'dwanaście tysięcy trzysta czterdzieści pięć'
484
+ ```
485
+
486
+ | Parameter | Type | Default | Description |
487
+ | --------- | ------ | -------- | --------------------------------------------------------------------------------------- |
488
+ | num | number | required | The number to convert to text |
489
+ | lang | string | 'en' | The language code for the text representation (e.g., 'en' for English, 'pl' for Polish) |
490
+
491
+ Available languages: en (English), pl (Polish).
492
+
493
+ #### <a id="reversewordsinstring"></a>`reverseWordsInString(str)`
494
+ Reverses the order of words in a string and reverses the position of surrounding whitespace (leading becomes trailing and vice-versa).
495
+ Reverses the order of words in a string while preserving the exact original spacing between each word.
496
+ ```javascript
497
+ import { reverseWordsInString } from 'stringzy';
498
+
499
+ reverseWordsInString('Hello world from stringzy');
500
+ // Returns: 'stringzy from world Hello'
501
+
502
+ // Note how the double and triple spaces are preserved:
503
+ reverseWordsInString(' leading spaces and trailing ');
504
+ // Returns: ' trailing and spaces leading '
505
+
506
+ reverseWordsInString('single-word');
507
+ // Returns: 'single-word'
508
+ ```
509
+ | Parameter | Type | Default | Description |
510
+ | --------- | ------ | -------- | --------------------------- |
511
+ | str | string | required | The input string to reverse |
512
+
513
+ #### <a id="stringpermutations"></a>`stringPermutations(str)`
514
+
515
+ Generates all unique permutations of a given string.
516
+ Repeated characters are handled by ensuring only unique permutations are included in the output array.
517
+ The order of permutations is not guaranteed.
518
+
519
+ ```javascript
520
+ stringPermutations('ab');
521
+ // ['ab', 'ba']
522
+
523
+ stringPermutations('abc');
524
+ // ['abc', 'acb', 'bac', 'bca', 'cab', 'cba']
525
+
526
+ stringPermutations('aab');
527
+ // ['aab', 'aba', 'baa']
528
+
529
+ stringPermutations('');
530
+ // ['']
531
+
532
+ stringPermutations('a');
533
+ // ['a']
534
+
535
+ stringPermutations('a1!');
536
+ // ['a1!', 'a!1', '1a!', '1!a', '!a1', '!1a']
537
+ ```
538
+
539
+ | Parameter | Type | Default | Description |
540
+ | --------- | ------ | -------- | ----------------------------------------------------- |
541
+ | str | string | required | The input string to generate all unique permutations. |
542
+
543
+ #### <a id="stringcombinations"></a>`stringCombinations(str)`
544
+
545
+ Generates all unique combinations (subsequences) of a given string, including the empty string.
546
+ Duplicate characters are handled by ensuring only unique combinations are returned.
547
+ The order of combinations in the output array is not guaranteed.
548
+
549
+ ```javascript
550
+ stringCombinations('ab');
551
+ // ["", "a", "b", "ab"]
552
+
553
+ stringCombinations('abc');
554
+ // ["", "a", "b", "c", "ab", "ac", "bc", "abc"]
555
+
556
+ stringCombinations('aab');
557
+ // ["", "a", "b", "aa", "ab", "aab"]
558
+
559
+ stringCombinations('');
560
+ // [""]
561
+
562
+ stringCombinations('A');
563
+ // ["", "A"]
564
+
565
+ stringCombinations('!@');
566
+ // ["", "!", "@", "!@"]
567
+ ```
568
+
569
+ | Parameter | Type | Default | Description |
570
+ | --------- | ------ | -------- | ------------------------------------------------------ |
571
+ | str | string | required | The input string to generate unique combinations from. |
572
+
573
+
434
574
  ### ✅ Validations
435
575
 
436
576
  Functions for validating string formats and content.
@@ -444,9 +584,9 @@ isURL('https://example.com'); // true
444
584
  isURL('not-a-url'); // false
445
585
  ```
446
586
 
447
- | Parameter | Type | Default | Description |
448
- |-----------|------|---------|-------------|
449
- | text | string | required | The input string to validate as URL |
587
+ | Parameter | Type | Default | Description |
588
+ | --------- | ------ | -------- | ----------------------------------- |
589
+ | text | string | required | The input string to validate as URL |
450
590
 
451
591
  #### <a id="isemail"></a>`isEmail(text)`
452
592
 
@@ -457,9 +597,9 @@ isEmail('user@example.com'); // true
457
597
  isEmail('invalid-email'); // false
458
598
  ```
459
599
 
460
- | Parameter | Type | Default | Description |
461
- |-----------|------|---------|-------------|
462
- | text | string | required | The input string to validate as email |
600
+ | Parameter | Type | Default | Description |
601
+ | --------- | ------ | -------- | ------------------------------------- |
602
+ | text | string | required | The input string to validate as email |
463
603
 
464
604
  #### <a id="isdate"></a>`isDate(text)`
465
605
 
@@ -476,11 +616,11 @@ isDate('invalid-date', DateFormat.YYYMMDD); // false
476
616
  isDate('2023-13-45', DateFormat.YYYMMDD); // false
477
617
  ```
478
618
 
479
- | Parameter | Type | Default | Description |
480
- |-----------|------|---------|-------------|
481
- | input | string | required | The input string to validate as date |
482
- | format | DateFormats | required | The date format to validate against |
483
- | separator | string | optional | The separator to be used if it is not "-" |
619
+ | Parameter | Type | Default | Description |
620
+ | --------- | ----------- | -------- | ----------------------------------------- |
621
+ | input | string | required | The input string to validate as date |
622
+ | format | DateFormats | required | The date format to validate against |
623
+ | separator | string | optional | The separator to be used if it is not "-" |
484
624
 
485
625
  #### <a id="isempty"></a>`isEmpty(text)`
486
626
 
@@ -491,26 +631,44 @@ isEmpty(' '); // true
491
631
  isEmpty('hello'); // false
492
632
  ```
493
633
 
494
- | Parameter | Type | Default | Description |
495
- |-----------|------|---------|-------------|
496
- | text | string | required | The input string to check for emptiness |
634
+ | Parameter | Type | Default | Description |
635
+ | --------- | ------ | -------- | --------------------------------------- |
636
+ | text | string | required | The input string to check for emptiness |
497
637
 
498
638
  #### <a id="isslug"></a>`isSlug(text)`
499
639
 
500
640
  Checks if a string is a valid slug.
501
641
 
502
642
  ```javascript
503
- isSlug("hello-world"); // true
504
- isSlug("test-product-123"); // true
505
- isSlug("Hello-World"); // false (uppercase letters)
506
- isSlug("hello--world"); // false (consecutive hyphens)
507
- isSlug("-hello-world"); // false (starts with hyphen)
508
- isSlug("hello_world"); // false (underscore not allowed)
643
+ isSlug('hello-world'); // true
644
+ isSlug('test-product-123'); // true
645
+ isSlug('Hello-World'); // false (uppercase letters)
646
+ isSlug('hello--world'); // false (consecutive hyphens)
647
+ isSlug('-hello-world'); // false (starts with hyphen)
648
+ isSlug('hello_world'); // false (underscore not allowed)
509
649
  ```
510
650
 
511
- | Parameter | Type | Default | Description |
512
- |-----------|------|---------|-------------|
513
- | text | string | required | The input string to validate as slug |
651
+ | Parameter | Type | Default | Description |
652
+ | --------- | ------ | -------- | ------------------------------------ |
653
+ | text | string | required | The input string to validate as slug |
654
+
655
+ #### <a id="istypeof"></a>`isTypeOf(input, type)`
656
+
657
+ Checks if a file or URL has a valid extension for a given type
658
+
659
+ ```javascript
660
+ isType('photo.PNG', 'image'); // true
661
+ isType('https://example.com/logo.svg', 'image'); // true
662
+ isType({ name: 'track.mp3' }, 'audio'); // true
663
+ isType('filewithoutextension', 'image'); // false
664
+ isType('document.zip', 'document'); // false
665
+ isType('video.mp4', 'document'); // false
666
+ ```
667
+
668
+ | Parameter | Type | Default | Description |
669
+ | --------- | ------ | -------- | --------------------------------------------------------------------------- |
670
+ | input | string | required | The file name, URL string, or object with .name |
671
+ | input | string | required | The file type category to validate (image, video, audio, document, archive) |
514
672
 
515
673
  #### <a id="isipv4"></a>`isIPv4(text)`
516
674
 
@@ -527,10 +685,9 @@ isIPv4('192.168.01.1'); // false (leading zeros)
527
685
  isIPv4('192.168.1.a'); // false (non-numeric)
528
686
  ```
529
687
 
530
- | Parameter | Type | Default | Description |
531
- |-----------|------|---------|-------------|
532
- | text | string | required | The input string to validate as IPv4 address |
533
-
688
+ | Parameter | Type | Default | Description |
689
+ | --------- | ------ | -------- | -------------------------------------------- |
690
+ | text | string | required | The input string to validate as IPv4 address |
534
691
 
535
692
  #### <a id="ishexcolor"></a>`isHexColor(text)`
536
693
 
@@ -539,20 +696,202 @@ Checks if a string is a valid Hex color.
539
696
  ```javascript
540
697
  import { isHexColor } from 'stringzy';
541
698
 
542
- isHexColor('#fff'); // true
543
- isHexColor('fff'); // true
544
- isHexColor('#a1b2c3'); // true
545
- isHexColor('123abc'); // true
546
- isHexColor('#1234'); // false
547
- isHexColor('blue'); // false
699
+ isHexColor('#fff'); // true
700
+ isHexColor('fff'); // true
701
+ isHexColor('#a1b2c3'); // true
702
+ isHexColor('123abc'); // true
703
+ isHexColor('#1234'); // false
704
+ isHexColor('blue'); // false
548
705
  ```
549
706
 
550
- | Parameter | Type | Default | Description |
551
- |-----------|------|---------|-------------|
552
- | text | string | required | The input string to validate as Hex color |
707
+ | Parameter | Type | Default | Description |
708
+ | --------- | ------ | -------- | ----------------------------------------- |
709
+ | text | string | required | The input string to validate as Hex color |
553
710
 
554
- ---
711
+ #### <a id="ispalindrome"></a>`isPalindrome(text)`
712
+
713
+ Checks if a string is a palindrome.
714
+ The check is case-insensitive and ignores spaces and punctuation.
715
+
716
+ ```javascript
717
+ import { isPalindrome } from 'stringzy';
718
+
719
+ isPalindrome('racecar'); // true
720
+ isPalindrome('A man, a plan, a canal: Panama'); // true
721
+ isPalindrome('No lemon, no melon'); // true
722
+ isPalindrome('hello'); // false
723
+ isPalindrome('Was it a car or a cat I saw?'); // true
724
+ ```
725
+
726
+ | Parameter | Type | Default | Description |
727
+ | --------- | ------ | -------- | ---------------------------------------- |
728
+ | text | string | required | The input string to check for palindrome |
729
+
730
+ #### <a id="iscoordinates"></a>`isCoordinates(latitude, longitude)`
731
+
732
+ Checks if given latitude and longitude are valid coordinates.
733
+
734
+ ```javascript
735
+ import { isCoordinates } from 'stringzy';
736
+
737
+ isCoordinates(48.8582, 2.2945); // true
738
+ isCoordinates(40.748817, -73.985428); // true
739
+ isCoordinates(9999, -9999); // false
740
+ ```
741
+
742
+ | Parameter | Type | Default | Description |
743
+ | --------- | ------ | -------- | --------------------- |
744
+ | latitude | number | required | Latitude to validate |
745
+ | longitude | number | required | Longitude to validate |
746
+
747
+ #### <a id="islowercase"></a>`isLowerCase(str)`
748
+
749
+ Checks whether the given string contains only lowercase alphabetic characters.
750
+ Ignores digits, special characters, white spaces.
751
+
752
+ ```javascript
753
+ import { isLowerCase } from 'stringzy';
754
+
755
+ isLowerCase('hello'); // true
756
+ isLowerCase('hello123!'); // true
757
+ isLowerCase('Hello'); // false
758
+ isLowerCase('12345'); // false
759
+ ```
760
+
761
+ | Parameter | Type | Default | Description |
762
+ | --------- | ------ | -------- | ---------------------------------------------------------------------------- |
763
+ | str | string | required | The input string to validate as containing lowercase alphabetic letters |
764
+
765
+ #### <a id="isuppercase"></a>`isUpperCase(str)`
555
766
 
767
+ Checks whether the given string contains only uppercase alphabetic characters.
768
+ Ignores digits, special characters, white spaces.
769
+
770
+ ```javascript
771
+ import { isUpperCase } from 'stringzy';
772
+
773
+ isUpperCase('HELLO'); // true
774
+ isUpperCase('HELLO123!'); // true
775
+ isUpperCase('Hello'); // false
776
+ isUpperCase('12345'); // false
777
+ ```
778
+
779
+ | Parameter | Type | Default | Description |
780
+ | --------- | ------ | -------- | ---------------------------------------------------------------------------- |
781
+ | str | string | required | The input string to validate as containing uppercase alphabetic letters |
782
+
783
+ #### <a id="isalphabetic"></a>`isAlphabetic(text)`
784
+
785
+ Checks if a string contains only alphabetic characters (a-z, A-Z).
786
+ Throws an error if the input is not a string.
787
+
788
+ ```javascript
789
+ import { isAlphabetic } from 'stringzy';
790
+
791
+ isAlphabetic('hello'); // true
792
+ isAlphabetic('World'); // true
793
+ isAlphabetic('helloWORLD'); // true
794
+ isAlphabetic('abc123'); // false
795
+ isAlphabetic('hello!'); // false
796
+ isAlphabetic(''); // false
797
+ ```
798
+
799
+ | Parameter | Type | Default | Description |
800
+ | --------- | ------ | -------- | --------------------------------------------- |
801
+ | text | string | required | The input string to check for alphabetic only |
802
+
803
+ #### <a id="isalphanumeric"></a>`isAlphaNumeric(text)`
804
+
805
+ Checks if a string contains only alphanumeric characters (letters and digits).
806
+ Throws an error if the input is not a string.
807
+
808
+ ```javascript
809
+ import { isAlphaNumeric } from 'stringzy';
810
+
811
+ isAlphaNumeric('abc123'); // true
812
+ isAlphaNumeric('A1B2C3'); // true
813
+ isAlphaNumeric('123'); // true
814
+ isAlphaNumeric('hello'); // true
815
+ isAlphaNumeric('hello!'); // false
816
+ isAlphaNumeric('123 456'); // false
817
+ isAlphaNumeric(''); // false
818
+ ```
819
+
820
+ | Parameter | Type | Default | Description |
821
+ | --------- | ------ | -------- | ----------------------------------------------- |
822
+ | text | string | required | The input string to check for alphanumeric only |
823
+
824
+ #### <a id="isanagram"></a>`isAnagram(str1, str2)`
825
+
826
+ Checks whether two strings are anagrams of each other (contain the same characters in the same frequency, regardless of order).
827
+ - Comparison is case-insensitive.
828
+ - Spaces and punctuation are ignored.
829
+ - Throws an error if either input is not a string.
830
+
831
+ ```javascript
832
+ import { isAnagram } from 'stringzy';
833
+
834
+ isAnagram('listen', 'silent'); // true
835
+ isAnagram('Debit Card', 'Bad Credit'); // true
836
+ isAnagram('Astronomer', 'Moon starer'); // true
837
+ isAnagram('hello', 'world'); // false
838
+ isAnagram('a', 'b'); // false
839
+ isAnagram('', ''); // true
840
+ ```
841
+
842
+ | Parameter | Type | Default | Description |
843
+ | --------- | ------ | -------- | ---------------------------------------- |
844
+ | str1 | string | required | The first string to check as an anagram |
845
+ | str2 | string | required | The second string to check as an anagram |
846
+
847
+ #### <a id="ismacaddress"></a>`isMacAddress(str)`
848
+
849
+ Checks whether a given string is a valid **MAC address**.
850
+ - A valid MAC address consists of six pairs of hexadecimal digits (`0–9`, `A–F`, case-insensitive).
851
+ - Returns `true` if the string is a valid MAC address, otherwise `false`.
852
+ - Throws an error if input is not a string.
853
+
854
+ ```javascript
855
+ import { isMacAddress } from 'stringzy';
856
+
857
+ isMacAddress("00:1A:2B:3C:4D:5E"); // true
858
+ isMacAddress("00-1A-2B-3C-4D-5E"); // true
859
+ isMacAddress("aa:bb:cc:dd:ee:ff"); // true
860
+ isMacAddress("FF-FF-FF-FF-FF-FF"); // true
861
+
862
+ isMacAddress("00:1G:2B:3C:4D:5E"); // false (invalid hex digit)
863
+ isMacAddress("00:1A-2B:3C-4D:5E"); // false (mixed separators)
864
+ isMacAddress("001A:2B:3C:4D:5E"); // false (wrong group length)
865
+ isMacAddress("hello-world-mac"); // false (invalid format)
866
+ isMacAddress(""); // false (empty string)
867
+ ```
868
+
869
+ | Parameter | Type | Default | Description |
870
+ | --------- | ------ | -------- | --------------------------------------- |
871
+ | str | string | required | The string to validate as a MAC address |
872
+
873
+ #### <a id="ispanagram"></a>`isPangram(str)`
874
+
875
+ - Checks if a given string is a **pangram** (i.e., contains every letter of the English alphabet at least once).
876
+ - The check is **case-insensitive**, and non-alphabetic characters (numbers, punctuation, spaces) are ignored. An empty string is not considered a pangram.
877
+ - Throws an error if the input is not a string.
878
+
879
+ ```javascript
880
+ import { isPangram } from 'stringzy';
881
+
882
+ isPangram("The quick brown fox jumps over the lazy dog."); // true
883
+ isPangram("This is not a pangram."); // false
884
+ isPangram("Abcdefghijklmnopqrstuvwxyz"); // true
885
+ isPangram("AbCdEfGhIjKlMnOpQrStUvWxYz"); // true
886
+ isPangram("A-B-C-D-E-F-G-H-I-J-K-L-M-N-O-P-Q-R-S-T-U-V-W-X-Y-Z"); // true
887
+ isPangram(""); // false
888
+ isPangram("Hello world"); // false
889
+ ```
890
+
891
+ | Parameter | Type | Default | Description |
892
+ | --------- | ------ | -------- | ----------------------------------------------------- |
893
+ | str | string | required | The input string to check for pangram characteristics |
894
+ ---
556
895
 
557
896
  ### 📊 Analysis
558
897
 
@@ -565,21 +904,25 @@ Calculates the estimated reading duration for a given text based on an average r
565
904
  ```javascript
566
905
  import { readingDuration } from 'stringzy';
567
906
 
568
- readingDuration('This is a sample text with twenty-three words to test the reading duration function.');
907
+ readingDuration(
908
+ 'This is a sample text with twenty-three words to test the reading duration function.'
909
+ );
569
910
  // Returns: 0 (23 words / 230 words per minute ≈ 0 minutes)
570
911
 
571
- readingDuration('This text contains fifty words. It is designed to test the reading duration function with a larger input.', 200);
912
+ readingDuration(
913
+ 'This text contains fifty words. It is designed to test the reading duration function with a larger input.',
914
+ 200
915
+ );
572
916
  // Returns: 1 (50 words / 200 words per minute ≈ 1 minute)
573
917
 
574
918
  readingDuration(Array(9999).fill('Word').join(' '));
575
919
  // Returns: 43 (9999 words / 230 words per minute ≈ 43 minutes)
576
920
  ```
577
921
 
578
- | Parameter | Type | Default | Description |
579
- |----------------|----------|---------|-----------------------------------------------------------------------------|
580
- | text | string | required | The input text for which the reading duration is to be calculated |
581
- | readingSpeed | number | 230 | The reading speed in words per minute. Defaults to 230 (average reading speed) |
582
-
922
+ | Parameter | Type | Default | Description |
923
+ | ------------ | ------ | -------- | ------------------------------------------------------------------------------ |
924
+ | text | string | required | The input text for which the reading duration is to be calculated |
925
+ | readingSpeed | number | 230 | The reading speed in words per minute. Defaults to 230 (average reading speed) |
583
926
 
584
927
  #### <a id="wordcount"></a>`wordCount(text)`
585
928
 
@@ -590,9 +933,9 @@ wordCount('Hello world'); // 2
590
933
  wordCount(''); // 0
591
934
  ```
592
935
 
593
- | Parameter | Type | Default | Description |
594
- |-----------|------|---------|-------------|
595
- | text | string | required | The input string to count words in |
936
+ | Parameter | Type | Default | Description |
937
+ | --------- | ------ | -------- | ---------------------------------- |
938
+ | text | string | required | The input string to count words in |
596
939
 
597
940
  #### <a id="charactercount"></a>`characterCount(text)`
598
941
 
@@ -602,9 +945,9 @@ Counts the number of characters in a string.
602
945
  characterCount('Hello'); // 5
603
946
  ```
604
947
 
605
- | Parameter | Type | Default | Description |
606
- |-----------|------|---------|-------------|
607
- | text | string | required | The input string to count characters in |
948
+ | Parameter | Type | Default | Description |
949
+ | --------- | ------ | -------- | --------------------------------------- |
950
+ | text | string | required | The input string to count characters in |
608
951
 
609
952
  #### <a id="characterfrequency"></a>`characterFrequency(text)`
610
953
 
@@ -614,14 +957,15 @@ Analyzes character frequency in a string (excluding spaces).
614
957
  characterFrequency('hello'); // { h: 1, e: 1, l: 2, o: 1 }
615
958
  ```
616
959
 
617
- | Parameter | Type | Default | Description |
618
- |-----------|------|---------|-------------|
619
- | text | string | required | The input string to analyze character frequency |
960
+ | Parameter | Type | Default | Description |
961
+ | --------- | ------ | -------- | ----------------------------------------------- |
962
+ | text | string | required | The input string to analyze character frequency |
620
963
 
621
964
  #### <a id="stringsimilarity"></a>`stringSimilarity(textA, textB, algorithm = 'Levenshtein')`
622
965
 
623
966
  Calculates the percentage similarity between two texts using the selected algorithm.
624
967
  Method returns a percentage (0–100) value indicating how similar the two strings are.
968
+
625
969
  ```javascript
626
970
  stringSimilarity('kitten', 'sitting'); // Returns: 57.14
627
971
 
@@ -630,11 +974,219 @@ stringSimilarity('hello', 'hello'); // Returns: 100
630
974
  stringSimilarity('flaw', 'lawn', 'Damerau-Levenshtein'); // Returns: 50
631
975
  ```
632
976
 
633
- | Parameter | Type | Default | Description |
634
- |------------|--------|----------------------|-----------------------------------------------------------------------------|
635
- | textA | string | required | The first text to compare. |
636
- | textB | string | required | The second text to compare. |
637
- | algorithm | string | 'Levenshtein' | The algorithm to use: 'Levenshtein' or 'Damerau-Levenshtein'. |
977
+ | Parameter | Type | Default | Description |
978
+ | --------- | ------ | ------------- | ------------------------------------------------------------- |
979
+ | textA | string | required | The first text to compare. |
980
+ | textB | string | required | The second text to compare. |
981
+ | algorithm | string | 'Levenshtein' | The algorithm to use: 'Levenshtein' or 'Damerau-Levenshtein'. |
982
+
983
+ #### <a id="complexity"></a>`complexity(text)`
984
+
985
+ Analyzes the complexity of a string, returning an object with detailed metrics.
986
+
987
+ ```javascript
988
+ import { complexity } from 'stringzy';
989
+
990
+ complexity('abc');
991
+ // Returns: { score: [number], uniqueness: [number], length: 3 }
992
+
993
+ complexity('aA1!aA1!');
994
+ // Returns: { score: [number], uniqueness: [number], length: 8 }
995
+
996
+ complexity('');
997
+ // Returns: { score: 0, uniqueness: 0, length: 0 }
998
+ ```
999
+
1000
+ | Parameter | Type | Default | Description |
1001
+ | --------- | ------ | -------- | -------------------------------------- |
1002
+ | text | string | required | The input string to analyze complexity |
1003
+
1004
+ **Returns:** An object containing:
1005
+
1006
+ - `score` (number): Overall complexity score
1007
+ - `uniqueness` (number): Measure of character uniqueness
1008
+ - `length` (number): Length of the input string
1009
+
1010
+ feature/content-words
1011
+
1012
+ #### <a id="contentwordcount"></a>`contentWordCount(text)`
1013
+
1014
+ Counts the number of content words (nouns, verbs, adjectives, adverbs, etc.) in a string.
1015
+
1016
+ ```javascript
1017
+
1018
+ import { contentWordCount } from 'stringzy';
1019
+
1020
+ contentWordCount("Learning JavaScript improves coding skills!");
1021
+ // Returns: { count: 5 }
1022
+
1023
+ contentWordCount("The cat sleeps on the warm windowsill.");
1024
+ // Returns: { count: 5 }
1025
+
1026
+ contentWordCount("Wow! Such a beautiful day.");
1027
+ // Returns: { count: 4 }
1028
+ ```
1029
+
1030
+ | Parameter | Type | Default | Description |
1031
+ | --------- | ------ | -------- | -------------------------------------- |
1032
+ | text | string | required | The input string to analyze content words |
1033
+
1034
+ **Returns:** An object containing:
1035
+
1036
+ - `count` (number): Total number of content words in the string
1037
+
1038
+
1039
+ #### <a id="functionwordcount"></a>`functionWordCount(text)`
1040
+
1041
+ Counts the number of function words (prepositions, pronouns, conjunctions, articles, etc.) in a string.
1042
+
1043
+ ```javascript
1044
+
1045
+ import { functionWordCount } from 'stringzy';
1046
+
1047
+ functionWordCount("She and I are going to the park.");
1048
+ // Returns: { count: 7 }
1049
+
1050
+ functionWordCount("It is an example of proper grammar usage.");
1051
+ // Returns: { count: 8 }
1052
+
1053
+ functionWordCount("Can you see the stars tonight?");
1054
+ // Returns: { count: 5 }
1055
+ ```
1056
+
1057
+ | Parameter | Type | Default | Description |
1058
+ | --------- | ------ | -------- | -------------------------------------- |
1059
+ | text | string | required | The input string to analyze function words |
1060
+
1061
+ **Returns:** An object containing:
1062
+
1063
+ - `count` (number): Total number of function words in the string
1064
+
1065
+ #### <a id="patterncount"></a>`patternCount(text, pattern)`
1066
+
1067
+ Counts the number of times a substring (pattern) occurs in a string, including overlapping occurrences.
1068
+ This function uses the **Knuth–Morris–Pratt (KMP)** algorithm for efficient matching.
1069
+
1070
+ ```javascript
1071
+ patternCount('aaaa', 'aa'); // 3
1072
+ patternCount('abababa', 'aba'); // 3
1073
+ patternCount('hello world', 'o'); // 2
1074
+ patternCount('hello world', 'x'); // 0
1075
+ ```
1076
+
1077
+ | Parameter | Type | Default | Description |
1078
+ | --------- | ------ | -------- | ---------------------------------------------- |
1079
+ | text | string | required | The input string to search in |
1080
+ | pattern | string | required | The substring (pattern) to count (overlapping) |
1081
+
1082
+ #### <a id="vowelconsonantcount"></a>`vowelConsonantCount(str)`
1083
+
1084
+ Counts the number of vowels and consonants in a given string.
1085
+ This function is case-insensitive and ignores non-alphabetic characters.
1086
+
1087
+ ```javascript
1088
+ vowelConsonantCount('hello');
1089
+ // { vowels: 2, consonants: 3 }
1090
+
1091
+ vowelConsonantCount('stringzy');
1092
+ // { vowels: 1, consonants: 7 }
1093
+
1094
+ vowelConsonantCount('');
1095
+ // { vowels: 0, consonants: 0 }
1096
+ ```
1097
+
1098
+ | Parameter | Type | Default | Description |
1099
+ | --------- | ------ | -------- | -------------------------------------------------- |
1100
+ | str | string | required | The input string to count vowels and consonants in |
1101
+
1102
+ feature/content-words
1103
+
1104
+ #### <a id="checkmultiplepatterns"></a>`checkMultiplePatterns(text, patterns)`
1105
+
1106
+ Finds occurrences of multiple patterns within a given text using the Rabin–Karp algorithm. <br>
1107
+ Accepts an array of patterns.<br>
1108
+ Returns all matches of each pattern along with starting indices.<br>
1109
+ Handles hash collisions by verifying actual substrings.<br>
1110
+ Pattern matching is case sensitive.
1111
+
1112
+ ```javascript
1113
+ checkMultiplePatterns('abracadabra', ['abra', 'cad']);
1114
+ // { abra: [0, 7], cad: [4] }
1115
+
1116
+ checkMultiplePatterns('aaaa', ['aa', 'aaa']);
1117
+ // { aa: [0, 1, 2], aaa: [0, 1] }
1118
+
1119
+ checkMultiplePatterns('hello world', ['xyz', '123']);
1120
+ // { xyz: [], 123: [] }
1121
+ ```
1122
+ | Parameter | Type | Default | Description |
1123
+ | --------- | --------- | -------- | ----------------------------------------------------------- |
1124
+ | text | string | required | The text to search within. |
1125
+ | patterns | string\[ ] | required | An array of patterns to search for (each must be a string). |
1126
+
1127
+ #### <a id="checksubsequence"></a>`checkSubsequence(str, sub)`
1128
+
1129
+ Checks whether a given string sub is a subsequence of another string str.
1130
+ A subsequence maintains the relative order of characters, but they do not need to be consecutive.
1131
+ Case-sensitive comparison is performed.
1132
+ Spaces and all characters are treated literally.
1133
+
1134
+ ```javascript
1135
+ isSubsequence('abcde', 'ace');
1136
+ // true → 'a', 'c', 'e' appear in order
1137
+
1138
+ isSubsequence('abracadabra', 'aaa');
1139
+ // true → multiple 'a's in correct order
1140
+
1141
+ isSubsequence('abcde', 'aec');
1142
+ // false → order is broken (e comes before c)
1143
+
1144
+ isSubsequence('anything', '');
1145
+ // true → empty subsequence is always valid
1146
+
1147
+ isSubsequence('AbC', 'AC');
1148
+ // true → exact case matches
1149
+
1150
+ isSubsequence('a b c', 'abc');
1151
+ // false → spaces count as characters
1152
+ ```
1153
+ | Parameter | Type | Default | Description |
1154
+ | --------- | ------ | -------- | ----------------------------------------------- |
1155
+ | str | string | required | The main string to check within. |
1156
+ | sub | string | required | The subsequence string to verify against `str`. |
1157
+
1158
+ #### <a id="stringrotation"></a>`checkStringRotations(str1, str2)`
1159
+ Checks whether a given string `str2` is a rotation of another string `str1`.
1160
+ Case-sensitive comparison is performed. Both strings must be of equal length to be considered rotations.
1161
+ Spaces and all characters are treated literally.
1162
+
1163
+ ```javascript
1164
+ isRotation('waterbottle', 'erbottlewat');
1165
+ // true → rotation at position 3
1166
+
1167
+ isRotation('abcde', 'cdeab');
1168
+ // true → rotation at position 2
1169
+
1170
+ isRotation('abc', 'abc');
1171
+ // true → no rotation, identical strings
1172
+
1173
+ isRotation('abc', 'cab');
1174
+ // true → rotation at position 2
1175
+
1176
+ isRotation('abc', 'bac');
1177
+ // false → not a valid rotation
1178
+
1179
+ isRotation('ArB', 'Bar');
1180
+ // false → case-sensitive mismatch
1181
+
1182
+ isRotation('abcd', 'abc');
1183
+ // false → lengths differ
1184
+ ```
1185
+
1186
+ | Parameter | Type | Default | Description |
1187
+ | --------- | ------ | -------- | --------------------------------------------------- |
1188
+ | str1 | string | required | The original string. |
1189
+ | str2 | string | required | The string to verify if it is a rotation of `str1`. |
638
1190
 
639
1191
  ---
640
1192
 
@@ -651,9 +1203,9 @@ capitalize('hello world'); // 'Hello World'
651
1203
  capitalize('javaScript programming'); // 'Javascript Programming'
652
1204
  ```
653
1205
 
654
- | Parameter | Type | Default | Description |
655
- |-----------|------|---------|-------------|
656
- | text | string | required | The input string to capitalize |
1206
+ | Parameter | Type | Default | Description |
1207
+ | --------- | ------ | -------- | ------------------------------ |
1208
+ | text | string | required | The input string to capitalize |
657
1209
 
658
1210
  #### <a id="formatnumber"></a>`formatNumber(number, separator = ',')`
659
1211
 
@@ -664,10 +1216,10 @@ formatNumber('1234567'); // '1,234,567'
664
1216
  formatNumber('1234567', '.'); // '1.234.567'
665
1217
  ```
666
1218
 
667
- | Parameter | Type | Default | Description |
668
- |-----------|------|---------|-------------|
669
- | number | string\|number | required | The number to format |
670
- | separator | string | ',' | The separator to use for thousands |
1219
+ | Parameter | Type | Default | Description |
1220
+ | --------- | -------------- | -------- | ---------------------------------- |
1221
+ | number | string\|number | required | The number to format |
1222
+ | separator | string | ',' | The separator to use for thousands |
671
1223
 
672
1224
  #### <a id="formatphone"></a>`formatPhone(phone, format = 'us')`
673
1225
 
@@ -678,14 +1230,15 @@ formatPhone('1234567890'); // '(123) 456-7890'
678
1230
  formatPhone('11234567890', 'international'); // '+1 (123) 456-7890'
679
1231
  ```
680
1232
 
681
- | Parameter | Type | Default | Description |
682
- |-----------|------|---------|-------------|
683
- | phone | string | required | The phone number string to format |
684
- | format | string | 'us' | Format type: 'us' or 'international' |
1233
+ | Parameter | Type | Default | Description |
1234
+ | --------- | ------ | -------- | ------------------------------------ |
1235
+ | phone | string | required | The phone number string to format |
1236
+ | format | string | 'us' | Format type: 'us' or 'international' |
685
1237
 
686
1238
  ## 🔧 Usage Patterns
687
1239
 
688
1240
  ### Individual Function Imports
1241
+
689
1242
  ```javascript
690
1243
  import { isEmail, wordCount, capitalize } from 'stringzy';
691
1244
 
@@ -696,6 +1249,7 @@ if (isEmail(email)) {
696
1249
  ```
697
1250
 
698
1251
  ### Namespace Imports
1252
+
699
1253
  ```javascript
700
1254
  import { validate, analyze, format } from 'stringzy';
701
1255
 
@@ -706,6 +1260,7 @@ const formatted = format.capitalize('hello world');
706
1260
  ```
707
1261
 
708
1262
  ### Default Import (All Functions)
1263
+
709
1264
  ```javascript
710
1265
  import stringzy from 'stringzy';
711
1266
 
@@ -746,19 +1301,19 @@ import { validate } from 'stringzy';
746
1301
 
747
1302
  function validateForm(formData) {
748
1303
  const errors = {};
749
-
1304
+
750
1305
  if (!validate.isEmail(formData.email)) {
751
1306
  errors.email = 'Please enter a valid email address';
752
1307
  }
753
-
1308
+
754
1309
  if (!validate.isURL(formData.website)) {
755
1310
  errors.website = 'Please enter a valid URL';
756
1311
  }
757
-
1312
+
758
1313
  if (validate.isEmpty(formData.name)) {
759
1314
  errors.name = 'Name is required';
760
1315
  }
761
-
1316
+
762
1317
  return errors;
763
1318
  }
764
1319
  ```
@@ -773,7 +1328,7 @@ function getContentStats(text) {
773
1328
  words: analyze.wordCount(text),
774
1329
  characters: analyze.characterCount(text),
775
1330
  frequency: analyze.characterFrequency(text),
776
- readingTime: Math.ceil(analyze.wordCount(text) / 200)
1331
+ readingTime: Math.ceil(analyze.wordCount(text) / 200),
777
1332
  };
778
1333
  }
779
1334
  ```
@@ -787,7 +1342,7 @@ function formatUserData(userData) {
787
1342
  return {
788
1343
  name: format.capitalize(userData.name),
789
1344
  phone: format.formatPhone(userData.phone),
790
- revenue: format.formatNumber(userData.revenue)
1345
+ revenue: format.formatNumber(userData.revenue),
791
1346
  };
792
1347
  }
793
1348
  ```
@@ -810,7 +1365,7 @@ const formatted: string = format.capitalize('hello world');
810
1365
  stringzy is organized into four specialized modules:
811
1366
 
812
1367
  - **`transformations.js`** - Core string transformations
813
- - **`validations.js`** - String validation utilities
1368
+ - **`validations.js`** - String validation utilities
814
1369
  - **`analysis.js`** - String analysis and metrics
815
1370
  - **`formatting.js`** - String formatting functions
816
1371
 
@@ -820,7 +1375,6 @@ Each module can be imported individually or accessed through the main entry poin
820
1375
 
821
1376
  Contributions are welcome! Please read our [contribution guidelines](CONTRIBUTING.md) before submitting a pull request.
822
1377
 
823
-
824
1378
  ## <a id="contri"></a>`Contributors`
825
1379
 
826
1380
  <table>
@@ -928,6 +1482,100 @@ Contributions are welcome! Please read our [contribution guidelines](CONTRIBUTIN
928
1482
  </sub>
929
1483
  </a>
930
1484
  </td>
1485
+ <td align="center">
1486
+ <a href="https://github.com/Thenlie">
1487
+ <img src="https://avatars.githubusercontent.com/Thenlie" width="100px;"
1488
+ alt="Thenlie" />
1489
+ <br />
1490
+ <sub>
1491
+ <b>Leithen</b>
1492
+ </sub>
1493
+ </a>
1494
+ </td>
1495
+ <td align="center">
1496
+ <a href="https://github.com/rickyryden">
1497
+ <img src="https://avatars.githubusercontent.com/rickyryden" width="100px;"
1498
+ alt="Ricky Ryden" />
1499
+ <br />
1500
+ <sub>
1501
+ <b>Ricky Ryden</b>
1502
+ </sub>
1503
+ </a>
1504
+ </td>
1505
+ </tr>
1506
+ <tr>
1507
+ <td align="center">
1508
+ <a href="https://github.com/adityaatre26">
1509
+ <img src="https://avatars.githubusercontent.com/adityaatre26" width="100px;"
1510
+ alt="Aditya Atre" />
1511
+ <br />
1512
+ <sub>
1513
+ <b>Aditya Atre</b>
1514
+ </sub>
1515
+ </a>
1516
+ </td>
1517
+ <td align="center">
1518
+ <a href="https://github.com/kittenwarrior-qb">
1519
+ <img src="https://avatars.githubusercontent.com/kittenwarrior-qb" width="100px;"
1520
+ alt="quocbui05" />
1521
+ <br />
1522
+ <sub>
1523
+ <b>quocbui05</b>
1524
+ </sub>
1525
+ </a>
1526
+ </td>
1527
+ <td align="center">
1528
+ <a href="https://github.com/MariamEwas">
1529
+ <img src="https://avatars.githubusercontent.com/MariamEwas" width="100px;"
1530
+ alt="Mariam Hasan" />
1531
+ <br />
1532
+ <sub>
1533
+ <b>Mariam Hasan</b>
1534
+ </sub>
1535
+ </a>
1536
+ </td>
1537
+ <td align="center">
1538
+ <a href="https://github.com/milendrakumarbaghel">
1539
+ <img src="https://avatars.githubusercontent.com/milendrakumarbaghel" width="100px;"
1540
+ alt="Milendra Kumar Baghel" />
1541
+ <br />
1542
+ <sub>
1543
+ <b>Milendra Kumar Baghel</b>
1544
+ </sub>
1545
+ </a>
1546
+ </td>
1547
+ <td align="center">
1548
+ <a href="https://github.com/Farkhanda-Dalal">
1549
+ <img src="https://avatars.githubusercontent.com/Farkhanda-Dalal" width="100px;"
1550
+ alt="Farkhanda Dalal" />
1551
+ <br />
1552
+ <sub>
1553
+ <b>Farkhanda Dalal</b>
1554
+ </sub>
1555
+ </a>
1556
+ </td>
1557
+ <td align="center">
1558
+ <a href="https://github.com/S">
1559
+ <img src="https://avatars.githubusercontent.com/satyasrisundarapalli" width="100px;"
1560
+ alt="Sundarapalli Lakshmi Satya Sri" />
1561
+ <br />
1562
+ <sub>
1563
+ <b>Sundarapalli Lakshmi Satya Sri</b>
1564
+ </sub>
1565
+ </a>
1566
+ </td>
1567
+ </tr>
1568
+ <tr>
1569
+ <td align="center">
1570
+ <a href="https://github.com/S">
1571
+ <img src="https://avatars.githubusercontent.com/itspavant" width="100px;"
1572
+ alt="T Pavan Teja" />
1573
+ <br />
1574
+ <sub>
1575
+ <b>T Pavan Teja</b>
1576
+ </sub>
1577
+ </a>
1578
+ </td>
931
1579
  </tr>
932
1580
  </tbody>
933
1581
  </table>