import mapToNumeric from '../helpers/mapToNumeric' ; example param value const formatToCNPJ = ( value ) : string => ( mapToNumeric ( value ) . replace ( /(\d{2})(\d)/ , '$1.$2' ) . replace ( /(\d{3})(\d)/ , '$1.$2' ) . replace ( /(\d{3})(\d)/ , '$1/$2' ) . replace ( /(\d{4})(\d{1,2})$/ , '$1-$2' ) ) ; export default formatToCNPJ ;