Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop #9

Merged
merged 6 commits into from
Dec 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ updates:
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
target-branch: "develop"
commit-message:
prefix: fix
prefix-development: chore
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/test-and-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@

name: Test & Build

# any tag or branch name
on:
push:
branches: [main]
branches: ["*"]
tags: ["*"]
pull_request:
branches: [main]
branches: ["*"]

jobs:
test-and-build:
Expand Down
14 changes: 0 additions & 14 deletions .releaserc
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,6 @@
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
[
"@semantic-release/changelog",
{
"changelogFile": "CHANGELOG.md"
}
],
[
"@semantic-release/git",
{
"assets": [
"CHANGELOG.md"
]
}
],
"@semantic-release/npm",
"@semantic-release/github"
]
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,8 @@ We welcome contributions to this library. Feel free to submit issues and pull re

For those writing commits, please follow the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) specification. This helps us maintain a consistent commit history and generate changelogs automatically.

Also, when making changes, only push to the `develop` branch. The `main` branch is reserved for stable releases as semantic-release will automatically publish to npm from there. The `develop` branch is used for development and testing, PR's will be squashed and merged into `develop` and then when ready, `develop` will be merged into `main`.

## License

This library is open-sourced under the MIT License, allowing for wide usage and modification. See the [LICENSE](LICENSE) file for details. Feel free to submit issues and pull requests to help improve the library.
Expand Down
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 3 additions & 4 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,10 +172,9 @@ class Validator {
* @returns {boolean} Returns true if the email is valid, otherwise false.
*/
static isEmail(email: string): boolean {
// We only need to check for the presence of @ and .
// This ensures that the email is at least in the correct format.
// But going beyond this is not recommended as it is very difficult to validate an email address correctly.
const re = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
// This regular expression is more efficient and less prone to backtracking issues.
// It simplifies the check for an email format by eliminating unnecessary repetition patterns.
const re = /^[^\s@]+@[^\s@]+\.[^\s@]{2,}$/;
return re.test(String(email).toLowerCase());
}

Expand Down
Loading