brazilian-values
Version:
Validates and formats brazilian values, like money (BRL), CPF, CNPJ, dates etc.
18 lines (17 loc) • 495 B
TypeScript
/**
* Progressively formats a `string` into a RG.
* @example ```js
* formatToRG('00000000A', 'SP')
* //=> '00.000.000-A'
*
* formatToRG('00.00.0000-0', 'RJ')
* //=> '00.000.000-0'
*
* formatToRG('MG-14.808.688', 'MG')
* //=> 'MG-14.808.688'
* ```
* @param value - A `string` representing an RG.
* @param state - Brazilian state which defines RG format.
*/
declare const formatToRG: (value: string, state?: string | undefined) => string;
export default formatToRG;