@indodev/toolkit 0.2.0 → 0.3.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/dist/index.d.cts CHANGED
@@ -1,4 +1,110 @@
1
- export { NIKInfo, MaskOptions as NIKMaskOptions, formatNIK, maskNIK, parseNIK, validateNIK } from './nik/index.cjs';
2
- export { PhoneFormat, PhoneInfo, MaskOptions as PhoneMaskOptions, cleanPhoneNumber, formatPhoneNumber, getOperator, isLandlineNumber, isMobileNumber, maskPhoneNumber, parsePhoneNumber, toE164, toInternational, toNational, validatePhoneNumber } from './phone/index.cjs';
3
- export { R as RupiahOptions, W as WordOptions, a as formatCompact, f as formatRupiah, p as parseRupiah, t as toWords } from './words-Dy8iYkbv.cjs';
4
- export { C as CompareOptions, E as ExtractOptions, j as SanitizeOptions, S as SlugifyOptions, T as TitleCaseOptions, k as TruncateOptions, c as capitalize, h as compareStrings, d as contractAbbreviation, e as expandAbbreviation, g as extractWords, n as normalizeWhitespace, r as removeAccents, b as sanitize, i as similarity, s as slugify, a as toSentenceCase, t as toTitleCase, f as truncate } from './compare-B1MKSOWV.cjs';
1
+ export { NIKInfo, MaskOptions as NIKMaskOptions, formatBirthDate, formatNIK, getAge, isValidForBirthDate, isValidForGender, maskNIK, parseNIK, validateNIK } from './nik/index.cjs';
2
+ export { PhoneFormat, PhoneInfo, MaskOptions as PhoneMaskOptions, cleanPhoneNumber, formatPhoneNumber, generateSmsLink, generateTelLink, generateWALink, getOperator, isLandlineNumber, isMobileNumber, isProvider, maskPhoneNumber, parsePhoneNumber, toE164, toInternational, toNational, validatePhoneNumber } from './phone/index.cjs';
3
+ export { RupiahOptions, WordOptions, addRupiahSymbol, calculateTax, formatAccounting, formatCompact, formatRupiah, parseRupiah, roundToClean, toWords } from './currency/index.cjs';
4
+ 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, j as extractWords, i as isAlay, n as normalizeWhitespace, p as profanityFilter, r as removeAccents, f as removeStopwords, b as sanitize, l as similarity, s as slugify, g as toFormal, a as toSentenceCase, t as toTitleCase, h as truncate } from './compare-BIodyGn7.cjs';
5
+
6
+ /**
7
+ * Validates an Indonesian NPWP (Nomor Pokok Wajib Pajak).
8
+ *
9
+ * Supports both 15-digit (standard) and 16-digit (new NIK-based) formats.
10
+ *
11
+ * @param npwp - The NPWP string to validate
12
+ * @returns `true` if valid, `false` otherwise
13
+ *
14
+ * @example
15
+ * ```typescript
16
+ * validateNPWP('01.234.567.8-012.000'); // true
17
+ * validateNPWP('012345678012000'); // true
18
+ * ```
19
+ */
20
+ declare function validateNPWP(npwp: string): boolean;
21
+
22
+ /**
23
+ * Information extracted from an NPWP string.
24
+ */
25
+ interface NPWPInfo {
26
+ /** The full 15 or 16 digit numeric string */
27
+ npwp: string;
28
+ /** Taxpayer type (e.g., 01-03 for individual, etc.) */
29
+ type: string;
30
+ /** Serial number */
31
+ serial: string;
32
+ /** Checksum digit */
33
+ checksum: string;
34
+ /** Tax office code */
35
+ taxOfficeCode: string;
36
+ /** Branch code (usually 000 for head office) */
37
+ branchCode: string;
38
+ /** Whether the NPWP is a 16-digit (NIK-based) NPWP */
39
+ isNikBased: boolean;
40
+ }
41
+ /**
42
+ * Options for NPWP masking.
43
+ */
44
+ interface MaskOptions {
45
+ /** Number of characters to keep visible at the start (default: 2) */
46
+ visibleStart?: number;
47
+ /** Number of characters to keep visible at the end (default: 3) */
48
+ visibleEnd?: number;
49
+ /** Character to use for masking (default: '*') */
50
+ maskChar?: string;
51
+ }
52
+
53
+ /**
54
+ * Formats an NPWP string into standard Indonesian format (99.999.999.9-999.999).
55
+ *
56
+ * @param npwp - The NPWP string to format
57
+ * @returns Formatted NPWP string, or original if invalid
58
+ *
59
+ * @example
60
+ * ```typescript
61
+ * formatNPWP('012345678012000'); // '01.234.567.8-012.000'
62
+ * ```
63
+ */
64
+ declare function formatNPWP(npwp: string): string;
65
+ /**
66
+ * Parses an NPWP string into its components.
67
+ *
68
+ * @param npwp - The NPWP string to parse
69
+ * @returns NPWPInfo object, or null if invalid
70
+ */
71
+ declare function parseNPWP(npwp: string): NPWPInfo | null;
72
+ /**
73
+ * Masks an NPWP string for privacy.
74
+ *
75
+ * @param npwp - The NPWP string to mask
76
+ * @param options - Masking options
77
+ * @returns Masked NPWP string
78
+ */
79
+ declare function maskNPWP(npwp: string, options?: MaskOptions): string;
80
+
81
+ /**
82
+ * Validates an Indonesian license plate number format.
83
+ * Format: [1-2 letters] [1-4 digits] [1-3 letters]
84
+ *
85
+ * @param plate - The plate number string to validate
86
+ * @returns `true` if valid, `false` otherwise
87
+ *
88
+ * @example
89
+ * ```typescript
90
+ * validatePlate('B 1234 ABC'); // true
91
+ * validatePlate('AB 1 CD'); // true
92
+ * ```
93
+ */
94
+ declare function validatePlate(plate: string): boolean;
95
+ /**
96
+ * Gets the region name from a license plate number.
97
+ *
98
+ * @param plate - The plate number
99
+ * @returns Region name or null if not found
100
+ */
101
+ declare function getRegionFromPlate(plate: string): string | null;
102
+ /**
103
+ * Formats a license plate number with spaces (e.g., B 1234 ABC).
104
+ *
105
+ * @param plate - The plate number
106
+ * @returns Formatted plate string
107
+ */
108
+ declare function formatPlate(plate: string): string;
109
+
110
+ export { type NPWPInfo, type MaskOptions as NPWPMaskOptions, formatNPWP, formatPlate, getRegionFromPlate, maskNPWP, parseNPWP, validateNPWP, validatePlate };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,110 @@
1
- export { NIKInfo, MaskOptions as NIKMaskOptions, formatNIK, maskNIK, parseNIK, validateNIK } from './nik/index.js';
2
- export { PhoneFormat, PhoneInfo, MaskOptions as PhoneMaskOptions, cleanPhoneNumber, formatPhoneNumber, getOperator, isLandlineNumber, isMobileNumber, maskPhoneNumber, parsePhoneNumber, toE164, toInternational, toNational, validatePhoneNumber } from './phone/index.js';
3
- export { R as RupiahOptions, W as WordOptions, a as formatCompact, f as formatRupiah, p as parseRupiah, t as toWords } from './words-Dy8iYkbv.js';
4
- export { C as CompareOptions, E as ExtractOptions, j as SanitizeOptions, S as SlugifyOptions, T as TitleCaseOptions, k as TruncateOptions, c as capitalize, h as compareStrings, d as contractAbbreviation, e as expandAbbreviation, g as extractWords, n as normalizeWhitespace, r as removeAccents, b as sanitize, i as similarity, s as slugify, a as toSentenceCase, t as toTitleCase, f as truncate } from './compare-B1MKSOWV.js';
1
+ export { NIKInfo, MaskOptions as NIKMaskOptions, formatBirthDate, formatNIK, getAge, isValidForBirthDate, isValidForGender, maskNIK, parseNIK, validateNIK } from './nik/index.js';
2
+ export { PhoneFormat, PhoneInfo, MaskOptions as PhoneMaskOptions, cleanPhoneNumber, formatPhoneNumber, generateSmsLink, generateTelLink, generateWALink, getOperator, isLandlineNumber, isMobileNumber, isProvider, maskPhoneNumber, parsePhoneNumber, toE164, toInternational, toNational, validatePhoneNumber } from './phone/index.js';
3
+ export { RupiahOptions, WordOptions, addRupiahSymbol, calculateTax, formatAccounting, formatCompact, formatRupiah, parseRupiah, roundToClean, toWords } from './currency/index.js';
4
+ 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, j as extractWords, i as isAlay, n as normalizeWhitespace, p as profanityFilter, r as removeAccents, f as removeStopwords, b as sanitize, l as similarity, s as slugify, g as toFormal, a as toSentenceCase, t as toTitleCase, h as truncate } from './compare-BIodyGn7.js';
5
+
6
+ /**
7
+ * Validates an Indonesian NPWP (Nomor Pokok Wajib Pajak).
8
+ *
9
+ * Supports both 15-digit (standard) and 16-digit (new NIK-based) formats.
10
+ *
11
+ * @param npwp - The NPWP string to validate
12
+ * @returns `true` if valid, `false` otherwise
13
+ *
14
+ * @example
15
+ * ```typescript
16
+ * validateNPWP('01.234.567.8-012.000'); // true
17
+ * validateNPWP('012345678012000'); // true
18
+ * ```
19
+ */
20
+ declare function validateNPWP(npwp: string): boolean;
21
+
22
+ /**
23
+ * Information extracted from an NPWP string.
24
+ */
25
+ interface NPWPInfo {
26
+ /** The full 15 or 16 digit numeric string */
27
+ npwp: string;
28
+ /** Taxpayer type (e.g., 01-03 for individual, etc.) */
29
+ type: string;
30
+ /** Serial number */
31
+ serial: string;
32
+ /** Checksum digit */
33
+ checksum: string;
34
+ /** Tax office code */
35
+ taxOfficeCode: string;
36
+ /** Branch code (usually 000 for head office) */
37
+ branchCode: string;
38
+ /** Whether the NPWP is a 16-digit (NIK-based) NPWP */
39
+ isNikBased: boolean;
40
+ }
41
+ /**
42
+ * Options for NPWP masking.
43
+ */
44
+ interface MaskOptions {
45
+ /** Number of characters to keep visible at the start (default: 2) */
46
+ visibleStart?: number;
47
+ /** Number of characters to keep visible at the end (default: 3) */
48
+ visibleEnd?: number;
49
+ /** Character to use for masking (default: '*') */
50
+ maskChar?: string;
51
+ }
52
+
53
+ /**
54
+ * Formats an NPWP string into standard Indonesian format (99.999.999.9-999.999).
55
+ *
56
+ * @param npwp - The NPWP string to format
57
+ * @returns Formatted NPWP string, or original if invalid
58
+ *
59
+ * @example
60
+ * ```typescript
61
+ * formatNPWP('012345678012000'); // '01.234.567.8-012.000'
62
+ * ```
63
+ */
64
+ declare function formatNPWP(npwp: string): string;
65
+ /**
66
+ * Parses an NPWP string into its components.
67
+ *
68
+ * @param npwp - The NPWP string to parse
69
+ * @returns NPWPInfo object, or null if invalid
70
+ */
71
+ declare function parseNPWP(npwp: string): NPWPInfo | null;
72
+ /**
73
+ * Masks an NPWP string for privacy.
74
+ *
75
+ * @param npwp - The NPWP string to mask
76
+ * @param options - Masking options
77
+ * @returns Masked NPWP string
78
+ */
79
+ declare function maskNPWP(npwp: string, options?: MaskOptions): string;
80
+
81
+ /**
82
+ * Validates an Indonesian license plate number format.
83
+ * Format: [1-2 letters] [1-4 digits] [1-3 letters]
84
+ *
85
+ * @param plate - The plate number string to validate
86
+ * @returns `true` if valid, `false` otherwise
87
+ *
88
+ * @example
89
+ * ```typescript
90
+ * validatePlate('B 1234 ABC'); // true
91
+ * validatePlate('AB 1 CD'); // true
92
+ * ```
93
+ */
94
+ declare function validatePlate(plate: string): boolean;
95
+ /**
96
+ * Gets the region name from a license plate number.
97
+ *
98
+ * @param plate - The plate number
99
+ * @returns Region name or null if not found
100
+ */
101
+ declare function getRegionFromPlate(plate: string): string | null;
102
+ /**
103
+ * Formats a license plate number with spaces (e.g., B 1234 ABC).
104
+ *
105
+ * @param plate - The plate number
106
+ * @returns Formatted plate string
107
+ */
108
+ declare function formatPlate(plate: string): string;
109
+
110
+ export { type NPWPInfo, type MaskOptions as NPWPMaskOptions, formatNPWP, formatPlate, getRegionFromPlate, maskNPWP, parseNPWP, validateNPWP, validatePlate };