meemup-library 1.3.68 → 1.3.70
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,7 +1,9 @@
|
|
|
1
1
|
declare const _default: {
|
|
2
2
|
unFormatPhoneNumber(phone?: string | null): string;
|
|
3
3
|
formatPhoneNumber(phone?: string): string;
|
|
4
|
-
toDisplay(phone?: string): string;
|
|
5
4
|
formatAccordingToLength(phone?: string): string;
|
|
5
|
+
toDisplay(phone?: string, init?: string): string;
|
|
6
|
+
toSave(phone?: string | null): string;
|
|
7
|
+
toForm(phone?: string | null): string;
|
|
6
8
|
};
|
|
7
9
|
export default _default;
|
|
@@ -20,17 +20,6 @@ export default new class {
|
|
|
20
20
|
let p3 = unformat.slice(len - 4, len);
|
|
21
21
|
return `+${p0} (${p1}) ${p2}-${p3}`;
|
|
22
22
|
}
|
|
23
|
-
toDisplay(phone = "0000000000") {
|
|
24
|
-
let unformat = this.unFormatPhoneNumber(phone);
|
|
25
|
-
if (unformat.length === 10)
|
|
26
|
-
unformat = "1" + unformat;
|
|
27
|
-
const len = unformat.length;
|
|
28
|
-
// let p0 = unformat.slice(0, len - len - 10);
|
|
29
|
-
let p1 = unformat.slice(len - 10, len - 7);
|
|
30
|
-
let p2 = unformat.slice(len - 7, len - 4);
|
|
31
|
-
let p3 = unformat.slice(len - 4, len);
|
|
32
|
-
return `(${p1}) ${p2}-${p3}`;
|
|
33
|
-
}
|
|
34
23
|
formatAccordingToLength(phone = "0000000000") {
|
|
35
24
|
let unFormat = this.unFormatPhoneNumber(phone);
|
|
36
25
|
if (unFormat.length < 4)
|
|
@@ -44,4 +33,26 @@ export default new class {
|
|
|
44
33
|
// let p3 = unFormat.slice(len - 4, len);
|
|
45
34
|
// return `(${p1}) ${p2}-${p3}`;
|
|
46
35
|
}
|
|
36
|
+
toDisplay(phone = "0000000000", init = "") {
|
|
37
|
+
let unformat = this.unFormatPhoneNumber(phone);
|
|
38
|
+
if (isNaN(+unformat))
|
|
39
|
+
return init;
|
|
40
|
+
if (unformat.length === 10)
|
|
41
|
+
unformat = "1" + unformat;
|
|
42
|
+
const len = unformat.length;
|
|
43
|
+
// let p0 = unformat.slice(0, len - len - 10);
|
|
44
|
+
let p1 = unformat.slice(len - 10, len - 7);
|
|
45
|
+
let p2 = unformat.slice(len - 7, len - 4);
|
|
46
|
+
let p3 = unformat.slice(len - 4, len);
|
|
47
|
+
return `(${p1}) ${p2}-${p3}`;
|
|
48
|
+
}
|
|
49
|
+
toSave(phone = "(000) 000-0000") {
|
|
50
|
+
let str = this.unFormatPhoneNumber(phone ? phone : "");
|
|
51
|
+
if (str === "")
|
|
52
|
+
return str;
|
|
53
|
+
return str;
|
|
54
|
+
}
|
|
55
|
+
toForm(phone = "(000) 000-0000") {
|
|
56
|
+
return this.unFormatPhoneNumber(phone ? phone : "");
|
|
57
|
+
}
|
|
47
58
|
}();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "meemup-library",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.70",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"remove:one": "rimraf dist",
|
|
12
12
|
"remove:two": "rimraf ./src/dist",
|
|
13
13
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
14
|
-
"commit": "git add . && git commit -m \"version.1.3.
|
|
14
|
+
"commit": "git add . && git commit -m \"version.1.3.70 \" && git push origin "
|
|
15
15
|
},
|
|
16
16
|
"files": [
|
|
17
17
|
"/dist"
|