Skip to content

Commit

Permalink
feat: add ValidateEmail
Browse files Browse the repository at this point in the history
  • Loading branch information
Williancc1557 committed Jul 29, 2022
1 parent f24ab68 commit 8abef15
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"@types/pino-http": "^5.8.1",
"@types/pino-pretty": "^4.7.5",
"@types/supertest": "^2.0.12",
"@types/validator": "^13.7.4",
"eslint": "^8.20.0",
"git-commit-msg-linter": "^4.1.3",
"husky": "^8.0.1",
Expand All @@ -42,6 +43,7 @@
"mongodb": "^4.8.0",
"pino": "^8.3.0",
"pino-http": "^8.1.1",
"pino-pretty": "^8.1.0"
"pino-pretty": "^8.1.0",
"validator": "^13.7.0"
}
}
8 changes: 8 additions & 0 deletions src/utils/validate-email.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import type { ValidateEmail } from "../presentation/protocols/validate-email";
import validator from "validator";

export class UtilValidateEmail implements ValidateEmail {
public validate(email: string): boolean {
return validator.isEmail(email);
}
}
10 changes: 10 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -938,6 +938,11 @@
resolved "https://registry.yarnpkg.com/@types/tmp/-/tmp-0.2.3.tgz#908bfb113419fd6a42273674c00994d40902c165"
integrity sha512-dDZH/tXzwjutnuk4UacGgFRwV+JSLaXL1ikvidfJprkb7L9Nx1njcRHHmi3Dsvt7pgqqTEeucQuOrWHPFgzVHA==

"@types/validator@^13.7.4":
version "13.7.4"
resolved "https://registry.yarnpkg.com/@types/validator/-/validator-13.7.4.tgz#33cc949ee87dd47c63e35ba4ad94f6888852be04"
integrity sha512-uAaSWegu2lymY18l+s5nmcXu3sFeeTOl1zhSGoYzcr6T3wz1M+3OcW4UjfPhIhHGd13tIMRDsEpR+d8w/MexwQ==

"@types/webidl-conversions@*":
version "6.1.1"
resolved "https://registry.yarnpkg.com/@types/webidl-conversions/-/webidl-conversions-6.1.1.tgz#e33bc8ea812a01f63f90481c666334844b12a09e"
Expand Down Expand Up @@ -5103,6 +5108,11 @@ v8-to-istanbul@^9.0.1:
"@types/istanbul-lib-coverage" "^2.0.1"
convert-source-map "^1.6.0"

validator@^13.7.0:
version "13.7.0"
resolved "https://registry.yarnpkg.com/validator/-/validator-13.7.0.tgz#4f9658ba13ba8f3d82ee881d3516489ea85c0857"
integrity sha512-nYXQLCBkpJ8X6ltALua9dRrZDHVYxjJ1wgskNt1lH9fzGjs3tgojGSCBjmEPwkWS1y29+DrizMTW19Pr9uB2nw==

vary@~1.1.2:
version "1.1.2"
resolved "https://registry.yarnpkg.com/vary/-/vary-1.1.2.tgz#2299f02c6ded30d4a5961b0b9f74524a18f634fc"
Expand Down

0 comments on commit 8abef15

Please sign in to comment.