@indodev/toolkit 0.3.1 → 0.3.3
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/dist/{compare-CZadJMGl.d.cts → compare-Ku_8OhuU.d.cts} +25 -1
- package/dist/{compare-CZadJMGl.d.ts → compare-Ku_8OhuU.d.ts} +25 -1
- package/dist/email-validator/index.cjs +83 -0
- package/dist/email-validator/index.cjs.map +1 -0
- package/dist/email-validator/index.d.cts +13 -0
- package/dist/email-validator/index.d.ts +13 -0
- package/dist/email-validator/index.js +76 -0
- package/dist/email-validator/index.js.map +1 -0
- package/dist/email-validator-R9L5unIw.d.cts +120 -0
- package/dist/email-validator-R9L5unIw.d.ts +120 -0
- package/dist/index.cjs +77 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +74 -1
- package/dist/index.js.map +1 -1
- package/dist/text/index.cjs +110 -0
- package/dist/text/index.cjs.map +1 -1
- package/dist/text/index.d.cts +200 -2
- package/dist/text/index.d.ts +200 -2
- package/dist/text/index.js +106 -1
- package/dist/text/index.js.map +1 -1
- package/package.json +11 -1
package/dist/index.d.cts
CHANGED
|
@@ -3,5 +3,6 @@ export { PhoneFormat, PhoneInfo, MaskOptions as PhoneMaskOptions, cleanPhoneNumb
|
|
|
3
3
|
export { NPWPInfo, MaskOptions as NPWPMaskOptions, formatNPWP, maskNPWP, parseNPWP, validateNPWP } from './npwp/index.cjs';
|
|
4
4
|
export { f as formatPlate, g as getRegionFromPlate, v as validatePlate } from './utils-DDVlOusI.cjs';
|
|
5
5
|
export { V as VINOptions, a as VINValidationResult, v as validateVIN } from './types-i5e6R0AS.cjs';
|
|
6
|
+
export { c as EmailInfo, b as EmailMaskOptions, E as EmailValidationOptions, a as EmailValidationResult, g as getEmailInfo, m as maskEmail, n as normalizeEmail, v as validateEmail } from './email-validator-R9L5unIw.cjs';
|
|
6
7
|
export { RupiahOptions, WordOptions, addRupiahSymbol, calculateTax, formatAccounting, formatCompact, formatRupiah, parseRupiah, roundToClean, toWords } from './currency/index.cjs';
|
|
7
|
-
export { C as CompareOptions, E as ExtractOptions, m as SanitizeOptions, S as SlugifyOptions, T as TitleCaseOptions, o as TruncateOptions, c as capitalize, k as compareStrings, d as contractAbbreviation, e as expandAbbreviation, g as extractWords, j as isAlay, n as normalizeWhitespace, p as profanityFilter, r as removeAccents, h as removeStopwords, b as sanitize, l as similarity, s as slugify, i as toFormal, a as toSentenceCase, t as toTitleCase, f as truncate } from './compare-
|
|
8
|
+
export { C as CompareOptions, E as ExtractOptions, m as SanitizeOptions, S as SlugifyOptions, T as TitleCaseOptions, o as TruncateOptions, c as capitalize, k as compareStrings, d as contractAbbreviation, e as expandAbbreviation, g as extractWords, j as isAlay, n as normalizeWhitespace, p as profanityFilter, r as removeAccents, h as removeStopwords, b as sanitize, l as similarity, s as slugify, i as toFormal, a as toSentenceCase, t as toTitleCase, f as truncate } from './compare-Ku_8OhuU.cjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -3,5 +3,6 @@ export { PhoneFormat, PhoneInfo, MaskOptions as PhoneMaskOptions, cleanPhoneNumb
|
|
|
3
3
|
export { NPWPInfo, MaskOptions as NPWPMaskOptions, formatNPWP, maskNPWP, parseNPWP, validateNPWP } from './npwp/index.js';
|
|
4
4
|
export { f as formatPlate, g as getRegionFromPlate, v as validatePlate } from './utils-DDVlOusI.js';
|
|
5
5
|
export { V as VINOptions, a as VINValidationResult, v as validateVIN } from './types-i5e6R0AS.js';
|
|
6
|
+
export { c as EmailInfo, b as EmailMaskOptions, E as EmailValidationOptions, a as EmailValidationResult, g as getEmailInfo, m as maskEmail, n as normalizeEmail, v as validateEmail } from './email-validator-R9L5unIw.js';
|
|
6
7
|
export { RupiahOptions, WordOptions, addRupiahSymbol, calculateTax, formatAccounting, formatCompact, formatRupiah, parseRupiah, roundToClean, toWords } from './currency/index.js';
|
|
7
|
-
export { C as CompareOptions, E as ExtractOptions, m as SanitizeOptions, S as SlugifyOptions, T as TitleCaseOptions, o as TruncateOptions, c as capitalize, k as compareStrings, d as contractAbbreviation, e as expandAbbreviation, g as extractWords, j as isAlay, n as normalizeWhitespace, p as profanityFilter, r as removeAccents, h as removeStopwords, b as sanitize, l as similarity, s as slugify, i as toFormal, a as toSentenceCase, t as toTitleCase, f as truncate } from './compare-
|
|
8
|
+
export { C as CompareOptions, E as ExtractOptions, m as SanitizeOptions, S as SlugifyOptions, T as TitleCaseOptions, o as TruncateOptions, c as capitalize, k as compareStrings, d as contractAbbreviation, e as expandAbbreviation, g as extractWords, j as isAlay, n as normalizeWhitespace, p as profanityFilter, r as removeAccents, h as removeStopwords, b as sanitize, l as similarity, s as slugify, i as toFormal, a as toSentenceCase, t as toTitleCase, f as truncate } from './compare-Ku_8OhuU.js';
|
package/dist/index.js
CHANGED
|
@@ -1249,6 +1249,79 @@ function validateVIN(vin) {
|
|
|
1249
1249
|
return actualCheckDigit === expectedCheckDigit;
|
|
1250
1250
|
}
|
|
1251
1251
|
|
|
1252
|
+
// src/email-validator/constants.ts
|
|
1253
|
+
var EMAIL_REGEX = /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,253}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,253}[a-zA-Z0-9])?)*$/;
|
|
1254
|
+
var DISPOSABLE_DOMAINS = [
|
|
1255
|
+
"mailinator.com",
|
|
1256
|
+
"10minutemail.com",
|
|
1257
|
+
"temp-mail.org",
|
|
1258
|
+
"guerrillamail.com"
|
|
1259
|
+
];
|
|
1260
|
+
|
|
1261
|
+
// src/email-validator/email-validator.ts
|
|
1262
|
+
var COMMON_PROVIDERS = ["gmail.com", "yahoo.com", "outlook.com", "hotmail.com", "icloud.com"];
|
|
1263
|
+
var MAX_EMAIL_LENGTH = 254;
|
|
1264
|
+
function validateEmail(email, options) {
|
|
1265
|
+
if (!email || typeof email !== "string") {
|
|
1266
|
+
return false;
|
|
1267
|
+
}
|
|
1268
|
+
const trimmedEmail = email.trim().toLowerCase();
|
|
1269
|
+
if (trimmedEmail.length > MAX_EMAIL_LENGTH) {
|
|
1270
|
+
return false;
|
|
1271
|
+
}
|
|
1272
|
+
const parts = trimmedEmail.split("@");
|
|
1273
|
+
if (parts.length !== 2) {
|
|
1274
|
+
return false;
|
|
1275
|
+
}
|
|
1276
|
+
const [username, domain] = parts;
|
|
1277
|
+
if (!username || !domain) {
|
|
1278
|
+
return false;
|
|
1279
|
+
}
|
|
1280
|
+
if (username.length > 64) {
|
|
1281
|
+
return false;
|
|
1282
|
+
}
|
|
1283
|
+
if (username.includes("..") || username.startsWith(".") || username.endsWith(".") || domain.startsWith(".") || domain.endsWith(".") || domain.includes("..")) {
|
|
1284
|
+
return false;
|
|
1285
|
+
}
|
|
1286
|
+
if (!EMAIL_REGEX.test(trimmedEmail)) {
|
|
1287
|
+
return false;
|
|
1288
|
+
}
|
|
1289
|
+
if (options?.blockDisposable) {
|
|
1290
|
+
if (DISPOSABLE_DOMAINS.includes(domain)) {
|
|
1291
|
+
return false;
|
|
1292
|
+
}
|
|
1293
|
+
}
|
|
1294
|
+
return true;
|
|
1295
|
+
}
|
|
1296
|
+
function getEmailInfo(email) {
|
|
1297
|
+
if (!validateEmail(email)) return null;
|
|
1298
|
+
const [username, domain] = email.trim().toLowerCase().split("@");
|
|
1299
|
+
return {
|
|
1300
|
+
username,
|
|
1301
|
+
domain,
|
|
1302
|
+
isCommonProvider: COMMON_PROVIDERS.includes(domain),
|
|
1303
|
+
isDisposable: DISPOSABLE_DOMAINS.includes(domain)
|
|
1304
|
+
};
|
|
1305
|
+
}
|
|
1306
|
+
function maskEmail(email, options) {
|
|
1307
|
+
if (!validateEmail(email)) return email;
|
|
1308
|
+
const { visibleStart = 1, visibleEnd = 1, maskChar = "*" } = options || {};
|
|
1309
|
+
const [username, domain] = email.split("@");
|
|
1310
|
+
if (username.length <= 3) {
|
|
1311
|
+
return `${username[0]}${maskChar.repeat(3)}@${domain}`;
|
|
1312
|
+
}
|
|
1313
|
+
const maskedLength = username.length - (visibleStart + visibleEnd);
|
|
1314
|
+
if (maskedLength <= 0) {
|
|
1315
|
+
return `${username[0]}${maskChar.repeat(3)}@${domain}`;
|
|
1316
|
+
}
|
|
1317
|
+
const start = username.slice(0, visibleStart);
|
|
1318
|
+
const end = username.slice(username.length - visibleEnd);
|
|
1319
|
+
return `${start}${maskChar.repeat(maskedLength)}${end}@${domain}`;
|
|
1320
|
+
}
|
|
1321
|
+
function normalizeEmail(email) {
|
|
1322
|
+
return email.trim().toLowerCase();
|
|
1323
|
+
}
|
|
1324
|
+
|
|
1252
1325
|
// src/currency/format.ts
|
|
1253
1326
|
function formatRupiah(amount, options) {
|
|
1254
1327
|
const {
|
|
@@ -3207,6 +3280,6 @@ function similarity(str1, str2) {
|
|
|
3207
3280
|
return 1 - distance / maxLength;
|
|
3208
3281
|
}
|
|
3209
3282
|
|
|
3210
|
-
export { addRupiahSymbol, calculateTax, capitalize2 as capitalize, cleanPhoneNumber, compareStrings, contractAbbreviation, expandAbbreviation, extractWords, formatAccounting, formatBirthDate, formatCompact, formatNIK, formatNPWP, formatPhoneNumber, formatPlate, formatRupiah, generateSmsLink, generateTelLink, generateWALink, getAge, getOperator, getRegionFromPlate, isAlay, isLandlineNumber, isMobileNumber, isProvider, isValidForBirthDate, isValidForGender, maskNIK, maskNPWP, maskPhoneNumber, normalizeWhitespace, parseNIK, parseNPWP, parsePhoneNumber, parseRupiah, profanityFilter, removeAccents, removeStopwords, roundToClean, sanitize, similarity, slugify, toE164, toFormal, toInternational, toNational, toSentenceCase, toTitleCase, toWords, truncate, validateNIK, validateNPWP, validatePhoneNumber, validatePlate, validateVIN };
|
|
3283
|
+
export { addRupiahSymbol, calculateTax, capitalize2 as capitalize, cleanPhoneNumber, compareStrings, contractAbbreviation, expandAbbreviation, extractWords, formatAccounting, formatBirthDate, formatCompact, formatNIK, formatNPWP, formatPhoneNumber, formatPlate, formatRupiah, generateSmsLink, generateTelLink, generateWALink, getAge, getEmailInfo, getOperator, getRegionFromPlate, isAlay, isLandlineNumber, isMobileNumber, isProvider, isValidForBirthDate, isValidForGender, maskEmail, maskNIK, maskNPWP, maskPhoneNumber, normalizeEmail, normalizeWhitespace, parseNIK, parseNPWP, parsePhoneNumber, parseRupiah, profanityFilter, removeAccents, removeStopwords, roundToClean, sanitize, similarity, slugify, toE164, toFormal, toInternational, toNational, toSentenceCase, toTitleCase, toWords, truncate, validateEmail, validateNIK, validateNPWP, validatePhoneNumber, validatePlate, validateVIN };
|
|
3211
3284
|
//# sourceMappingURL=index.js.map
|
|
3212
3285
|
//# sourceMappingURL=index.js.map
|