stringzy 2.2.1 → 3.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 (150) hide show
  1. package/.github/workflows/publish.yml +29 -0
  2. package/.github/workflows/test-on-pr.yml +23 -0
  3. package/CONTRIBUTING.md +87 -0
  4. package/LICENSE +21 -21
  5. package/README.md +952 -723
  6. package/changelog.txt +110 -110
  7. package/dist/analyzing/characterCount.d.ts +1 -0
  8. package/dist/analyzing/characterCount.js +9 -0
  9. package/dist/analyzing/characterFrequency.d.ts +1 -0
  10. package/dist/analyzing/characterFrequency.js +16 -0
  11. package/dist/analyzing/complexity.d.ts +6 -0
  12. package/dist/analyzing/complexity.js +30 -0
  13. package/dist/analyzing/index.d.ts +20 -0
  14. package/dist/analyzing/index.js +29 -0
  15. package/dist/analyzing/readingDuration.d.ts +10 -0
  16. package/dist/analyzing/readingDuration.js +17 -0
  17. package/dist/analyzing/stringSimilarity.d.ts +8 -0
  18. package/dist/analyzing/stringSimilarity.js +145 -0
  19. package/dist/analyzing/wordCount.d.ts +1 -0
  20. package/dist/analyzing/wordCount.js +11 -0
  21. package/dist/formatting/capitalize.d.ts +1 -0
  22. package/dist/formatting/capitalize.js +12 -0
  23. package/dist/formatting/index.d.ts +11 -0
  24. package/dist/formatting/index.js +17 -0
  25. package/dist/formatting/number.d.ts +1 -0
  26. package/dist/formatting/number.js +7 -0
  27. package/dist/formatting/phone.d.ts +2 -0
  28. package/dist/formatting/phone.js +25 -0
  29. package/dist/index.d.ts +47 -0
  30. package/dist/index.js +30 -0
  31. package/dist/tests/analyzing/characterCount.test.d.ts +1 -0
  32. package/dist/tests/analyzing/characterCount.test.js +19 -0
  33. package/dist/tests/analyzing/characterFrequency.test.d.ts +1 -0
  34. package/dist/tests/analyzing/characterFrequency.test.js +22 -0
  35. package/dist/tests/analyzing/complexity.test.d.ts +1 -0
  36. package/dist/tests/analyzing/complexity.test.js +28 -0
  37. package/dist/tests/analyzing/readingDuration.test.d.ts +1 -0
  38. package/dist/tests/analyzing/readingDuration.test.js +45 -0
  39. package/dist/tests/analyzing/stringSimilarity.test.d.ts +1 -0
  40. package/dist/tests/analyzing/stringSimilarity.test.js +61 -0
  41. package/dist/tests/analyzing/wordCount.test.d.ts +1 -0
  42. package/dist/tests/analyzing/wordCount.test.js +22 -0
  43. package/dist/tests/formatting/capitalize.test.d.ts +1 -0
  44. package/dist/tests/formatting/capitalize.test.js +22 -0
  45. package/dist/tests/formatting/number.test.d.ts +1 -0
  46. package/dist/tests/formatting/number.test.js +19 -0
  47. package/dist/tests/formatting/phone.test.d.ts +1 -0
  48. package/dist/tests/formatting/phone.test.js +25 -0
  49. package/dist/tests/transformations/camelCase.test.d.ts +1 -0
  50. package/dist/tests/transformations/camelCase.test.js +19 -0
  51. package/dist/tests/transformations/capitalizeWords.test.d.ts +1 -0
  52. package/dist/tests/transformations/capitalizeWords.test.js +19 -0
  53. package/dist/tests/transformations/constantCase.test.d.ts +1 -0
  54. package/dist/tests/transformations/constantCase.test.js +19 -0
  55. package/dist/tests/transformations/deburr.test.d.ts +1 -0
  56. package/dist/tests/transformations/deburr.test.js +27 -0
  57. package/dist/tests/transformations/escapeHTML.test.d.ts +1 -0
  58. package/dist/tests/transformations/escapeHTML.test.js +46 -0
  59. package/dist/tests/transformations/initials.test.d.ts +1 -0
  60. package/dist/tests/transformations/initials.test.js +25 -0
  61. package/dist/tests/transformations/kebabCase.test.d.ts +1 -0
  62. package/dist/tests/transformations/kebabCase.test.js +19 -0
  63. package/dist/tests/transformations/maskSegment.test.d.ts +1 -0
  64. package/dist/tests/transformations/maskSegment.test.js +30 -0
  65. package/dist/tests/transformations/pascalCase.test.d.ts +1 -0
  66. package/dist/tests/transformations/pascalCase.test.js +19 -0
  67. package/dist/tests/transformations/removeDuplicates.test.d.ts +1 -0
  68. package/dist/tests/transformations/removeDuplicates.test.js +19 -0
  69. package/dist/tests/transformations/removeSpecialChars.test.d.ts +1 -0
  70. package/dist/tests/transformations/removeSpecialChars.test.js +22 -0
  71. package/dist/tests/transformations/removeWords.test.d.ts +1 -0
  72. package/dist/tests/transformations/removeWords.test.js +25 -0
  73. package/dist/tests/transformations/snakeCase.test.d.ts +1 -0
  74. package/dist/tests/transformations/snakeCase.test.js +19 -0
  75. package/dist/tests/transformations/titleCase.test.d.ts +1 -0
  76. package/dist/tests/transformations/titleCase.test.js +19 -0
  77. package/dist/tests/transformations/toSlug.test.d.ts +1 -0
  78. package/dist/tests/transformations/toSlug.test.js +22 -0
  79. package/dist/tests/transformations/truncateText.test.d.ts +1 -0
  80. package/dist/tests/transformations/truncateText.test.js +31 -0
  81. package/dist/tests/validations/isDate.test.d.ts +1 -0
  82. package/dist/tests/validations/isDate.test.js +55 -0
  83. package/dist/tests/validations/isEmail.test.d.ts +1 -0
  84. package/dist/tests/validations/isEmail.test.js +17 -0
  85. package/dist/tests/validations/isEmpty.test.d.ts +1 -0
  86. package/dist/tests/validations/isEmpty.test.js +19 -0
  87. package/dist/tests/validations/isHexColor.test.d.ts +1 -0
  88. package/dist/tests/validations/isHexColor.test.js +32 -0
  89. package/dist/tests/validations/isIPv4.test.d.ts +1 -0
  90. package/dist/tests/validations/isIPv4.test.js +59 -0
  91. package/dist/tests/validations/isSlug.test.d.ts +1 -0
  92. package/dist/tests/validations/isSlug.test.js +22 -0
  93. package/dist/tests/validations/isURL.test.d.ts +1 -0
  94. package/dist/tests/validations/isURL.test.js +18 -0
  95. package/dist/transformations/camelCase.d.ts +1 -0
  96. package/dist/transformations/camelCase.js +15 -0
  97. package/dist/transformations/capitalizeWords.d.ts +1 -0
  98. package/dist/transformations/capitalizeWords.js +9 -0
  99. package/dist/transformations/constantCase.d.ts +1 -0
  100. package/dist/transformations/constantCase.js +15 -0
  101. package/dist/transformations/deburr.d.ts +7 -0
  102. package/dist/transformations/deburr.js +16 -0
  103. package/dist/transformations/escapeHTML.d.ts +1 -0
  104. package/dist/transformations/escapeHTML.js +14 -0
  105. package/dist/transformations/index.d.ts +49 -0
  106. package/dist/transformations/index.js +67 -0
  107. package/dist/transformations/initials.d.ts +1 -0
  108. package/dist/transformations/initials.js +19 -0
  109. package/dist/transformations/kebabCase.d.ts +1 -0
  110. package/dist/transformations/kebabCase.js +15 -0
  111. package/dist/transformations/maskSegment.d.ts +9 -0
  112. package/dist/transformations/maskSegment.js +25 -0
  113. package/dist/transformations/pascalCase.d.ts +1 -0
  114. package/dist/transformations/pascalCase.js +15 -0
  115. package/dist/transformations/removeDuplicates.d.ts +1 -0
  116. package/dist/transformations/removeDuplicates.js +13 -0
  117. package/dist/transformations/removeSpecialChars.d.ts +1 -0
  118. package/dist/transformations/removeSpecialChars.js +12 -0
  119. package/dist/transformations/removeWords.d.ts +1 -0
  120. package/dist/transformations/removeWords.js +23 -0
  121. package/dist/transformations/snakeCase.d.ts +1 -0
  122. package/dist/transformations/snakeCase.js +15 -0
  123. package/dist/transformations/titleCase.d.ts +1 -0
  124. package/dist/transformations/titleCase.js +14 -0
  125. package/dist/transformations/toSlug.d.ts +1 -0
  126. package/dist/transformations/toSlug.js +13 -0
  127. package/dist/transformations/truncateText.d.ts +1 -0
  128. package/dist/transformations/truncateText.js +19 -0
  129. package/dist/validations/index.d.ts +23 -0
  130. package/dist/validations/index.js +33 -0
  131. package/dist/validations/isDate.d.ts +18 -0
  132. package/dist/validations/isDate.js +63 -0
  133. package/dist/validations/isEmail.d.ts +1 -0
  134. package/dist/validations/isEmail.js +7 -0
  135. package/dist/validations/isEmpty.d.ts +1 -0
  136. package/dist/validations/isEmpty.js +6 -0
  137. package/dist/validations/isHexColor.d.ts +7 -0
  138. package/dist/validations/isHexColor.js +15 -0
  139. package/dist/validations/isIPv4.d.ts +1 -0
  140. package/dist/validations/isIPv4.js +13 -0
  141. package/dist/validations/isSlug.d.ts +1 -0
  142. package/dist/validations/isSlug.js +10 -0
  143. package/dist/validations/isURL.d.ts +1 -0
  144. package/dist/validations/isURL.js +12 -0
  145. package/package.json +10 -4
  146. package/analysis.js +0 -21
  147. package/formatting.js +0 -37
  148. package/index.js +0 -75
  149. package/transformations.js +0 -190
  150. 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,87 @@
1
+ # Contributing to Stringzy
2
+ Thanks for your interest in contributing to Stringzy! This document provides guidelines and instructions for contributing to the project.
3
+
4
+ ## What We're Looking For
5
+ - **Bug fixes** - Help us solve issues
6
+ - **New string functions** - Add useful string manipulation methods
7
+ - **Documentation** - Improve examples and guides
8
+ - **Tests** - Add test coverage for existing or new features
9
+
10
+ ## Development Guide
11
+
12
+ ### Setup
13
+ 1. Fork the repository
14
+ 2. Clone your fork:
15
+ _Remember to replace `YOUR-USERNAME` with your actual GitHub username._
16
+ ```bash
17
+ git clone https://github.com/YOUR-USERNAME/stringzy.git
18
+ ```
19
+
20
+ 3. Navigate to the project directory:
21
+ ```bash
22
+ cd stringzy
23
+ ```
24
+
25
+ 4. Install dependencies:
26
+ ```bash
27
+ npm install
28
+ ```
29
+
30
+
31
+ ### Making Changes
32
+ - Create a new branch:
33
+ ```bash
34
+ git checkout -b feature/amazing-feature
35
+ ```
36
+ - Make your changes
37
+ - Write tests for new functions
38
+ - Keep functions simple and focused
39
+ - Follow existing code style
40
+ - Update README if adding new functions
41
+
42
+ ### Code Style
43
+ - Use 2 spaces for indentation
44
+ - Add JSDoc comments for new functions
45
+ - Handle edge cases (null, undefined, empty strings)
46
+ - Use descriptive function names
47
+
48
+ Example:
49
+ ```ts
50
+ /**
51
+ * Converts string to kebab-case
52
+ * @param str Input string
53
+ * @returns Kebab-case string
54
+ */
55
+ function toKebabCase(str: string): string {
56
+ if (!str) return '';
57
+ return str.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();
58
+ }
59
+ ```
60
+
61
+ ## Submitting Changes
62
+ 1. Make sure tests pass:
63
+ ```bash
64
+ npm test
65
+ ```
66
+
67
+ 2. Commit your changes:
68
+ ```bash
69
+ git commit -m "feat: add some amazing feature"
70
+ ```
71
+
72
+ 3. Push to the branch
73
+ ```bash
74
+ git push origin feature/amazing-feature
75
+ ```
76
+
77
+ 4. Create a pull request with:
78
+ - Clear description of changes
79
+ - Why the change is needed
80
+ - Any breaking changes
81
+
82
+ ## Questions?
83
+ If you have any questions or need help, feel free to open an issue. We're happy to help!
84
+
85
+ ---
86
+
87
+ 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.