@validex/core 1.0.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.
- package/LICENSE +21 -0
- package/README.md +583 -0
- package/dist/checks/index.cjs +51 -0
- package/dist/checks/index.d.cts +207 -0
- package/dist/checks/index.d.ts +207 -0
- package/dist/checks/index.js +51 -0
- package/dist/chunk-2OTGUKO7.cjs +26 -0
- package/dist/chunk-4HUGF4EZ.js +0 -0
- package/dist/chunk-5CYBSNNG.cjs +33 -0
- package/dist/chunk-5DOFRLSB.js +30 -0
- package/dist/chunk-64X6D23X.cjs +24 -0
- package/dist/chunk-6MGS4JWP.js +152 -0
- package/dist/chunk-AGJWIOFF.js +24 -0
- package/dist/chunk-BAFEYOPS.js +43 -0
- package/dist/chunk-BYMZTDYD.js +56 -0
- package/dist/chunk-D232V332.cjs +30 -0
- package/dist/chunk-FD77PZXB.js +9 -0
- package/dist/chunk-H3XHQLZF.cjs +43 -0
- package/dist/chunk-ISY3F7TI.cjs +239 -0
- package/dist/chunk-JEKRBIPN.cjs +1 -0
- package/dist/chunk-KTN4NQQL.js +33 -0
- package/dist/chunk-LSQNDPFQ.cjs +9 -0
- package/dist/chunk-NDLUDRZJ.js +24 -0
- package/dist/chunk-OCTLUBGT.cjs +24 -0
- package/dist/chunk-OFT3FQPJ.cjs +152 -0
- package/dist/chunk-OOFMB7K5.js +34 -0
- package/dist/chunk-OTPQTLPM.js +50 -0
- package/dist/chunk-P3FRVJ3U.cjs +50 -0
- package/dist/chunk-PFPNNQGJ.js +30 -0
- package/dist/chunk-PQ4TUE2Q.cjs +2688 -0
- package/dist/chunk-SMDC2EAD.js +26 -0
- package/dist/chunk-TB6J73U7.js +239 -0
- package/dist/chunk-TBVAKZA5.js +2688 -0
- package/dist/chunk-TSPTIW3V.cjs +34 -0
- package/dist/chunk-WE2OD5XD.cjs +30 -0
- package/dist/chunk-WKVMDEA3.js +26 -0
- package/dist/chunk-ZAUX2RGL.cjs +56 -0
- package/dist/chunk-ZWIO2MJX.cjs +26 -0
- package/dist/cli/index.cjs +120 -0
- package/dist/cli/index.d.cts +1 -0
- package/dist/cli/index.d.ts +1 -0
- package/dist/cli/index.js +120 -0
- package/dist/commonPasswords-3BYUBARZ.cjs +10 -0
- package/dist/commonPasswords-ZYOEI6PG.js +10 -0
- package/dist/countryCodes-EKJKVHR5.cjs +10 -0
- package/dist/countryCodes-RTJZVCLB.js +10 -0
- package/dist/countryCodes-VY56VZPT.cjs +255 -0
- package/dist/countryCodes-YRY75MQP.js +255 -0
- package/dist/creditCardPrefixes-EXMJZGE7.cjs +10 -0
- package/dist/creditCardPrefixes-EZK7T4IZ.js +10 -0
- package/dist/creditCardPrefixes-HKWKCHNU.cjs +48 -0
- package/dist/creditCardPrefixes-QP3S4ZAU.js +48 -0
- package/dist/currencyCodes-GU6W3HSN.cjs +171 -0
- package/dist/currencyCodes-P67AASLW.js +171 -0
- package/dist/currencyCodes-RMRLGDME.cjs +10 -0
- package/dist/currencyCodes-U6TSAWDR.js +10 -0
- package/dist/disposableDomains-DCXSV422.js +10 -0
- package/dist/disposableDomains-USU2JQSF.cjs +10 -0
- package/dist/ibanPatterns-2PM32RIY.cjs +85 -0
- package/dist/ibanPatterns-BSQUWKLY.js +85 -0
- package/dist/ibanPatterns-KTLY6TZY.cjs +10 -0
- package/dist/ibanPatterns-LJRPR7FV.js +10 -0
- package/dist/index-Cid7Ygr_.d.cts +950 -0
- package/dist/index-Cid7Ygr_.d.ts +950 -0
- package/dist/index.cjs +361 -0
- package/dist/index.d.cts +132 -0
- package/dist/index.d.ts +132 -0
- package/dist/index.js +361 -0
- package/dist/locales/en.cjs +10 -0
- package/dist/locales/en.d.cts +234 -0
- package/dist/locales/en.d.ts +234 -0
- package/dist/locales/en.js +10 -0
- package/dist/passwordsTier1-NAZLSHKW.cjs +105 -0
- package/dist/passwordsTier1-OYRMLOWD.js +105 -0
- package/dist/passwordsTier2-GYJTYGY6.cjs +906 -0
- package/dist/passwordsTier2-JAEO5AYY.js +906 -0
- package/dist/passwordsTier3-BAPUFHZM.cjs +9006 -0
- package/dist/passwordsTier3-E6WBK5OB.js +9006 -0
- package/dist/phoneDetection-AFSSD4IB.cjs +6 -0
- package/dist/phoneDetection-G23LZ6MU.js +6 -0
- package/dist/phoneParser-2RTXDB6H.js +10 -0
- package/dist/phoneParser-CGRP2OUN.cjs +10 -0
- package/dist/postalCodes-4EZVDT2N.cjs +10 -0
- package/dist/postalCodes-ZPAJB3P5.js +10 -0
- package/dist/reservedUsernames-3QPPKUXR.cjs +246 -0
- package/dist/reservedUsernames-GIK6NX3J.js +246 -0
- package/dist/reservedUsernames-QR4ONXSL.js +10 -0
- package/dist/reservedUsernames-W65FGT6A.cjs +10 -0
- package/dist/rules/index.cjs +66 -0
- package/dist/rules/index.d.cts +2 -0
- package/dist/rules/index.d.ts +2 -0
- package/dist/rules/index.js +66 -0
- package/dist/utilities/index.cjs +8 -0
- package/dist/utilities/index.d.cts +47 -0
- package/dist/utilities/index.d.ts +47 -0
- package/dist/utilities/index.js +8 -0
- package/dist/vatPatterns-BLRXHNCP.js +36 -0
- package/dist/vatPatterns-DNVZJPTW.js +10 -0
- package/dist/vatPatterns-NPN6SV2Y.cjs +36 -0
- package/dist/vatPatterns-RRHUTA3U.cjs +10 -0
- package/package.json +133 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } }// src/loaders/postalCodes.ts
|
|
2
|
+
var cache;
|
|
3
|
+
async function loadPostalCodes() {
|
|
4
|
+
if (cache !== void 0)
|
|
5
|
+
return cache;
|
|
6
|
+
const mod = await Promise.resolve().then(() => _interopRequireWildcard(require("postcode-validator")));
|
|
7
|
+
cache = {
|
|
8
|
+
postcodeValidator: mod.postcodeValidator,
|
|
9
|
+
postcodeValidatorExistsForCountry: mod.postcodeValidatorExistsForCountry
|
|
10
|
+
};
|
|
11
|
+
return cache;
|
|
12
|
+
}
|
|
13
|
+
function getPostalCodes() {
|
|
14
|
+
return cache;
|
|
15
|
+
}
|
|
16
|
+
function clearPostalCodesCache() {
|
|
17
|
+
cache = void 0;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
exports.loadPostalCodes = loadPostalCodes; exports.getPostalCodes = getPostalCodes; exports.clearPostalCodesCache = clearPostalCodesCache;
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/checks/composition.ts
|
|
2
|
+
function countMatches(value, pattern) {
|
|
3
|
+
const matches = value.match(pattern);
|
|
4
|
+
return matches ? matches.length : 0;
|
|
5
|
+
}
|
|
6
|
+
function inRange(count, min, max) {
|
|
7
|
+
return count >= min && (max === void 0 || count <= max);
|
|
8
|
+
}
|
|
9
|
+
var UPPERCASE_RE = /\p{Lu}/gu;
|
|
10
|
+
var LOWERCASE_RE = /\p{Ll}/gu;
|
|
11
|
+
var DIGIT_RE = /\p{Nd}/gu;
|
|
12
|
+
var SPECIAL_RE = /[^\p{L}\p{Nd}\s]/gu;
|
|
13
|
+
function hasUppercase(value, min, max) {
|
|
14
|
+
return inRange(countMatches(value, UPPERCASE_RE), min, max);
|
|
15
|
+
}
|
|
16
|
+
function hasLowercase(value, min, max) {
|
|
17
|
+
return inRange(countMatches(value, LOWERCASE_RE), min, max);
|
|
18
|
+
}
|
|
19
|
+
function hasDigits(value, min, max) {
|
|
20
|
+
return inRange(countMatches(value, DIGIT_RE), min, max);
|
|
21
|
+
}
|
|
22
|
+
function hasSpecial(value, min, max) {
|
|
23
|
+
return inRange(countMatches(value, SPECIAL_RE), min, max);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// src/checks/detection.ts
|
|
27
|
+
var EMAIL_RE = /[\w.%+-]+@[a-z0-9.-]+\.[a-z]{2,}/i;
|
|
28
|
+
function containsEmail(value) {
|
|
29
|
+
return EMAIL_RE.test(value);
|
|
30
|
+
}
|
|
31
|
+
var URL_PROTOCOL_RE = /https?:\/\/\S+/i;
|
|
32
|
+
var URL_WWW_RE = /\bwww\.\S+/i;
|
|
33
|
+
function containsUrl(value) {
|
|
34
|
+
return URL_PROTOCOL_RE.test(value) || URL_WWW_RE.test(value);
|
|
35
|
+
}
|
|
36
|
+
var HTML_TAG_RE = /<[a-z/][^>]*>/i;
|
|
37
|
+
function containsHtml(value) {
|
|
38
|
+
return HTML_TAG_RE.test(value);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// src/checks/limits.ts
|
|
42
|
+
var WHITESPACE_RE = /\s+/;
|
|
43
|
+
function maxWords(value, max) {
|
|
44
|
+
const words = value.split(WHITESPACE_RE).filter((segment) => segment.length > 0);
|
|
45
|
+
return words.length <= max;
|
|
46
|
+
}
|
|
47
|
+
function minWords(value, min) {
|
|
48
|
+
const words = value.trim().split(WHITESPACE_RE).filter((segment) => segment.length > 0);
|
|
49
|
+
return words.length >= min;
|
|
50
|
+
}
|
|
51
|
+
function maxConsecutive(value, max) {
|
|
52
|
+
const chars = Array.from(value);
|
|
53
|
+
let count = 1;
|
|
54
|
+
for (let i = 1; i < chars.length; i++) {
|
|
55
|
+
if (chars[i] === chars[i - 1]) {
|
|
56
|
+
count++;
|
|
57
|
+
if (count > max) {
|
|
58
|
+
return false;
|
|
59
|
+
}
|
|
60
|
+
} else {
|
|
61
|
+
count = 1;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return true;
|
|
65
|
+
}
|
|
66
|
+
var ANY_WHITESPACE_RE = /\s/;
|
|
67
|
+
function noSpaces(value) {
|
|
68
|
+
return !ANY_WHITESPACE_RE.test(value);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// src/checks/restriction.ts
|
|
72
|
+
var ALPHA_RE = /^\p{L}+$/u;
|
|
73
|
+
function onlyAlpha(value) {
|
|
74
|
+
return ALPHA_RE.test(value);
|
|
75
|
+
}
|
|
76
|
+
var NUMERIC_RE = /^\d+$/;
|
|
77
|
+
function onlyNumeric(value) {
|
|
78
|
+
return NUMERIC_RE.test(value);
|
|
79
|
+
}
|
|
80
|
+
var ALPHANUMERIC_RE = /^[\p{L}\d]+$/u;
|
|
81
|
+
function onlyAlphanumeric(value) {
|
|
82
|
+
return ALPHANUMERIC_RE.test(value);
|
|
83
|
+
}
|
|
84
|
+
var ALPHANUMERIC_SPACE_HYPHEN_RE = /^[\p{L}\d\s-]+$/u;
|
|
85
|
+
function onlyAlphanumericSpaceHyphen(value) {
|
|
86
|
+
return ALPHANUMERIC_SPACE_HYPHEN_RE.test(value);
|
|
87
|
+
}
|
|
88
|
+
var ALPHA_SPACE_HYPHEN_RE = /^[\p{L}\s-]+$/u;
|
|
89
|
+
function onlyAlphaSpaceHyphen(value) {
|
|
90
|
+
return ALPHA_SPACE_HYPHEN_RE.test(value);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// src/checks/transforms.ts
|
|
94
|
+
function emptyToUndefined(value) {
|
|
95
|
+
if (value === "" || value === null) {
|
|
96
|
+
return void 0;
|
|
97
|
+
}
|
|
98
|
+
return value;
|
|
99
|
+
}
|
|
100
|
+
function toTitleCase(value) {
|
|
101
|
+
return value.toLowerCase().split(" ").map(
|
|
102
|
+
(word) => word.split("-").map((segment) => capitalizeSegment(segment)).join("-")
|
|
103
|
+
).join(" ");
|
|
104
|
+
}
|
|
105
|
+
var CAPITALIZE_RE = /(?:^|(?<='))./gu;
|
|
106
|
+
function capitalizeSegment(segment) {
|
|
107
|
+
if (segment.length === 0) {
|
|
108
|
+
return segment;
|
|
109
|
+
}
|
|
110
|
+
return segment.replace(
|
|
111
|
+
CAPITALIZE_RE,
|
|
112
|
+
(char) => char.toUpperCase()
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
var SLUG_NON_ALNUM_RE = /[^a-z\d]+/g;
|
|
116
|
+
var SLUG_MULTI_HYPHEN_RE = /-+/g;
|
|
117
|
+
var SLUG_EDGE_HYPHEN_RE = /^-|-$/g;
|
|
118
|
+
function toSlug(value) {
|
|
119
|
+
return value.toLowerCase().replace(SLUG_NON_ALNUM_RE, "-").replace(SLUG_MULTI_HYPHEN_RE, "-").replace(SLUG_EDGE_HYPHEN_RE, "");
|
|
120
|
+
}
|
|
121
|
+
var HTML_STRIP_RE = /<[^>]*>/g;
|
|
122
|
+
function stripHtml(value) {
|
|
123
|
+
return value.replace(HTML_STRIP_RE, "");
|
|
124
|
+
}
|
|
125
|
+
var MULTI_WHITESPACE_RE = /\s+/g;
|
|
126
|
+
function collapseWhitespace(value) {
|
|
127
|
+
return value.replace(MULTI_WHITESPACE_RE, " ").trim();
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
exports.hasUppercase = hasUppercase; exports.hasLowercase = hasLowercase; exports.hasDigits = hasDigits; exports.hasSpecial = hasSpecial; exports.containsEmail = containsEmail; exports.containsUrl = containsUrl; exports.containsHtml = containsHtml; exports.maxWords = maxWords; exports.minWords = minWords; exports.maxConsecutive = maxConsecutive; exports.noSpaces = noSpaces; exports.onlyAlpha = onlyAlpha; exports.onlyNumeric = onlyNumeric; exports.onlyAlphanumeric = onlyAlphanumeric; exports.onlyAlphanumericSpaceHyphen = onlyAlphanumericSpaceHyphen; exports.onlyAlphaSpaceHyphen = onlyAlphaSpaceHyphen; exports.emptyToUndefined = emptyToUndefined; exports.toTitleCase = toTitleCase; exports.toSlug = toSlug; exports.stripHtml = stripHtml; exports.collapseWhitespace = collapseWhitespace;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// src/loaders/creditCardPrefixes.ts
|
|
2
|
+
var cache;
|
|
3
|
+
async function loadCreditCardPrefixes() {
|
|
4
|
+
if (cache !== void 0)
|
|
5
|
+
return cache;
|
|
6
|
+
const raw = (await import("./creditCardPrefixes-QP3S4ZAU.js")).default;
|
|
7
|
+
const map = /* @__PURE__ */ new Map();
|
|
8
|
+
for (const entry of raw) {
|
|
9
|
+
map.set(entry.id, {
|
|
10
|
+
name: entry.name,
|
|
11
|
+
prefixes: entry.prefixes,
|
|
12
|
+
lengths: entry.lengths
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
cache = map;
|
|
16
|
+
return cache;
|
|
17
|
+
}
|
|
18
|
+
function getCreditCardPrefixes() {
|
|
19
|
+
if (cache === void 0) {
|
|
20
|
+
throw new Error(
|
|
21
|
+
"validex: Credit card prefixes not loaded. Use parseAsync() or call preloadData() first."
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
return cache;
|
|
25
|
+
}
|
|
26
|
+
function clearCreditCardPrefixesCache() {
|
|
27
|
+
cache = void 0;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export {
|
|
31
|
+
loadCreditCardPrefixes,
|
|
32
|
+
getCreditCardPrefixes,
|
|
33
|
+
clearCreditCardPrefixesCache
|
|
34
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
// src/loaders/commonPasswords.ts
|
|
2
|
+
var cache = {
|
|
3
|
+
basic: void 0,
|
|
4
|
+
moderate: void 0,
|
|
5
|
+
strict: void 0
|
|
6
|
+
};
|
|
7
|
+
async function loadCommonPasswords(tier = "basic") {
|
|
8
|
+
const cached = cache[tier];
|
|
9
|
+
if (cached !== void 0)
|
|
10
|
+
return cached;
|
|
11
|
+
if (tier === "basic") {
|
|
12
|
+
const { default: tier12 } = await import("./passwordsTier1-OYRMLOWD.js");
|
|
13
|
+
const result2 = new Set(tier12);
|
|
14
|
+
cache.basic = result2;
|
|
15
|
+
return result2;
|
|
16
|
+
}
|
|
17
|
+
if (tier === "moderate") {
|
|
18
|
+
const { default: tier12 } = await import("./passwordsTier1-OYRMLOWD.js");
|
|
19
|
+
const { default: tier22 } = await import("./passwordsTier2-JAEO5AYY.js");
|
|
20
|
+
const result2 = /* @__PURE__ */ new Set([...tier12, ...tier22]);
|
|
21
|
+
cache.moderate = result2;
|
|
22
|
+
return result2;
|
|
23
|
+
}
|
|
24
|
+
const { default: tier1 } = await import("./passwordsTier1-OYRMLOWD.js");
|
|
25
|
+
const { default: tier2 } = await import("./passwordsTier2-JAEO5AYY.js");
|
|
26
|
+
const { default: tier3 } = await import("./passwordsTier3-E6WBK5OB.js");
|
|
27
|
+
const result = /* @__PURE__ */ new Set([...tier1, ...tier2, ...tier3]);
|
|
28
|
+
cache.strict = result;
|
|
29
|
+
return result;
|
|
30
|
+
}
|
|
31
|
+
function getCommonPasswords(tier = "basic") {
|
|
32
|
+
const cached = cache[tier];
|
|
33
|
+
if (cached === void 0) {
|
|
34
|
+
throw new Error(
|
|
35
|
+
"validex: Common passwords not loaded. Use parseAsync() or call preloadData() first."
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
return cached;
|
|
39
|
+
}
|
|
40
|
+
function clearCommonPasswordsCache() {
|
|
41
|
+
cache.basic = void 0;
|
|
42
|
+
cache.moderate = void 0;
|
|
43
|
+
cache.strict = void 0;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export {
|
|
47
|
+
loadCommonPasswords,
|
|
48
|
+
getCommonPasswords,
|
|
49
|
+
clearCommonPasswordsCache
|
|
50
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } }// src/loaders/commonPasswords.ts
|
|
2
|
+
var cache = {
|
|
3
|
+
basic: void 0,
|
|
4
|
+
moderate: void 0,
|
|
5
|
+
strict: void 0
|
|
6
|
+
};
|
|
7
|
+
async function loadCommonPasswords(tier = "basic") {
|
|
8
|
+
const cached = cache[tier];
|
|
9
|
+
if (cached !== void 0)
|
|
10
|
+
return cached;
|
|
11
|
+
if (tier === "basic") {
|
|
12
|
+
const { default: tier12 } = await Promise.resolve().then(() => _interopRequireWildcard(require("./passwordsTier1-NAZLSHKW.cjs")));
|
|
13
|
+
const result2 = new Set(tier12);
|
|
14
|
+
cache.basic = result2;
|
|
15
|
+
return result2;
|
|
16
|
+
}
|
|
17
|
+
if (tier === "moderate") {
|
|
18
|
+
const { default: tier12 } = await Promise.resolve().then(() => _interopRequireWildcard(require("./passwordsTier1-NAZLSHKW.cjs")));
|
|
19
|
+
const { default: tier22 } = await Promise.resolve().then(() => _interopRequireWildcard(require("./passwordsTier2-GYJTYGY6.cjs")));
|
|
20
|
+
const result2 = /* @__PURE__ */ new Set([...tier12, ...tier22]);
|
|
21
|
+
cache.moderate = result2;
|
|
22
|
+
return result2;
|
|
23
|
+
}
|
|
24
|
+
const { default: tier1 } = await Promise.resolve().then(() => _interopRequireWildcard(require("./passwordsTier1-NAZLSHKW.cjs")));
|
|
25
|
+
const { default: tier2 } = await Promise.resolve().then(() => _interopRequireWildcard(require("./passwordsTier2-GYJTYGY6.cjs")));
|
|
26
|
+
const { default: tier3 } = await Promise.resolve().then(() => _interopRequireWildcard(require("./passwordsTier3-BAPUFHZM.cjs")));
|
|
27
|
+
const result = /* @__PURE__ */ new Set([...tier1, ...tier2, ...tier3]);
|
|
28
|
+
cache.strict = result;
|
|
29
|
+
return result;
|
|
30
|
+
}
|
|
31
|
+
function getCommonPasswords(tier = "basic") {
|
|
32
|
+
const cached = cache[tier];
|
|
33
|
+
if (cached === void 0) {
|
|
34
|
+
throw new Error(
|
|
35
|
+
"validex: Common passwords not loaded. Use parseAsync() or call preloadData() first."
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
return cached;
|
|
39
|
+
}
|
|
40
|
+
function clearCommonPasswordsCache() {
|
|
41
|
+
cache.basic = void 0;
|
|
42
|
+
cache.moderate = void 0;
|
|
43
|
+
cache.strict = void 0;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
exports.loadCommonPasswords = loadCommonPasswords; exports.getCommonPasswords = getCommonPasswords; exports.clearCommonPasswordsCache = clearCommonPasswordsCache;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// src/loaders/countryCodes.ts
|
|
2
|
+
var cache;
|
|
3
|
+
async function loadCountryCodes() {
|
|
4
|
+
if (cache !== void 0)
|
|
5
|
+
return cache;
|
|
6
|
+
const raw = (await import("./countryCodes-YRY75MQP.js")).default;
|
|
7
|
+
const map = /* @__PURE__ */ new Map();
|
|
8
|
+
for (const entry of raw) {
|
|
9
|
+
map.set(entry.alpha2, entry);
|
|
10
|
+
}
|
|
11
|
+
cache = map;
|
|
12
|
+
return cache;
|
|
13
|
+
}
|
|
14
|
+
function getCountryCodes() {
|
|
15
|
+
if (cache === void 0) {
|
|
16
|
+
throw new Error(
|
|
17
|
+
"validex: Country codes not loaded. Use parseAsync() or call preloadData() first."
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
return cache;
|
|
21
|
+
}
|
|
22
|
+
function clearCountryCodesCache() {
|
|
23
|
+
cache = void 0;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export {
|
|
27
|
+
loadCountryCodes,
|
|
28
|
+
getCountryCodes,
|
|
29
|
+
clearCountryCodesCache
|
|
30
|
+
};
|