revdev 0.27.0 → 0.30.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.
@@ -1,5 +1,4 @@
1
1
  export interface FeSettingsProfile {
2
- id: string;
3
2
  username: string;
4
3
  email: string;
5
4
  name: string;
@@ -1,6 +1,8 @@
1
1
  export declare class RegexUtil {
2
2
  private static slugRegex;
3
3
  private static tagCodeRegex;
4
- static isSlug(slug: string): boolean;
5
- static isTagCode(code: string): boolean;
4
+ private static emailRegex;
5
+ static slug(slug: string): boolean;
6
+ static tagCode(code: string): boolean;
7
+ static email(code: string): boolean;
6
8
  }
@@ -4,17 +4,22 @@ exports.RegexUtil = void 0;
4
4
  var RegexUtil = /** @class */ (function () {
5
5
  function RegexUtil() {
6
6
  }
7
- RegexUtil.isSlug = function (slug) {
7
+ RegexUtil.slug = function (slug) {
8
8
  this.slugRegex.lastIndex = 0;
9
9
  return this.slugRegex.test(slug);
10
10
  };
11
- RegexUtil.isTagCode = function (code) {
11
+ RegexUtil.tagCode = function (code) {
12
12
  this.tagCodeRegex.lastIndex = 0;
13
13
  return this.tagCodeRegex.test(code);
14
14
  };
15
+ RegexUtil.email = function (code) {
16
+ this.emailRegex.lastIndex = 0;
17
+ return this.emailRegex.test(code);
18
+ };
15
19
  // min: 6, max: 50
16
20
  RegexUtil.slugRegex = /^[a-z][a-z0-9\-]{4,48}[a-z0-9]$/g;
17
21
  RegexUtil.tagCodeRegex = /^[a-z]([\-]?[a-z]+)*$/g;
22
+ RegexUtil.emailRegex = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|.(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
18
23
  return RegexUtil;
19
24
  }());
20
25
  exports.RegexUtil = RegexUtil;
@@ -3,42 +3,53 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  var regex_1 = require("../regex");
4
4
  describe("RegexUtil", function () {
5
5
  describe("slug", function () {
6
- function trueSlug(text) {
7
- expect(regex_1.RegexUtil.isSlug(text)).toBe(true);
8
- }
9
- function falseSlug(text) {
10
- expect(regex_1.RegexUtil.isSlug(text)).toBe(false);
6
+ function validate(text, valid) {
7
+ if (valid === void 0) { valid = true; }
8
+ expect(regex_1.RegexUtil.slug(text)).toBe(valid);
11
9
  }
12
10
  test("true", function () {
13
- trueSlug("my-list");
14
- trueSlug("mylist");
15
- trueSlug("mylist-25");
16
- trueSlug("m12345");
11
+ validate("my-list");
12
+ validate("mylist");
13
+ validate("mylist-25");
14
+ validate("m12345");
17
15
  });
18
16
  test("false", function () {
19
- falseSlug("my");
20
- falseSlug("-mylist");
21
- falseSlug("1mylist");
17
+ validate("my", false);
18
+ validate("-mylist", false);
19
+ validate("1mylist", false);
22
20
  });
23
21
  });
24
22
  describe("tag", function () {
25
- function trueCode(text) {
26
- expect(regex_1.RegexUtil.isTagCode(text)).toBe(true);
23
+ function validate(text, valid) {
24
+ if (valid === void 0) { valid = true; }
25
+ expect(regex_1.RegexUtil.tagCode(text)).toBe(valid);
27
26
  }
28
- function falseCode(text) {
29
- expect(regex_1.RegexUtil.isTagCode(text)).toBe(false);
27
+ test("true", function () {
28
+ validate("my-code");
29
+ validate("tag");
30
+ validate("a");
31
+ validate("abcd-e-ef-ji");
32
+ });
33
+ test("false", function () {
34
+ validate("", false);
35
+ validate("a-", false);
36
+ validate("-b", false);
37
+ validate("my1", false);
38
+ });
39
+ });
40
+ describe("email", function () {
41
+ function validate(text, valid) {
42
+ if (valid === void 0) { valid = true; }
43
+ expect(regex_1.RegexUtil.email(text)).toBe(valid);
30
44
  }
31
45
  test("true", function () {
32
- trueCode("my-code");
33
- trueCode("tag");
34
- trueCode("a");
35
- trueCode("abcd-e-ef-ji");
46
+ validate("test@test.test");
36
47
  });
37
48
  test("false", function () {
38
- falseCode("");
39
- falseCode("a-");
40
- falseCode("-b");
41
- falseCode("my1");
49
+ validate("test", false);
50
+ validate("test@", false);
51
+ validate("test@test", false);
52
+ validate("test@test.", false);
42
53
  });
43
54
  });
44
55
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "revdev",
3
- "version": "0.27.0",
3
+ "version": "0.30.0",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",