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.
- package/.github/workflows/publish.yml +29 -0
- package/.github/workflows/test-on-pr.yml +23 -0
- package/CONTRIBUTING.md +87 -0
- package/LICENSE +21 -21
- package/README.md +952 -723
- package/changelog.txt +110 -110
- package/dist/analyzing/characterCount.d.ts +1 -0
- package/dist/analyzing/characterCount.js +9 -0
- package/dist/analyzing/characterFrequency.d.ts +1 -0
- package/dist/analyzing/characterFrequency.js +16 -0
- package/dist/analyzing/complexity.d.ts +6 -0
- package/dist/analyzing/complexity.js +30 -0
- package/dist/analyzing/index.d.ts +20 -0
- package/dist/analyzing/index.js +29 -0
- package/dist/analyzing/readingDuration.d.ts +10 -0
- package/dist/analyzing/readingDuration.js +17 -0
- package/dist/analyzing/stringSimilarity.d.ts +8 -0
- package/dist/analyzing/stringSimilarity.js +145 -0
- package/dist/analyzing/wordCount.d.ts +1 -0
- package/dist/analyzing/wordCount.js +11 -0
- package/dist/formatting/capitalize.d.ts +1 -0
- package/dist/formatting/capitalize.js +12 -0
- package/dist/formatting/index.d.ts +11 -0
- package/dist/formatting/index.js +17 -0
- package/dist/formatting/number.d.ts +1 -0
- package/dist/formatting/number.js +7 -0
- package/dist/formatting/phone.d.ts +2 -0
- package/dist/formatting/phone.js +25 -0
- package/dist/index.d.ts +47 -0
- package/dist/index.js +30 -0
- package/dist/tests/analyzing/characterCount.test.d.ts +1 -0
- package/dist/tests/analyzing/characterCount.test.js +19 -0
- package/dist/tests/analyzing/characterFrequency.test.d.ts +1 -0
- package/dist/tests/analyzing/characterFrequency.test.js +22 -0
- package/dist/tests/analyzing/complexity.test.d.ts +1 -0
- package/dist/tests/analyzing/complexity.test.js +28 -0
- package/dist/tests/analyzing/readingDuration.test.d.ts +1 -0
- package/dist/tests/analyzing/readingDuration.test.js +45 -0
- package/dist/tests/analyzing/stringSimilarity.test.d.ts +1 -0
- package/dist/tests/analyzing/stringSimilarity.test.js +61 -0
- package/dist/tests/analyzing/wordCount.test.d.ts +1 -0
- package/dist/tests/analyzing/wordCount.test.js +22 -0
- package/dist/tests/formatting/capitalize.test.d.ts +1 -0
- package/dist/tests/formatting/capitalize.test.js +22 -0
- package/dist/tests/formatting/number.test.d.ts +1 -0
- package/dist/tests/formatting/number.test.js +19 -0
- package/dist/tests/formatting/phone.test.d.ts +1 -0
- package/dist/tests/formatting/phone.test.js +25 -0
- package/dist/tests/transformations/camelCase.test.d.ts +1 -0
- package/dist/tests/transformations/camelCase.test.js +19 -0
- package/dist/tests/transformations/capitalizeWords.test.d.ts +1 -0
- package/dist/tests/transformations/capitalizeWords.test.js +19 -0
- package/dist/tests/transformations/constantCase.test.d.ts +1 -0
- package/dist/tests/transformations/constantCase.test.js +19 -0
- package/dist/tests/transformations/deburr.test.d.ts +1 -0
- package/dist/tests/transformations/deburr.test.js +27 -0
- package/dist/tests/transformations/escapeHTML.test.d.ts +1 -0
- package/dist/tests/transformations/escapeHTML.test.js +46 -0
- package/dist/tests/transformations/initials.test.d.ts +1 -0
- package/dist/tests/transformations/initials.test.js +25 -0
- package/dist/tests/transformations/kebabCase.test.d.ts +1 -0
- package/dist/tests/transformations/kebabCase.test.js +19 -0
- package/dist/tests/transformations/maskSegment.test.d.ts +1 -0
- package/dist/tests/transformations/maskSegment.test.js +30 -0
- package/dist/tests/transformations/pascalCase.test.d.ts +1 -0
- package/dist/tests/transformations/pascalCase.test.js +19 -0
- package/dist/tests/transformations/removeDuplicates.test.d.ts +1 -0
- package/dist/tests/transformations/removeDuplicates.test.js +19 -0
- package/dist/tests/transformations/removeSpecialChars.test.d.ts +1 -0
- package/dist/tests/transformations/removeSpecialChars.test.js +22 -0
- package/dist/tests/transformations/removeWords.test.d.ts +1 -0
- package/dist/tests/transformations/removeWords.test.js +25 -0
- package/dist/tests/transformations/snakeCase.test.d.ts +1 -0
- package/dist/tests/transformations/snakeCase.test.js +19 -0
- package/dist/tests/transformations/titleCase.test.d.ts +1 -0
- package/dist/tests/transformations/titleCase.test.js +19 -0
- package/dist/tests/transformations/toSlug.test.d.ts +1 -0
- package/dist/tests/transformations/toSlug.test.js +22 -0
- package/dist/tests/transformations/truncateText.test.d.ts +1 -0
- package/dist/tests/transformations/truncateText.test.js +31 -0
- package/dist/tests/validations/isDate.test.d.ts +1 -0
- package/dist/tests/validations/isDate.test.js +55 -0
- package/dist/tests/validations/isEmail.test.d.ts +1 -0
- package/dist/tests/validations/isEmail.test.js +17 -0
- package/dist/tests/validations/isEmpty.test.d.ts +1 -0
- package/dist/tests/validations/isEmpty.test.js +19 -0
- package/dist/tests/validations/isHexColor.test.d.ts +1 -0
- package/dist/tests/validations/isHexColor.test.js +32 -0
- package/dist/tests/validations/isIPv4.test.d.ts +1 -0
- package/dist/tests/validations/isIPv4.test.js +59 -0
- package/dist/tests/validations/isSlug.test.d.ts +1 -0
- package/dist/tests/validations/isSlug.test.js +22 -0
- package/dist/tests/validations/isURL.test.d.ts +1 -0
- package/dist/tests/validations/isURL.test.js +18 -0
- package/dist/transformations/camelCase.d.ts +1 -0
- package/dist/transformations/camelCase.js +15 -0
- package/dist/transformations/capitalizeWords.d.ts +1 -0
- package/dist/transformations/capitalizeWords.js +9 -0
- package/dist/transformations/constantCase.d.ts +1 -0
- package/dist/transformations/constantCase.js +15 -0
- package/dist/transformations/deburr.d.ts +7 -0
- package/dist/transformations/deburr.js +16 -0
- package/dist/transformations/escapeHTML.d.ts +1 -0
- package/dist/transformations/escapeHTML.js +14 -0
- package/dist/transformations/index.d.ts +49 -0
- package/dist/transformations/index.js +67 -0
- package/dist/transformations/initials.d.ts +1 -0
- package/dist/transformations/initials.js +19 -0
- package/dist/transformations/kebabCase.d.ts +1 -0
- package/dist/transformations/kebabCase.js +15 -0
- package/dist/transformations/maskSegment.d.ts +9 -0
- package/dist/transformations/maskSegment.js +25 -0
- package/dist/transformations/pascalCase.d.ts +1 -0
- package/dist/transformations/pascalCase.js +15 -0
- package/dist/transformations/removeDuplicates.d.ts +1 -0
- package/dist/transformations/removeDuplicates.js +13 -0
- package/dist/transformations/removeSpecialChars.d.ts +1 -0
- package/dist/transformations/removeSpecialChars.js +12 -0
- package/dist/transformations/removeWords.d.ts +1 -0
- package/dist/transformations/removeWords.js +23 -0
- package/dist/transformations/snakeCase.d.ts +1 -0
- package/dist/transformations/snakeCase.js +15 -0
- package/dist/transformations/titleCase.d.ts +1 -0
- package/dist/transformations/titleCase.js +14 -0
- package/dist/transformations/toSlug.d.ts +1 -0
- package/dist/transformations/toSlug.js +13 -0
- package/dist/transformations/truncateText.d.ts +1 -0
- package/dist/transformations/truncateText.js +19 -0
- package/dist/validations/index.d.ts +23 -0
- package/dist/validations/index.js +33 -0
- package/dist/validations/isDate.d.ts +18 -0
- package/dist/validations/isDate.js +63 -0
- package/dist/validations/isEmail.d.ts +1 -0
- package/dist/validations/isEmail.js +7 -0
- package/dist/validations/isEmpty.d.ts +1 -0
- package/dist/validations/isEmpty.js +6 -0
- package/dist/validations/isHexColor.d.ts +7 -0
- package/dist/validations/isHexColor.js +15 -0
- package/dist/validations/isIPv4.d.ts +1 -0
- package/dist/validations/isIPv4.js +13 -0
- package/dist/validations/isSlug.d.ts +1 -0
- package/dist/validations/isSlug.js +10 -0
- package/dist/validations/isURL.d.ts +1 -0
- package/dist/validations/isURL.js +12 -0
- package/package.json +10 -4
- package/analysis.js +0 -21
- package/formatting.js +0 -37
- package/index.js +0 -75
- package/transformations.js +0 -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
|
package/CONTRIBUTING.md
ADDED
|
@@ -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.
|