@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/{compare-B1MKSOWV.d.cts → compare-BIodyGn7.d.cts} +54 -1
- package/dist/{compare-B1MKSOWV.d.ts → compare-BIodyGn7.d.ts} +54 -1
- package/dist/currency/index.cjs +23 -0
- package/dist/currency/index.cjs.map +1 -1
- package/dist/currency/index.d.cts +367 -3
- package/dist/currency/index.d.ts +367 -3
- package/dist/currency/index.js +21 -1
- package/dist/currency/index.js.map +1 -1
- package/dist/index.cjs +1117 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +110 -4
- package/dist/index.d.ts +110 -4
- package/dist/index.js +1095 -1
- package/dist/index.js.map +1 -1
- package/dist/nik/index.cjs +44 -0
- package/dist/nik/index.cjs.map +1 -1
- package/dist/nik/index.d.cts +44 -1
- package/dist/nik/index.d.ts +44 -1
- package/dist/nik/index.js +41 -1
- package/dist/nik/index.js.map +1 -1
- package/dist/phone/index.cjs +42 -0
- package/dist/phone/index.cjs.map +1 -1
- package/dist/phone/index.d.cts +57 -1
- package/dist/phone/index.d.ts +57 -1
- package/dist/phone/index.js +39 -1
- package/dist/phone/index.js.map +1 -1
- package/dist/text/index.cjs +811 -0
- package/dist/text/index.cjs.map +1 -1
- package/dist/text/index.d.cts +1 -1
- package/dist/text/index.d.ts +1 -1
- package/dist/text/index.js +808 -1
- package/dist/text/index.js.map +1 -1
- package/package.json +38 -18
- package/LICENCE +0 -21
- package/dist/words-Dy8iYkbv.d.cts +0 -333
- package/dist/words-Dy8iYkbv.d.ts +0 -333
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 {
|
|
4
|
-
export { C as CompareOptions, E as ExtractOptions,
|
|
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 {
|
|
4
|
-
export { C as CompareOptions, E as ExtractOptions,
|
|
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 };
|