stringzy 2.2.1 → 4.0.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 (190) hide show
  1. package/.github/workflows/publish.yml +29 -0
  2. package/.github/workflows/test-on-pr.yml +23 -0
  3. package/.prettierignore +4 -0
  4. package/.prettierrc +7 -0
  5. package/CONTRIBUTING.md +99 -0
  6. package/LICENSE +21 -21
  7. package/README.md +1189 -723
  8. package/changelog.txt +110 -110
  9. package/dist/analyzing/characterCount.d.ts +20 -0
  10. package/dist/analyzing/characterCount.js +28 -0
  11. package/dist/analyzing/characterFrequency.d.ts +20 -0
  12. package/dist/analyzing/characterFrequency.js +35 -0
  13. package/dist/analyzing/complexity.d.ts +39 -0
  14. package/dist/analyzing/complexity.js +63 -0
  15. package/dist/analyzing/index.d.ts +26 -0
  16. package/dist/analyzing/index.js +37 -0
  17. package/dist/analyzing/patternCount.d.ts +10 -0
  18. package/dist/analyzing/patternCount.js +52 -0
  19. package/dist/analyzing/readingDuration.d.ts +10 -0
  20. package/dist/analyzing/readingDuration.js +17 -0
  21. package/dist/analyzing/stringSimilarity.d.ts +8 -0
  22. package/dist/analyzing/stringSimilarity.js +145 -0
  23. package/dist/analyzing/vowelConsonantCount.d.ts +22 -0
  24. package/dist/analyzing/vowelConsonantCount.js +38 -0
  25. package/dist/analyzing/wordCount.d.ts +23 -0
  26. package/dist/analyzing/wordCount.js +33 -0
  27. package/dist/formatting/capitalize.d.ts +22 -0
  28. package/dist/formatting/capitalize.js +33 -0
  29. package/dist/formatting/index.d.ts +11 -0
  30. package/dist/formatting/index.js +17 -0
  31. package/dist/formatting/number.d.ts +24 -0
  32. package/dist/formatting/number.js +30 -0
  33. package/dist/formatting/phone.d.ts +25 -0
  34. package/dist/formatting/phone.js +48 -0
  35. package/dist/index.d.ts +52 -0
  36. package/dist/index.js +30 -0
  37. package/dist/tests/analyzing/characterCount.test.d.ts +1 -0
  38. package/dist/tests/analyzing/characterCount.test.js +19 -0
  39. package/dist/tests/analyzing/characterFrequency.test.d.ts +1 -0
  40. package/dist/tests/analyzing/characterFrequency.test.js +22 -0
  41. package/dist/tests/analyzing/complexity.test.d.ts +1 -0
  42. package/dist/tests/analyzing/complexity.test.js +28 -0
  43. package/dist/tests/analyzing/patternCount.test.d.ts +1 -0
  44. package/dist/tests/analyzing/patternCount.test.js +34 -0
  45. package/dist/tests/analyzing/readingDuration.test.d.ts +1 -0
  46. package/dist/tests/analyzing/readingDuration.test.js +45 -0
  47. package/dist/tests/analyzing/stringSimilarity.test.d.ts +1 -0
  48. package/dist/tests/analyzing/stringSimilarity.test.js +61 -0
  49. package/dist/tests/analyzing/vowelConsonantCount.test.d.ts +1 -0
  50. package/dist/tests/analyzing/vowelConsonantCount.test.js +25 -0
  51. package/dist/tests/analyzing/wordCount.test.d.ts +1 -0
  52. package/dist/tests/analyzing/wordCount.test.js +22 -0
  53. package/dist/tests/formatting/capitalize.test.d.ts +1 -0
  54. package/dist/tests/formatting/capitalize.test.js +22 -0
  55. package/dist/tests/formatting/number.test.d.ts +1 -0
  56. package/dist/tests/formatting/number.test.js +19 -0
  57. package/dist/tests/formatting/phone.test.d.ts +1 -0
  58. package/dist/tests/formatting/phone.test.js +25 -0
  59. package/dist/tests/transformations/camelCase.test.d.ts +1 -0
  60. package/dist/tests/transformations/camelCase.test.js +19 -0
  61. package/dist/tests/transformations/capitalizeWords.test.d.ts +1 -0
  62. package/dist/tests/transformations/capitalizeWords.test.js +19 -0
  63. package/dist/tests/transformations/constantCase.test.d.ts +1 -0
  64. package/dist/tests/transformations/constantCase.test.js +19 -0
  65. package/dist/tests/transformations/deburr.test.d.ts +1 -0
  66. package/dist/tests/transformations/deburr.test.js +27 -0
  67. package/dist/tests/transformations/escapeHTML.test.d.ts +1 -0
  68. package/dist/tests/transformations/escapeHTML.test.js +46 -0
  69. package/dist/tests/transformations/initials.test.d.ts +1 -0
  70. package/dist/tests/transformations/initials.test.js +25 -0
  71. package/dist/tests/transformations/kebabCase.test.d.ts +1 -0
  72. package/dist/tests/transformations/kebabCase.test.js +19 -0
  73. package/dist/tests/transformations/maskSegment.test.d.ts +1 -0
  74. package/dist/tests/transformations/maskSegment.test.js +30 -0
  75. package/dist/tests/transformations/numberToText.test.d.ts +1 -0
  76. package/dist/tests/transformations/numberToText.test.js +60 -0
  77. package/dist/tests/transformations/pascalCase.test.d.ts +1 -0
  78. package/dist/tests/transformations/pascalCase.test.js +19 -0
  79. package/dist/tests/transformations/removeDuplicates.test.d.ts +1 -0
  80. package/dist/tests/transformations/removeDuplicates.test.js +19 -0
  81. package/dist/tests/transformations/removeSpecialChars.test.d.ts +1 -0
  82. package/dist/tests/transformations/removeSpecialChars.test.js +22 -0
  83. package/dist/tests/transformations/removeWords.test.d.ts +1 -0
  84. package/dist/tests/transformations/removeWords.test.js +25 -0
  85. package/dist/tests/transformations/snakeCase.test.d.ts +1 -0
  86. package/dist/tests/transformations/snakeCase.test.js +19 -0
  87. package/dist/tests/transformations/splitChunks.test.d.ts +1 -0
  88. package/dist/tests/transformations/splitChunks.test.js +31 -0
  89. package/dist/tests/transformations/titleCase.test.d.ts +1 -0
  90. package/dist/tests/transformations/titleCase.test.js +19 -0
  91. package/dist/tests/transformations/toSlug.test.d.ts +1 -0
  92. package/dist/tests/transformations/toSlug.test.js +22 -0
  93. package/dist/tests/transformations/truncateText.test.d.ts +1 -0
  94. package/dist/tests/transformations/truncateText.test.js +31 -0
  95. package/dist/tests/validations/isCoordinates.test.d.ts +1 -0
  96. package/dist/tests/validations/isCoordinates.test.js +18 -0
  97. package/dist/tests/validations/isDate.test.d.ts +1 -0
  98. package/dist/tests/validations/isDate.test.js +55 -0
  99. package/dist/tests/validations/isEmail.smtpUTF8.test.d.ts +1 -0
  100. package/dist/tests/validations/isEmail.smtpUTF8.test.js +16 -0
  101. package/dist/tests/validations/isEmail.test.d.ts +1 -0
  102. package/dist/tests/validations/isEmail.test.js +67 -0
  103. package/dist/tests/validations/isEmpty.test.d.ts +1 -0
  104. package/dist/tests/validations/isEmpty.test.js +19 -0
  105. package/dist/tests/validations/isHexColor.test.d.ts +1 -0
  106. package/dist/tests/validations/isHexColor.test.js +32 -0
  107. package/dist/tests/validations/isIPv4.test.d.ts +1 -0
  108. package/dist/tests/validations/isIPv4.test.js +59 -0
  109. package/dist/tests/validations/isPalindrome.test.d.ts +1 -0
  110. package/dist/tests/validations/isPalindrome.test.js +39 -0
  111. package/dist/tests/validations/isSlug.test.d.ts +1 -0
  112. package/dist/tests/validations/isSlug.test.js +22 -0
  113. package/dist/tests/validations/isTypeOf.test.d.ts +1 -0
  114. package/dist/tests/validations/isTypeOf.test.js +28 -0
  115. package/dist/tests/validations/isURL.test.d.ts +1 -0
  116. package/dist/tests/validations/isURL.test.js +18 -0
  117. package/dist/transformations/camelCase.d.ts +25 -0
  118. package/dist/transformations/camelCase.js +39 -0
  119. package/dist/transformations/capitalizeWords.d.ts +22 -0
  120. package/dist/transformations/capitalizeWords.js +30 -0
  121. package/dist/transformations/constantCase.d.ts +27 -0
  122. package/dist/transformations/constantCase.js +41 -0
  123. package/dist/transformations/deburr.d.ts +7 -0
  124. package/dist/transformations/deburr.js +16 -0
  125. package/dist/transformations/escapeHTML.d.ts +24 -0
  126. package/dist/transformations/escapeHTML.js +36 -0
  127. package/dist/transformations/index.d.ts +52 -0
  128. package/dist/transformations/index.js +71 -0
  129. package/dist/transformations/initials.d.ts +28 -0
  130. package/dist/transformations/initials.js +49 -0
  131. package/dist/transformations/kebabCase.d.ts +27 -0
  132. package/dist/transformations/kebabCase.js +41 -0
  133. package/dist/transformations/maskSegment.d.ts +9 -0
  134. package/dist/transformations/maskSegment.js +23 -0
  135. package/dist/transformations/numberToText/helpers.d.ts +10 -0
  136. package/dist/transformations/numberToText/helpers.js +31 -0
  137. package/dist/transformations/numberToText/implementation_EN.d.ts +10 -0
  138. package/dist/transformations/numberToText/implementation_EN.js +45 -0
  139. package/dist/transformations/numberToText/implementation_PL.d.ts +10 -0
  140. package/dist/transformations/numberToText/implementation_PL.js +79 -0
  141. package/dist/transformations/numberToText/main.d.ts +19 -0
  142. package/dist/transformations/numberToText/main.js +67 -0
  143. package/dist/transformations/numberToText/types.d.ts +3 -0
  144. package/dist/transformations/numberToText/types.js +82 -0
  145. package/dist/transformations/pascalCase.d.ts +26 -0
  146. package/dist/transformations/pascalCase.js +40 -0
  147. package/dist/transformations/removeDuplicates.d.ts +22 -0
  148. package/dist/transformations/removeDuplicates.js +34 -0
  149. package/dist/transformations/removeSpecialChars.d.ts +23 -0
  150. package/dist/transformations/removeSpecialChars.js +34 -0
  151. package/dist/transformations/removeWords.d.ts +28 -0
  152. package/dist/transformations/removeWords.js +50 -0
  153. package/dist/transformations/snakeCase.d.ts +27 -0
  154. package/dist/transformations/snakeCase.js +41 -0
  155. package/dist/transformations/splitChunks.d.ts +8 -0
  156. package/dist/transformations/splitChunks.js +24 -0
  157. package/dist/transformations/titleCase.d.ts +26 -0
  158. package/dist/transformations/titleCase.js +39 -0
  159. package/dist/transformations/toSlug.d.ts +25 -0
  160. package/dist/transformations/toSlug.js +37 -0
  161. package/dist/transformations/truncateText.d.ts +26 -0
  162. package/dist/transformations/truncateText.js +44 -0
  163. package/dist/validations/index.d.ts +29 -0
  164. package/dist/validations/index.js +41 -0
  165. package/dist/validations/isCoordinates.d.ts +8 -0
  166. package/dist/validations/isCoordinates.js +19 -0
  167. package/dist/validations/isDate.d.ts +18 -0
  168. package/dist/validations/isDate.js +61 -0
  169. package/dist/validations/isEmail.d.ts +13 -0
  170. package/dist/validations/isEmail.js +180 -0
  171. package/dist/validations/isEmpty.d.ts +10 -0
  172. package/dist/validations/isEmpty.js +15 -0
  173. package/dist/validations/isHexColor.d.ts +7 -0
  174. package/dist/validations/isHexColor.js +15 -0
  175. package/dist/validations/isIPv4.d.ts +22 -0
  176. package/dist/validations/isIPv4.js +33 -0
  177. package/dist/validations/isPalindrome.d.ts +10 -0
  178. package/dist/validations/isPalindrome.js +21 -0
  179. package/dist/validations/isSlug.d.ts +28 -0
  180. package/dist/validations/isSlug.js +37 -0
  181. package/dist/validations/isTypeOf.d.ts +9 -0
  182. package/dist/validations/isTypeOf.js +30 -0
  183. package/dist/validations/isURL.d.ts +22 -0
  184. package/dist/validations/isURL.js +33 -0
  185. package/package.json +12 -4
  186. package/analysis.js +0 -21
  187. package/formatting.js +0 -37
  188. package/index.js +0 -75
  189. package/transformations.js +0 -190
  190. package/validations.js +0 -80
@@ -0,0 +1,29 @@
1
+ name: Publish to npm
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - 'v*.*.*'
7
+
8
+ jobs:
9
+ publish:
10
+ runs-on: ubuntu-latest
11
+ steps:
12
+ - name: Checkout code
13
+ uses: actions/checkout@v4
14
+ - name: Set up Node.js
15
+ uses: actions/setup-node@v4
16
+ with:
17
+ node-version: '20'
18
+ registry-url: 'https://registry.npmjs.org/'
19
+ - name: Install dependencies
20
+ run: npm ci
21
+ - name: Build
22
+ run: npm run build
23
+ - name: Run tests
24
+ run: npm test
25
+ - name: Publish package
26
+ if: success()
27
+ run: npm publish
28
+ env:
29
+ NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
@@ -0,0 +1,23 @@
1
+ name: Run Tests on Pull Request
2
+
3
+ on:
4
+ pull_request:
5
+ branches:
6
+ - '**'
7
+
8
+ jobs:
9
+ test:
10
+ runs-on: ubuntu-latest
11
+ steps:
12
+ - name: Checkout code
13
+ uses: actions/checkout@v4
14
+ - name: Set up Node.js
15
+ uses: actions/setup-node@v4
16
+ with:
17
+ node-version: '20'
18
+ - name: Install dependencies
19
+ run: npm ci
20
+ - name: Build
21
+ run: npm run build
22
+ - name: Run tests
23
+ run: npm test
@@ -0,0 +1,4 @@
1
+ node_modules
2
+ dist
3
+ assets
4
+ .github
package/.prettierrc ADDED
@@ -0,0 +1,7 @@
1
+ {
2
+ "semi": true,
3
+ "singleQuote": true,
4
+ "trailingComma": "es5",
5
+ "printWidth": 100,
6
+ "tabWidth": 2
7
+ }
@@ -0,0 +1,99 @@
1
+ # Contributing to Stringzy
2
+
3
+ Thanks for your interest in contributing to Stringzy! This document provides guidelines and instructions for contributing to the project.
4
+
5
+ ## What We're Looking For
6
+
7
+ - **Bug fixes** - Help us solve issues
8
+ - **New string functions** - Add useful string manipulation methods
9
+ - **Documentation** - Improve examples and guides
10
+ - **Tests** - Add test coverage for existing or new features
11
+
12
+ ## Development Guide
13
+
14
+ ### Setup
15
+
16
+ 1. Fork the repository
17
+ 2. Clone your fork:
18
+ _Remember to replace `YOUR-USERNAME` with your actual GitHub username._
19
+
20
+ ```bash
21
+ git clone https://github.com/YOUR-USERNAME/stringzy.git
22
+ ```
23
+
24
+ 3. Navigate to the project directory:
25
+
26
+ ```bash
27
+ cd stringzy
28
+ ```
29
+
30
+ 4. Install dependencies:
31
+ ```bash
32
+ npm install
33
+ ```
34
+
35
+ ### Making Changes
36
+
37
+ - Create a new branch:
38
+ ```bash
39
+ git checkout -b feature/amazing-feature
40
+ ```
41
+ - Make your changes
42
+ - Write tests for new functions
43
+ - Keep functions simple and focused
44
+ - Follow existing code style
45
+ - Update README if adding new functions
46
+
47
+ ### Code Style
48
+
49
+ - Use 2 spaces for indentation
50
+ - Add JSDoc comments for new functions
51
+ - Handle edge cases (null, undefined, empty strings)
52
+ - Use descriptive function names
53
+
54
+ Example:
55
+
56
+ ```ts
57
+ /**
58
+ * Converts string to kebab-case
59
+ * @param str Input string
60
+ * @returns Kebab-case string
61
+ */
62
+ function toKebabCase(str: string): string {
63
+ if (!str) return '';
64
+ return str.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();
65
+ }
66
+ ```
67
+
68
+ ## Submitting Changes
69
+
70
+ 1. Make sure tests pass:
71
+
72
+ ```bash
73
+ npm test
74
+ ```
75
+
76
+ 2. Commit your changes:
77
+
78
+ ```bash
79
+ git commit -m "feat: add some amazing feature"
80
+ ```
81
+
82
+ 3. Push to the branch
83
+
84
+ ```bash
85
+ git push origin feature/amazing-feature
86
+ ```
87
+
88
+ 4. Create a pull request with:
89
+ - Clear description of changes
90
+ - Why the change is needed
91
+ - Any breaking changes
92
+
93
+ ## Questions?
94
+
95
+ If you have any questions or need help, feel free to open an issue. We're happy to help!
96
+
97
+ ---
98
+
99
+ By contributing, you agree to license your work under the same license as this project.
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2025 Samarth Ruia
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Samarth Ruia
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.