Skip to content

Validates Brazilian CPF document number using the "módulo 11" algorithm

Notifications You must be signed in to change notification settings

guilhermehn/validar-cpf

Folders and files

NameName
Last commit message
Last commit date
May 28, 2024
May 28, 2024
May 28, 2024
Nov 22, 2017
May 28, 2024
Sep 10, 2024
May 28, 2024
May 28, 2024
Jan 27, 2025
Sep 10, 2024

Repository files navigation

validar-cpf

Validates Brazilian CPF document number using the "módulo 11" algorithm.

Anything in the input string that is not a number will be removed during the validation, so there is no need to sanitize the input beforehand.

Actions Status npm version Known Vulnerabilities

Install

npm install --save validar-cpf

Usage

const validateCpf = require('validar-cpf');

if (validateCpf('123.456.789-87')) {
	console.log('Valid CPF');
}

Package size

Install size Minified size Minified + gzip size

License

MIT