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 2.0.5 to 3.0.0

dist/index.d.ts

49

package.json
{
"name": "cpf-check",
"version": "2.0.5",
"version": "3.0.0",
"description": "Validador de CPF Moderno, Isomórfico e Super Leve.",
"main": "dist/cpf.js",
"main": "dist/index.umd.js",
"umd:main": "dist/index.umd.js",
"source": "src/index.ts",
"module": "dist/index.mjs",
"types": "dist/index.d.ts",
"scripts": {
"build": "rimraf dist && cross-env NODE_ENV=production webpack --mode=production",
"build": "rimraf dist && cross-env NODE_ENV=production microbundle --no-sourcemap --name CPF && rimraf dist/index.test.d.ts",
"coverage": "cross-env NODE_ENV=test jest --coverage --coverageReporters=text-lcov | coveralls",
"lint": "eslint src/** ",
"lint": "tslint src/** ",
"prebuild": "npm run test && npm run lint",

@@ -30,30 +34,13 @@ "prepublishOnly": "npm run build",

"devDependencies": {
"babel-core": "^6.26.3",
"babel-eslint": "^8.2.3",
"babel-jest": "^23.0.1",
"babel-loader": "^7.1.4",
"babel-preset-env": "^1.7.0",
"coveralls": "^3.0.1",
"cross-env": "^5.1.6",
"eslint": "^4.19.1",
"eslint-config-airbnb-base": "^12.1.0",
"eslint-plugin-import": "^2.12.0",
"faster.js": "^1.1.0",
"jest": "^23.1.0",
"rimraf": "^2.6.2",
"webpack": "^4.10.2",
"webpack-command": "^0.2.0"
},
"jest": {
"collectCoverageFrom": [
"src/**/*.js"
],
"testMatch": [
"<rootDir>/src/**/?(*.)test.js"
],
"transformIgnorePatterns": [
"[/\\\\]node_modules[/\\\\].+\\.js$"
],
"testEnvironment": "node"
"@types/jest": "^24.0.11",
"coveralls": "^3.0.3",
"cross-env": "^5.2.0",
"jest": "^24.7.1",
"microbundle": "^0.11.0",
"rimraf": "^2.6.3",
"ts-jest": "^24.0.2",
"tslint": "^5.16.0",
"tslint-config-airbnb": "^5.11.1",
"typescript": "^3.4.4"
}
}
# cpf-check
Gerador, validador e formatador de CPF que roda tanto no navegador quanto no servidor. Super pequeno, apenas 1.6KB gzipped.
Gerador, validador e formatador de CPF que roda tanto no navegador quanto no servidor. Super pequeno, apenas 447 Bytes gzipped.

@@ -17,3 +17,3 @@ [![Build Status](https://travis-ci.org/flasd/cpf-check.svg?branch=master)](https://travis-ci.org/husscode/cpf-check)

```html
<script type="text/javascript" src="./node_modules/cpf-check/dist/cpf.min.js"></script>
<script type="text/javascript" src="./node_modules/cpf-check/dist/index.umd.js"></script>
// window.CPF

@@ -32,8 +32,7 @@ ```

## API & Uso.
#### CPF() & CPF.validate();
#### CPF.validate();
Assinatura do método:
```c
Boolean validate(String algumCpf);
```typescript
validate(algumCpf: any): boolean;
```
O export padrão é um método que valida CPFs. O método `CPF()` é um pseudônimo do método `CPF.validate()`.
```javascript

@@ -44,15 +43,13 @@ import CPF, { validate } from 'cpf-check';

const { valid, error, code } = CPF(algumCpf);
// valid => true
// error => false
// code => 'VALID'
CPF.validate(algumCpf);
// « true
const resultado = CPF.validate(algumCpf);
// resultado => { valid: true, error: false, code: 'VALID' }
validate(algumCpf);
// « true
const resultado = validate('não-cpf');
// resultado => { valid: false, error: true, code: 'LENGTH }
validate('não-cpf');
// « false
const resultado = validate('12345678910');
// resultado => { valid: false, error: true, code: 'INVALID' }
validate('12345678910');
// « false
```

@@ -63,4 +60,4 @@

Assinatura do método:
```c
String generate(?Boolean formatar);
```typescript
generate(formatar?: boolean): string;
```

@@ -73,9 +70,9 @@ Esse método gera CPFs válidos.

CPF.generate();
// '676.754.677-10'
// « '67675467710'
generate(true);
// « '676.754.677-10'
generate();
// '676.754.677-10'
generate(false);
// '67675467710'
// « '67675467710'
```

@@ -85,6 +82,6 @@

Assinatura do método:
```c
String format(String algumCpf);
```typescript
format(algumCpf: any): string;
```
Esse método embeleza strings de CPFs.
Esse método adiciona pontuação a strings de CPFs.
```javascript

@@ -96,6 +93,9 @@ import CPF, { format } from 'cpf-check';

CPF.format(meuCpf);
// '676.754.677-10'
// « '676.754.677-10'
format(meuCpf);
// '676.754.677-10'
// « '676.754.677-10'
format('não-cpf');
// « ''
```

@@ -105,6 +105,6 @@

Assinatura do método:
```c
String strip(String algumCpf);
```typescript
strip(algumCpf: any): string;
```
Esse método retira caracteres não numéricos de uma string. Faz o oposto do método `format()`;
Esse método retira caracteres não numéricos de uma string.
```javascript

@@ -116,6 +116,6 @@ import CPF, { strip } from 'cpf-check';

CPF.strip(algumCpf);
// '67675467710'
// « '67675467710'
strip(algumCpf);
// '67675467710'
// « '67675467710'
```

@@ -125,2 +125,2 @@

Copyright (c) 2017 [Marcel de Oliveira Coelho](https://github.com/husscode) sob a [Licença MIT](https://github.com/husscode/cpf-check/blob/master/LICENSE.md). Go Crazy. :rocket:
Copyright (c) 2019 [Marcel de Oliveira Coelho](https://github.com/husscode) sob a [Licença MIT](https://github.com/husscode/cpf-check/blob/master/LICENSE.md). Go Crazy. :rocket:

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