@brasil-interface/utils
Version:
106 lines • 3.42 kB
TypeScript
export declare class PIS {
private static readonly MOD_ALG;
private static readonly LENGTH;
private static readonly BASE_NUMERALS_LENGTH;
private static readonly VERIFIER_DIGITS_LENGTH;
private static readonly BASE_NUMERALS_START;
private static readonly BASE_NUMERALS_END;
private static readonly WEIGHTS;
private static readonly MASK_REGEX;
private static readonly MASK_PATTERN;
private static readonly MASK_SENSITIVE_PATTERN;
private static readonly VALIDATION_RULES;
/**
* PT-BR: Verifica se um número de PIS é válido.
*
* EN: Checks if a PIS number is valid.
*
* @param pis - PT-BR: O número de PIS. EN: The PIS number.
* @returns PT-BR: `true` se o número de PIS for válido. EN: `true` if the PIS number is valid.
*
* @example
* ```
* PIS.isValid("000.00000.00-0"); // false
* PIS.isValid("00000000000"); // false
* PIS.isValid("520.22242.34-4"); // true
* PIS.isValid("52022242344"); // true
* ```
*/
static isValid(pis: string | number): boolean;
/**
* PT-BR: Máscara um número de PIS.
*
* EN: Masks a PIS number.
*
* @param pis - PT-BR: O número de PIS. EN: The PIS number.
* @returns PT-BR: O número de PIS mascarado. EN: The masked PIS number.
*
* @example
* ```
* PIS.mask("520.22242.34-4"); // "520.22242.34-4"
* PIS.mask("52022242344"); // "520.22242.34-4"
* ```
*/
static mask(pis: string | number): string;
/**
* PT-BR: Máscara um número de PIS, mas oculta os dígitos finais.
*
* EN: Masks a PIS number, but hides the final digits.
*
* @param pis - PT-BR: O número de PIS. EN: The PIS number.
* @returns PT-BR: O número de PIS mascarado. EN: The masked PIS number.
*
* @example
* ```
* PIS.maskSensitive("520.22242.34-4"); // "520.22242.**-*"
* PIS.maskSensitive("52022242344"); // "520.22242.**-*"
* ```
*/
static maskSensitive(pis: string | number): string;
/**
* PT-BR: Remove a máscara de um número de PIS.
*
* EN: Removes the mask from a PIS number.
*
* @param pis - PT-BR: O número de PIS. EN: The PIS number.
* @returns PT-BR: O número de PIS sem máscara. EN: The PIS number without mask.
*
* @example
* ```
* PIS.unmask("520.22242.34-4"); // "52022242344"
* PIS.unmask("52022242344"); // "52022242344"
* ```
*/
static unmask(pis: string | number): string;
/**
* PT-BR: Gera um número de PIS válido.
*
* EN: Generates a valid PIS number.
*
* @returns PT-BR: O número de PIS gerado. EN: The generated PIS number.
*
* @example
* ```
* PIS.generate(); // "52022242344"
* ```
*/
static generate(): string;
/**
* PT-BR: Gera um número de PIS válido com máscara.
*
* EN: Generates a valid PIS number with mask.
*
* @returns PT-BR: O número de PIS gerado com máscara. EN: The generated PIS number with mask.
*
* @example
* ```
* PIS.generateMasked(); // "520.22242.34-4"
* ```
*/
static generateMasked(): string;
private static clear;
private static shouldHaveValidVerifierDigits;
private static getBaseNumerals;
private static generateVerifierDigit;
}
//# sourceMappingURL=PIS.d.ts.map