New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

cpf-check

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cpf-check - npm Package Compare versions

Comparing version 1.1.4 to 1.1.5

15

package.json
{
"name": "cpf-check",
"version": "1.1.4",
"version": "1.1.5",
"description": "Validador de CPF Moderno, Isomórfico e Super Leve.",
"main": "dist/cpf.min.js",
"scripts": {
"test": "cross-env NODE_ENV=test nyc mocha src/**/*.spec.js --compilers=babel-core/register",
"start": "npm run clean && cross-env NODE_ENV=development gulp",
"cover": "npm test && nyc report -x ./src/index.spec.js --reporter=text-lcov | coveralls",
"build": "npm run lint && npm test && npm run clean && cross-env NODE_ENV=production gulp",
"lint": "eslint gulpfile.js && eslint src/index.js",
"clean": "rimraf dist",
"test": "cross-env NODE_ENV=test nyc mocha src/**/*.spec.js --require=babel-core/register",
"start": "npm run clear && cross-env NODE_ENV=development gulp",
"covarage": "npm test && nyc report -x ./src/index.spec.js --reporter=text-lcov | coveralls",
"prebuild": "npm run clear && npm test && npm run lint",
"build": "cross-env NODE_ENV=production gulp",
"lint": "eslint src/index.js",
"clear": "rimraf dist",
"flow": "flow",

@@ -14,0 +15,0 @@ "prepublish": "npm run build"

# cpf-check
Validador, Gerador e Formatados de CPF, roda tanto no navegador quanto no servidor. Incrívelmente pequeno, apenas 2.2KB (890bytes gziped!!).
[![Build Status](https://travis-ci.org/flasd/cpf-check.svg?branch=master)](https://travis-ci.org/flasd/cpf-check) [![Coverage Status](https://coveralls.io/repos/github/flasd/cpf-check/badge.svg?branch=master)](https://coveralls.io/github/flasd/cpf-check?branch=master) [![npm version](https://badge.fury.io/js/cpf-check.svg)](https://www.npmjs.com/package/cpf-check)
### Instalation
Adicione a ultima versão ao seu `package.json`.
Validador, gerador e formatdor de CPFs que funciona tanto em navegadores quanto no servidor. Incrívelmente pequeno, apenas 2.2KB (890Bytes GZiped!)
[![Build Status](https://travis-ci.org/flasd/cpf-check.svg?branch=master)](https://travis-ci.org/flasd/cpf-check)
[![Coverage Status](https://coveralls.io/repos/github/flasd/cpf-check/badge.svg?branch=master)](https://coveralls.io/github/flasd/cpf-check?branch=master)
[![npm version](https://badge.fury.io/js/cpf-check.svg)](https://www.npmjs.com/package/cpf-check)
[![npm downloads per month](https://img.shields.io/npm/dm/cpf-check.svg)](https://www.npmjs.com/package/cpf-check)
(README dispoível em inglês [aqui](https://github.com/flasd/cpf-check/blob/master/README.md)).
## Instalação
Instale a ultima versão do cpf-check:
```
npm install cpf-check --save
```
Você pode usar o script no navegador:
Agora você pode usar ele no seu `index.html`
```html

@@ -14,29 +20,40 @@ <script type="text/javascript" src="./node_modules/cpf-check/dist/cpf.min.js"></script>

```
Ou pode importa-lo como um módulo:
Ou, pode importa-lo como um módulo:
```javascript
const CPF = require('cpf-check');
// ou, em ES6
// ou, em ES6+
import CPF from 'cpf-check';
```
Funciona no Node, qualquer CommonJs Env. e como um módulo AMD.
O module obedece a especificação [UMD](https://github.com/umdjs/umd), portanto ele é compativel com RequireJs, AMD, CommonJs 1 & 2, etc.
## Uso & API
### CPF(String): Boolean
O Objeto exportado por padrão é uma função que valida CPFs:
## API & Usage
#### CPF() & CPF.validate();
Assinatura do método:
```c
Boolean validate(String CPF);
```
O método `CPF()` é um pseudônimo para o método `CPF.validate()`. O exportado por padrão é uma função que valida CPFs.
```javascript
const CPF = require('cpf-check')
const meuCpf = '676.754.677-10';
const algumCPF = '676.754.677-10';
CPF(meuCpf);
CPF(algumCPF);
// true
CPF.validate(meuCpf);
CPF.validate(algumCPF);
// true
```
O método `CPF.validate()` é um pseudônimo para o método `CPF()`.
### CPF.generate(): String
Gera CPFs válidos:
#### CPF.generate();
Assinatura do método:
```c
String generate();
```
Este método gera CPFs validos.
```javascript

@@ -47,22 +64,35 @@ CPF.generate();

### CPF.parse(String): String
Parse CPFs em strings de texto:
#### CPF.parse();
Assinatura do método:
```c
String parse(String text);
```
Analisar uma String em busca de CPFs usando RegEx:
```javascript
const meuTexto = 'Hey, my CPF is 676.754.677-10';
const umText = 'Hey, my CPF is 676.754.677-10';
CPF.parse(meuTexto);
CPF.parse(umText);
// '676.754.677-10'
```
### CPF.format(String): String
Formata CPFs:
#### CPF.format();
Assinatura do método:
```c
String format(String rawCPF);
```
Este método formata Strings de CPFs:
```javascript
const meuCpf = '67675467710';
const umCpf = '67675467710';
CPF.format(meuCpf);
CPF.format(umCpf);
// '676.754.677-10'
```
### CPF.strip(String): String
Limpa CPFs:
#### CPF.strip();
Assinatura do método:
```c
String strip(String umCPF);
```
Esté método tira quaisquer simbolos do CPF, deixando apenas os números. Ele faz o oposto do método `format()`.
```javascript

@@ -75,9 +105,4 @@ const meuCpf = '676.754.677-10';

## PRs
Se você encontrar algo errado, não exite em abrir um PR!
## Bonus!
Se você está curioso para saber como esse módulo funciona antes de implementa-lo no seu próximo projeto, o código fonte está amplamente comentado! (Em inglês, desculpa ;) Vá para
If you're curious to know how this module works before [src/index.js](https://github.com/flasd/cpf-check/blob/master/src/index.js) é confira!
## Copyright e Licença
### Copyright e Licença
Copyright (c) 2017 [Marcel Coelho](https://github.com/flasd) sob a [MIT license](https://github.com/flasd/cpf-check/blob/master/LICENSE.md)
Copyright (c) 2017 [Marcel de Oliveira Coelho](https://github.com/flasd) sob a [licença MIT](https://github.com/flasd/cpf-check/blob/master/LICENSE.md). :rocket:
# cpf-check
CPF Validator, Generator e Formatter, runs both on browser and server-side. Incredibly Small 2.2KB (890bytes gziped!!).
[![Build Status](https://travis-ci.org/flasd/cpf-check.svg?branch=master)](https://travis-ci.org/flasd/cpf-check) [![Coverage Status](https://coveralls.io/repos/github/flasd/cpf-check/badge.svg?branch=master)](https://coveralls.io/github/flasd/cpf-check?branch=master) [![npm version](https://badge.fury.io/js/cpf-check.svg)](https://www.npmjs.com/package/cpf-check)
### Instalation
CPF validator, generator and formatter that runs both in the browser and in the server. Incredibly Small 2.2KB (890bytes gziped!).
[![Build Status](https://travis-ci.org/flasd/cpf-check.svg?branch=master)](https://travis-ci.org/flasd/cpf-check)
[![Coverage Status](https://coveralls.io/repos/github/flasd/cpf-check/badge.svg?branch=master)](https://coveralls.io/github/flasd/cpf-check?branch=master)
[![npm version](https://badge.fury.io/js/cpf-check.svg)](https://www.npmjs.com/package/cpf-check)
[![npm downloads per month](https://img.shields.io/npm/dm/cpf-check.svg)](https://www.npmjs.com/package/cpf-check)
(README available in portuguese in [README-pt-BR](https://github.com/flasd/cpf-check/blob/master/README-pt-BR.md)).
Add the latest version of cpf-check to your `package.json`.
## Instalation
Install the latest version of cpf-check:
```

@@ -19,25 +24,35 @@ npm install cpf-check --save

// or, in ES6
// or, in ES6+
import CPF from 'cpf-check';
```
Works on Node, any CommonJs Env. and as an AMD modules.
The module is compliant with [UMD](https://github.com/umdjs/umd), so it's compatible with RequireJS, AMD, CommonJs 1 & 2, etc. :hushed:
## Usage & API
### CPF(String): Boolean
The main export is a function that validates CPFs.
## API & Usage
#### CPF() & CPF.validate();
Method signature:
```c
Boolean validate(String CPF);
```
The `CPF()` methods is an alias for `CPF.validate()`. The default export is a function that validates CPFs.
```javascript
const CPF = require('cpf-check')
const myCpf = '676.754.677-10';
const someCPF = '676.754.677-10';
CPF(myCpf);
CPF(someCPF);
// true
CPF.validate(myCpf);
CPF.validate(someCPF);
// true
```
The `CPF.validate()` is an alias for the `CPF()` method.
### CPF.generate(): String
Generates valid CPFs:
#### CPF.generate();
Method signature:
```c
String generate();
```
This method generatres valid CPFs.
```javascript

@@ -48,4 +63,9 @@ CPF.generate();

### CPF.parse(String): String
Parse CPFs from text strings:
#### CPF.parse();
Method signature:
```c
String parse(String text);
```
Parse CPFs from text strings using RegEx:
```javascript

@@ -58,4 +78,8 @@ const myText = 'Hey, my CPF is 676.754.677-10';

### CPF.format(String): String
Format (beautify) CPF strings:
#### CPF.format();
Method signature:
```c
String format(String rawCPF);
```
Format beautifies CPF strings:
```javascript

@@ -68,17 +92,17 @@ const myCpf = '67675467710';

### CPF.strip(String): String
Strip (uglify) CPF strings:
#### CPF.strip();
Method signature:
```c
String strip(String cuteCPF);
```
Strip uglifies CPF strings: This does the oposite of the `format()` method.
```javascript
const myCpf = '676.754.677-10';
const myCuteCpf = '676.754.677-10';
CPF.strip(myCpf);
CPF.strip(myCuteCpf);
// '67675467710'
```
## PRs
And if you find something that is not working as supposed to, please, open a PR.
## Bonus!
If you're curious to know how this module works before implementing it, the source code is heavily commented! head to [src/index.js](https://github.com/flasd/cpf-check/blob/master/src/index.js) to take a look!
## Copyright and License
### Copyright and License
Copyright (c) 2017 [Marcel Coelho](https://github.com/flasd) under the [MIT license](https://github.com/flasd/cpf-check/blob/master/LICENSE.md)
Copyright (c) 2017 [Marcel de Oliveira Coelho](https://github.com/flasd) under the [MIT license](https://github.com/flasd/cpf-check/blob/master/LICENSE.md). Go Crazy. :rocket:

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc