/** * Validates an Indonesian NPWP (Nomor Pokok Wajib Pajak). * * Supports both 15-digit (standard) and 16-digit (new NIK-based) formats. * * @param npwp - The NPWP string to validate * @returns `true` if valid, `false` otherwise * * @example * ```typescript * validateNPWP('01.234.567.8-012.000'); // true * validateNPWP('012345678012000'); // true * ``` */ declare function validateNPWP(npwp: string): boolean; /** * Information extracted from an NPWP string. */ interface NPWPInfo { /** The full 15 or 16 digit numeric string */ npwp: string; /** Taxpayer type (e.g., 01-03 for individual, etc.) */ type: string; /** Serial number */ serial: string; /** Checksum digit */ checksum: string; /** Tax office code */ taxOfficeCode: string; /** Branch code (usually 000 for head office) */ branchCode: string; /** Whether the NPWP is a 16-digit (NIK-based) NPWP */ isNikBased: boolean; } /** * Options for NPWP masking. */ interface MaskOptions { /** Number of characters to keep visible at the start (default: 2) */ visibleStart?: number; /** Number of characters to keep visible at the end (default: 3) */ visibleEnd?: number; /** Character to use for masking (default: '*') */ maskChar?: string; } /** * Formats an NPWP string into standard Indonesian format (99.999.999.9-999.999). * * @param npwp - The NPWP string to format * @returns Formatted NPWP string, or original if invalid * * @example * ```typescript * formatNPWP('012345678012000'); // '01.234.567.8-012.000' * ``` */ declare function formatNPWP(npwp: string): string; /** * Parses an NPWP string into its components. * * @param npwp - The NPWP string to parse * @returns NPWPInfo object, or null if invalid */ declare function parseNPWP(npwp: string): NPWPInfo | null; /** * Masks an NPWP string for privacy. * * @param npwp - The NPWP string to mask * @param options - Masking options * @returns Masked NPWP string */ declare function maskNPWP(npwp: string, options?: MaskOptions): string; /** * Cleans an NPWP by removing all non-digit characters. * * @param npwp - The NPWP to clean * @returns Cleaned NPWP string (digits only), or empty string if invalid * * @example * ```typescript * cleanNPWP('01.234.567.8-012.345'); // '0123456789012345' * cleanNPWP('01-234-567-8-012-345'); // '0123456789012345' * cleanNPWP(''); // '' * ``` * * @public */ declare function cleanNPWP(npwp: string): string; /** * Checks if an NPWP is based on NIK (Nomor Induk Kependudukan). * * NIK-based NPWPs start with the same 16 digits as the holder's NIK. * This is the newer format introduced for individual taxpayers. * * @param npwp - The NPWP to check * @returns true if NIK-based NPWP, false otherwise * * @example * ```typescript * isNIKBasedNPWP('3201234567890003'); // true (16 digits, NIK-based) * isNIKBasedNPWP('012345678012345'); // true (16 digits, NIK-based) * isNIKBasedNPWP('091234567012000'); // false (15 digits, standard) * isNIKBasedNPWP('invalid'); // false * ``` * * @public */ declare function isNIKBasedNPWP(npwp: string): boolean; /** * Error thrown when an invalid NPWP is provided to a function. * Extends native Error with a `code` property for programmatic error handling. * * @example * ```typescript * try { * requireNPWP('invalid'); * } catch (error) { * if (error instanceof InvalidNPWPError) { * console.log(error.code); // 'INVALID_NPWP' * } * } * ``` * * @public */ declare class InvalidNPWPError extends Error { readonly code: "INVALID_NPWP"; constructor(message?: string); } export { InvalidNPWPError, type MaskOptions, type NPWPInfo, cleanNPWP, formatNPWP, isNIKBasedNPWP, maskNPWP, parseNPWP, validateNPWP };