@moreapp/common-nodejs 0.7.14 → 0.7.15
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/dist/utils.js +2 -2
- package/dist/utils.test.js +1 -0
- package/package.json +1 -1
package/dist/utils.js
CHANGED
|
@@ -43,8 +43,8 @@ function isValidEmail(email) {
|
|
|
43
43
|
if (email.length > emailAddressMaxLength) {
|
|
44
44
|
return false;
|
|
45
45
|
}
|
|
46
|
-
const [localAddr, domain] = email.split("@");
|
|
47
|
-
if (localAddr === undefined || domain === undefined) {
|
|
46
|
+
const [localAddr, domain, ...rest] = email.split("@");
|
|
47
|
+
if (localAddr === undefined || domain === undefined || rest.length > 0) {
|
|
48
48
|
return false;
|
|
49
49
|
}
|
|
50
50
|
return (!localAddr.startsWith(".") &&
|
package/dist/utils.test.js
CHANGED
|
@@ -49,6 +49,7 @@ describe("isValidEmail", () => {
|
|
|
49
49
|
describe("Invalid email addresses", () => {
|
|
50
50
|
test("Missing '@' character and domain", () => expect((0, utils_1.isValidEmail)("john")).toBeFalsy());
|
|
51
51
|
test("Multiple '@' characters", () => expect((0, utils_1.isValidEmail)("a@b@moreapp.dev")).toBeFalsy());
|
|
52
|
+
test("Ends with a '@' character", () => expect((0, utils_1.isValidEmail)("a@moreapp.dev@")).toBeFalsy());
|
|
52
53
|
test("Empty", () => expect((0, utils_1.isValidEmail)("")).toBeFalsy());
|
|
53
54
|
test("Whitespace before/after", () => expect((0, utils_1.isValidEmail)(" a@moreapp.dev ")).toBeFalsy());
|
|
54
55
|
test("Newlines, tabs, ..., before/after", () => expect((0, utils_1.isValidEmail)("\n \ta@moreapp.dev\n ")).toBeFalsy());
|