@moreapp/common-nodejs 0.7.11 → 0.7.12

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 CHANGED
@@ -48,6 +48,9 @@ function isValidEmail(email) {
48
48
  if (localAddr === undefined || domain === undefined) {
49
49
  return false;
50
50
  }
51
- return emailAddressLocalPattern.test(localAddr) && emailAddressDomainPattern.test(domain);
51
+ return (!localAddr.startsWith(".") &&
52
+ !localAddr.includes(" ") &&
53
+ emailAddressLocalPattern.test(localAddr) &&
54
+ emailAddressDomainPattern.test(domain));
52
55
  }
53
56
  exports.isValidEmail = isValidEmail;
@@ -57,5 +57,7 @@ describe("isValidEmail", () => {
57
57
  test("Too short TLD", () => expect((0, utils_1.isValidEmail)("a@b.c")).toBeFalsy());
58
58
  test("Missing local part", () => expect((0, utils_1.isValidEmail)("@moreapp.dev")).toBeFalsy());
59
59
  test("Too long", () => expect((0, utils_1.isValidEmail)("abcdefghijklmnopqrstuvwxyz-abcdefghijklmnopqrstuvwxyz-abcdefghijklmnopqrstuvwxyz-abcdefghijklmnopqrstuvwxyz-abcdefghijklmnopqrstuvwxyz-abcdefghijklmnopqrstuvwxyz-abcdefghijklmnopqrstuvwxyz-abcdefghijklmnopqrstuvwxyz-abcdefghijklmnopqrstuvwxyz-@moreapp.dev")).toBeFalsy());
60
+ test("Starts with '.'", () => expect((0, utils_1.isValidEmail)(".a@moreapp.dev")).toBeFalsy());
61
+ test("Local part contains whitespace", () => expect((0, utils_1.isValidEmail)("a b@moreapp.dev")).toBeFalsy());
60
62
  });
61
63
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moreapp/common-nodejs",
3
- "version": "0.7.11",
3
+ "version": "0.7.12",
4
4
  "license": "UNLICENSED",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",