@dgpholdings/greatoak-shared 1.2.11 → 1.2.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.
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.maskEmail = exports.isAnonymousEmail = exports.isEmail = void 0;
|
|
4
|
+
const isEmail = (value) => {
|
|
5
|
+
const regex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
6
|
+
return regex.test(value.trim());
|
|
7
|
+
};
|
|
8
|
+
exports.isEmail = isEmail;
|
|
9
|
+
const isAnonymousEmail = (email) => {
|
|
10
|
+
if (!email)
|
|
11
|
+
return true;
|
|
12
|
+
if (email === null || email === undefined || email === "")
|
|
13
|
+
return true;
|
|
14
|
+
if (email.includes("@anonymous.local"))
|
|
15
|
+
return true;
|
|
16
|
+
return false;
|
|
17
|
+
};
|
|
18
|
+
exports.isAnonymousEmail = isAnonymousEmail;
|
|
19
|
+
const maskEmail = (email) => {
|
|
20
|
+
if (!email)
|
|
21
|
+
return "[no email]";
|
|
22
|
+
const [localPart, domain] = email.split("@");
|
|
23
|
+
if (!domain)
|
|
24
|
+
return "***";
|
|
25
|
+
const maskedLocal = localPart.substring(0, 3) + "***";
|
|
26
|
+
return `${maskedLocal}@${domain}`;
|
|
27
|
+
};
|
|
28
|
+
exports.maskEmail = maskEmail;
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -6,3 +6,4 @@ export { isDefined, isDefinedNumber } from "./isDefined.utils";
|
|
|
6
6
|
export { slugifyText } from "./slugify.util";
|
|
7
7
|
export { toError } from "./toError.util";
|
|
8
8
|
export { generatePlanCode } from "./planCode.util";
|
|
9
|
+
export { maskEmail, isAnonymousEmail, isEmail } from "./email.utils";
|
package/dist/utils/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.generatePlanCode = exports.toError = exports.slugifyText = exports.isDefinedNumber = exports.isDefined = exports.calculateExerciseScore = exports.countryToCurrencyCode = exports.getDaysAndHoursDifference = exports.isUserAllowedToUpdate = exports.mmssToSecs = exports.toNumber = void 0;
|
|
3
|
+
exports.isEmail = exports.isAnonymousEmail = exports.maskEmail = exports.generatePlanCode = exports.toError = exports.slugifyText = exports.isDefinedNumber = exports.isDefined = exports.calculateExerciseScore = exports.countryToCurrencyCode = exports.getDaysAndHoursDifference = exports.isUserAllowedToUpdate = exports.mmssToSecs = exports.toNumber = void 0;
|
|
4
4
|
var number_util_1 = require("./number.util");
|
|
5
5
|
Object.defineProperty(exports, "toNumber", { enumerable: true, get: function () { return number_util_1.toNumber; } });
|
|
6
6
|
var time_util_1 = require("./time.util");
|
|
@@ -20,3 +20,7 @@ var toError_util_1 = require("./toError.util");
|
|
|
20
20
|
Object.defineProperty(exports, "toError", { enumerable: true, get: function () { return toError_util_1.toError; } });
|
|
21
21
|
var planCode_util_1 = require("./planCode.util");
|
|
22
22
|
Object.defineProperty(exports, "generatePlanCode", { enumerable: true, get: function () { return planCode_util_1.generatePlanCode; } });
|
|
23
|
+
var email_utils_1 = require("./email.utils");
|
|
24
|
+
Object.defineProperty(exports, "maskEmail", { enumerable: true, get: function () { return email_utils_1.maskEmail; } });
|
|
25
|
+
Object.defineProperty(exports, "isAnonymousEmail", { enumerable: true, get: function () { return email_utils_1.isAnonymousEmail; } });
|
|
26
|
+
Object.defineProperty(exports, "isEmail", { enumerable: true, get: function () { return email_utils_1.isEmail; } });
|