@fabriktor/fx 0.0.17 → 0.0.19

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.
@@ -3,14 +3,15 @@
3
3
  // Licensed under the Apache License, Version 2.0 (the "License"); you may
4
4
  // not use this file except in compliance with the License. You may obtain
5
5
  // a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
6
+ const e164Pattern = /^\+[1-9]\d{1,14}$/;
6
7
  export function normalizePhone(v) {
7
- return v.trim();
8
+ return v.trim().replace(/\s+/g, "");
8
9
  }
9
10
  export function normalizePhoneCode(v) {
10
11
  return v.trim();
11
12
  }
12
13
  export function validatePhone(v) {
13
- return normalizePhone(v).length > 0;
14
+ return e164Pattern.test(normalizePhone(v));
14
15
  }
15
16
  export function validatePhoneCode(v) {
16
17
  return normalizePhoneCode(v).length > 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fabriktor/fx",
3
- "version": "0.0.17",
3
+ "version": "0.0.19",
4
4
  "description": "![Fabriktor Logo](./img/fabriktor-character.gif)",
5
5
  "type": "module",
6
6
  "exports": {
@@ -17,7 +17,7 @@
17
17
  "typescript": "^6.0.3"
18
18
  },
19
19
  "dependencies": {
20
- "@fabriktor/client": "^0.0.15",
20
+ "@fabriktor/client": "^0.0.16",
21
21
  "@fabriktor/schema": "^0.0.12"
22
22
  }
23
23
  }