@indodev/toolkit 0.6.0 → 0.7.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.
Files changed (65) hide show
  1. package/dist/email-validator/index.cjs +10 -0
  2. package/dist/email-validator/index.cjs.map +1 -1
  3. package/dist/email-validator/index.d.cts +1 -1
  4. package/dist/email-validator/index.d.ts +1 -1
  5. package/dist/email-validator/index.js +10 -1
  6. package/dist/email-validator/index.js.map +1 -1
  7. package/dist/{parse-BmmsNlJt.d.cts → errors--47zprcf.d.cts} +41 -7
  8. package/dist/{parse-BmmsNlJt.d.ts → errors--47zprcf.d.ts} +41 -7
  9. package/dist/{email-validator-R9L5unIw.d.cts → errors-DdutHLae.d.cts} +23 -1
  10. package/dist/{email-validator-R9L5unIw.d.ts → errors-DdutHLae.d.ts} +23 -1
  11. package/dist/index.cjs +271 -24
  12. package/dist/index.cjs.map +1 -1
  13. package/dist/index.d.cts +7 -7
  14. package/dist/index.d.ts +7 -7
  15. package/dist/index.js +264 -25
  16. package/dist/index.js.map +1 -1
  17. package/dist/{compare-Ku_8OhuU.d.cts → mask-CToJqmrd.d.cts} +79 -1
  18. package/dist/{compare-Ku_8OhuU.d.ts → mask-CToJqmrd.d.ts} +79 -1
  19. package/dist/nik/index.cjs +21 -12
  20. package/dist/nik/index.cjs.map +1 -1
  21. package/dist/nik/index.d.cts +2 -2
  22. package/dist/nik/index.d.ts +2 -2
  23. package/dist/nik/index.js +21 -12
  24. package/dist/nik/index.js.map +1 -1
  25. package/dist/npwp/index.cjs +10 -0
  26. package/dist/npwp/index.cjs.map +1 -1
  27. package/dist/npwp/index.d.cts +23 -1
  28. package/dist/npwp/index.d.ts +23 -1
  29. package/dist/npwp/index.js +10 -1
  30. package/dist/npwp/index.js.map +1 -1
  31. package/dist/parse-B3UzEHq3.d.cts +155 -0
  32. package/dist/parse-B3UzEHq3.d.ts +155 -0
  33. package/dist/parse-DlrgrRfY.d.cts +155 -0
  34. package/dist/parse-DlrgrRfY.d.ts +155 -0
  35. package/dist/phone/index.cjs +36 -12
  36. package/dist/phone/index.cjs.map +1 -1
  37. package/dist/phone/index.d.cts +1 -1
  38. package/dist/phone/index.d.ts +1 -1
  39. package/dist/phone/index.js +36 -13
  40. package/dist/phone/index.js.map +1 -1
  41. package/dist/plate/index.cjs +57 -0
  42. package/dist/plate/index.cjs.map +1 -1
  43. package/dist/plate/index.d.cts +1 -1
  44. package/dist/plate/index.d.ts +1 -1
  45. package/dist/plate/index.js +56 -1
  46. package/dist/plate/index.js.map +1 -1
  47. package/dist/text/index.cjs +31 -8
  48. package/dist/text/index.cjs.map +1 -1
  49. package/dist/text/index.d.cts +2 -63
  50. package/dist/text/index.d.ts +2 -63
  51. package/dist/text/index.js +31 -8
  52. package/dist/text/index.js.map +1 -1
  53. package/dist/{utils-DT8-jt63.d.cts → utils-D4A4ro8M.d.cts} +21 -9
  54. package/dist/{utils-DT8-jt63.d.ts → utils-D4A4ro8M.d.ts} +21 -9
  55. package/dist/vin/index.cjs +64 -0
  56. package/dist/vin/index.cjs.map +1 -1
  57. package/dist/vin/index.d.cts +1 -1
  58. package/dist/vin/index.d.ts +1 -1
  59. package/dist/vin/index.js +63 -1
  60. package/dist/vin/index.js.map +1 -1
  61. package/package.json +1 -1
  62. package/dist/types-i5e6R0AS.d.cts +0 -39
  63. package/dist/types-i5e6R0AS.d.ts +0 -39
  64. package/dist/utils-DDVlOusI.d.cts +0 -30
  65. package/dist/utils-DDVlOusI.d.ts +0 -30
@@ -1,65 +1,4 @@
1
- import { M as MaskOptions } from '../compare-Ku_8OhuU.cjs';
2
- 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';
3
-
4
- /**
5
- * Mask sensitive text based on predefined patterns or custom configuration
6
- *
7
- * This function provides privacy-compliant data display by masking portions
8
- * of text while keeping certain parts visible. Supports multiple masking
9
- * patterns for different use cases.
10
- *
11
- * **Available Patterns:**
12
- * - `all`: Masks all characters (preserves spaces)
13
- * - `middle`: Keeps start and end characters visible, masks the middle
14
- * - `email`: Keeps first 2 chars of local part and full domain visible
15
- *
16
- * @param text - The text to mask
17
- * @param options - Masking configuration options
18
- * @returns The masked text
19
- *
20
- * @example
21
- * Mask all characters:
22
- * ```typescript
23
- * maskText('Budi Santoso', { pattern: 'all' })
24
- * // → '**** *******'
25
- *
26
- * maskText('123456789', { pattern: 'all', maskChar: '#' })
27
- * // → '#########'
28
- * ```
29
- *
30
- * @example
31
- * Mask middle portion:
32
- * ```typescript
33
- * maskText('08123456789', { pattern: 'middle', visibleStart: 4, visibleEnd: 3 })
34
- * // → '0812****789'
35
- *
36
- * maskText('ABCDEF', { pattern: 'middle' })
37
- * // → 'AB**EF' (defaults: visibleStart=2, visibleEnd=2)
38
- * ```
39
- *
40
- * @example
41
- * Mask email:
42
- * ```typescript
43
- * maskText('user@example.com', { pattern: 'email' })
44
- * // → 'us**@example.com'
45
- *
46
- * maskText('a@test.com', { pattern: 'email' })
47
- * // → 'a*@test.com'
48
- * ```
49
- *
50
- * @example
51
- * Edge cases:
52
- * ```typescript
53
- * maskText('')
54
- * // → ''
55
- *
56
- * maskText('AB', { pattern: 'middle', visibleStart: 2, visibleEnd: 2 })
57
- * // → '**' (string too short, mask all)
58
- * ```
59
- *
60
- * @public
61
- */
62
- declare function maskText(text: string, options?: MaskOptions): string;
1
+ export { C as CompareOptions, E as ExtractOptions, M as MaskOptions, o as SanitizeOptions, S as SlugifyOptions, T as TitleCaseOptions, q as TruncateOptions, c as capitalize, k as compareStrings, d as contractAbbreviation, e as expandAbbreviation, g as extractWords, j as isAlay, m as maskText, 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 '../mask-CToJqmrd.cjs';
63
2
 
64
3
  /**
65
4
  * Convert text to camelCase
@@ -479,4 +418,4 @@ declare const ACRONYMS: readonly ["DKI", "DIY", "TNI", "POLRI", "ABRI", "MPR", "
479
418
  */
480
419
  declare const ABBREVIATIONS: Record<string, string>;
481
420
 
482
- export { ABBREVIATIONS, ACRONYMS, LOWERCASE_WORDS, MaskOptions, countSyllables, maskText, toCamelCase, toPascalCase, toSnakeCase };
421
+ export { ABBREVIATIONS, ACRONYMS, LOWERCASE_WORDS, countSyllables, toCamelCase, toPascalCase, toSnakeCase };
@@ -1,65 +1,4 @@
1
- import { M as MaskOptions } from '../compare-Ku_8OhuU.js';
2
- 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';
3
-
4
- /**
5
- * Mask sensitive text based on predefined patterns or custom configuration
6
- *
7
- * This function provides privacy-compliant data display by masking portions
8
- * of text while keeping certain parts visible. Supports multiple masking
9
- * patterns for different use cases.
10
- *
11
- * **Available Patterns:**
12
- * - `all`: Masks all characters (preserves spaces)
13
- * - `middle`: Keeps start and end characters visible, masks the middle
14
- * - `email`: Keeps first 2 chars of local part and full domain visible
15
- *
16
- * @param text - The text to mask
17
- * @param options - Masking configuration options
18
- * @returns The masked text
19
- *
20
- * @example
21
- * Mask all characters:
22
- * ```typescript
23
- * maskText('Budi Santoso', { pattern: 'all' })
24
- * // → '**** *******'
25
- *
26
- * maskText('123456789', { pattern: 'all', maskChar: '#' })
27
- * // → '#########'
28
- * ```
29
- *
30
- * @example
31
- * Mask middle portion:
32
- * ```typescript
33
- * maskText('08123456789', { pattern: 'middle', visibleStart: 4, visibleEnd: 3 })
34
- * // → '0812****789'
35
- *
36
- * maskText('ABCDEF', { pattern: 'middle' })
37
- * // → 'AB**EF' (defaults: visibleStart=2, visibleEnd=2)
38
- * ```
39
- *
40
- * @example
41
- * Mask email:
42
- * ```typescript
43
- * maskText('user@example.com', { pattern: 'email' })
44
- * // → 'us**@example.com'
45
- *
46
- * maskText('a@test.com', { pattern: 'email' })
47
- * // → 'a*@test.com'
48
- * ```
49
- *
50
- * @example
51
- * Edge cases:
52
- * ```typescript
53
- * maskText('')
54
- * // → ''
55
- *
56
- * maskText('AB', { pattern: 'middle', visibleStart: 2, visibleEnd: 2 })
57
- * // → '**' (string too short, mask all)
58
- * ```
59
- *
60
- * @public
61
- */
62
- declare function maskText(text: string, options?: MaskOptions): string;
1
+ export { C as CompareOptions, E as ExtractOptions, M as MaskOptions, o as SanitizeOptions, S as SlugifyOptions, T as TitleCaseOptions, q as TruncateOptions, c as capitalize, k as compareStrings, d as contractAbbreviation, e as expandAbbreviation, g as extractWords, j as isAlay, m as maskText, 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 '../mask-CToJqmrd.js';
63
2
 
64
3
  /**
65
4
  * Convert text to camelCase
@@ -479,4 +418,4 @@ declare const ACRONYMS: readonly ["DKI", "DIY", "TNI", "POLRI", "ABRI", "MPR", "
479
418
  */
480
419
  declare const ABBREVIATIONS: Record<string, string>;
481
420
 
482
- export { ABBREVIATIONS, ACRONYMS, LOWERCASE_WORDS, MaskOptions, countSyllables, maskText, toCamelCase, toPascalCase, toSnakeCase };
421
+ export { ABBREVIATIONS, ACRONYMS, LOWERCASE_WORDS, countSyllables, toCamelCase, toPascalCase, toSnakeCase };
@@ -1705,24 +1705,44 @@ function maskText(text, options) {
1705
1705
  if (!text) return text;
1706
1706
  const {
1707
1707
  pattern = "middle",
1708
- maskChar = "*",
1709
- visibleStart = 2,
1710
- visibleEnd = 2
1708
+ maskChar,
1709
+ visibleStart,
1710
+ visibleEnd,
1711
+ separator,
1712
+ start,
1713
+ end,
1714
+ char
1711
1715
  } = options || {};
1712
- switch (pattern) {
1716
+ const hasLegacyOptions = start !== void 0 || end !== void 0 || char !== void 0;
1717
+ if (hasLegacyOptions) {
1718
+ console.warn(
1719
+ "[DEPRECATED] Mask options start/end/char are deprecated. Use visibleStart/visibleEnd/maskChar instead. These old names will be removed in v1.0.0."
1720
+ );
1721
+ }
1722
+ const effectivePattern = pattern || "middle";
1723
+ const effectiveStart = visibleStart !== void 0 ? visibleStart : start !== void 0 ? start : 2;
1724
+ const effectiveEnd = visibleEnd !== void 0 ? visibleEnd : end !== void 0 ? end : 2;
1725
+ const effectiveChar = maskChar !== void 0 ? maskChar : char !== void 0 ? char : "*";
1726
+ switch (effectivePattern) {
1713
1727
  case "all":
1714
- return maskAll(text, maskChar);
1728
+ return maskAll(text, effectiveChar);
1715
1729
  case "email":
1716
- return maskEmail(text, maskChar);
1730
+ return maskEmail(text, effectiveChar);
1717
1731
  case "middle":
1718
1732
  default:
1719
- return maskMiddle(text, maskChar, visibleStart, visibleEnd);
1733
+ return maskMiddle(
1734
+ text,
1735
+ effectiveChar,
1736
+ effectiveStart,
1737
+ effectiveEnd,
1738
+ separator
1739
+ );
1720
1740
  }
1721
1741
  }
1722
1742
  function maskAll(text, maskChar) {
1723
1743
  return text.split("").map((char) => char === " " ? " " : maskChar).join("");
1724
1744
  }
1725
- function maskMiddle(text, maskChar, visibleStart, visibleEnd) {
1745
+ function maskMiddle(text, maskChar, visibleStart, visibleEnd, separator) {
1726
1746
  const length = text.length;
1727
1747
  const totalVisible = visibleStart + visibleEnd;
1728
1748
  if (length < totalVisible) {
@@ -1731,6 +1751,9 @@ function maskMiddle(text, maskChar, visibleStart, visibleEnd) {
1731
1751
  const start = text.slice(0, visibleStart);
1732
1752
  const middle = maskChar.repeat(length - totalVisible);
1733
1753
  const end = text.slice(length - visibleEnd);
1754
+ if (separator) {
1755
+ return `${start}${separator}${middle}${separator}${end}`;
1756
+ }
1734
1757
  return start + middle + end;
1735
1758
  }
1736
1759
  function maskEmail(text, maskChar) {