//#region src/format-cnpj/format-cnpj.d.ts /** Options of `formatCnpj`. */ export type FormatCnpjOptions = { /** Whether to left pad the value with zeros up to the number of slots in the pattern (default: `false`). */ pad?: boolean; /** Which CNPJ format to read: `1` numeric only, `2` alphanumeric (default: `1`). */ version?: 1 | 2; /** Whether to hide the first 2 digits and the 2 check digits with `*` (default: `false`, read for truthiness like `pad`). */ obfuscate?: boolean; }; /** * Formats a given CNPJ (Cadastro Nacional da Pessoa Jurídica) value according to the specified options. * * @param {string|number} value - The CNPJ value to be formatted. It can be a string or a number. * @param {FormatCnpjOptions} [options] - Optional configuration for formatting the CNPJ. * @param {boolean} options.pad - If true, the value will be padded with leading zeros if necessary. * @param {1|2} options.version - The version of the CNPJ to be sanitized. * @param {boolean} options.obfuscate - If truthy, hides the first 2 digits and the 2 check * digits. Read for truthiness, the way `pad` is, so a non-boolean such as `1` obfuscates too. * @returns {string} The formatted CNPJ string in the pattern "00.000.000/0000-00". * * @example * ```typescript * formatCnpj("12345678000195"); // "12.345.678/0001-95" * formatCnpj(12345678000195); // "12.345.678/0001-95" * formatCnpj("12345678000195", { pad: true }); // "12.345.678/0001-95" * formatCnpj("12345678", { pad: true }); // "00.000.012/3456-78" * formatCnpj("q0SLFMBD7VX439", { version: 2 }); // "Q0.SLF.MBD/7VX4-39" * formatCnpj("12345678000195", { obfuscate: true }); // "**.345.678/0001-**" * ``` * * @see Official: https://www.gov.br/receitafederal/pt-br/assuntos/orientacao-tributaria/cadastros/cnpj * @see Official: https://www.gov.br/receitafederal/pt-br/centrais-de-conteudo/publicacoes/documentos-tecnicos/cnpj/manual-dv-cnpj.pdf * @see Official: https://www.gov.br/receitafederal/pt-br/acesso-a-informacao/acoes-e-programas/programas-e-atividades/cnpj-alfanumerico */ export declare const formatCnpj: (value: string | number, options?: FormatCnpjOptions) => string; //#endregion