Fork do Faker adaptado para o Brasil - CPF, CNPJ, CEP e termos regionalizados para português.
Installations
npm install faker-br
Developer Guide
Typescript
No
Module System
CommonJS
Node Version
12.18.3
NPM Version
7.5.3
Releases
Unable to fetch releases
Contributors
Unable to fetch Contributors
Languages
JavaScript (99.95%)
HTML (0.04%)
CoffeeScript (0.01%)
Developer
tamnil
Download Statistics
Total Downloads
2,109,679
Last Day
3,760
Last Week
16,879
Last Month
75,082
Last Year
858,487
GitHub Statistics
137 Stars
1,114 Commits
14 Forks
3 Watching
15 Branches
153 Contributors
Package Meta Information
Latest Version
0.4.1
Package Id
faker-br@0.4.1
Unpacked Size
2.79 MB
Size
568.73 kB
File Count
1,413
NPM Version
7.5.3
Node Version
12.18.3
Total Downloads
Cumulative downloads
Total Downloads
2,109,679
Last day
-3.4%
3,760
Compared to previous day
Last week
-13.8%
16,879
Compared to previous week
Last month
0%
75,082
Compared to previous month
Last year
50.3%
858,487
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Faker-br - Baseado no "faker" para desenvolvimento no Brasil
Tamnil Saito Jr. < tamnil@gmail.com >
Fork baseado no Faker.js para implementação no Brasil em língua portuguesa. Este pacote mantém todas as definições de linguagem do Faker.js V 4.0.x. o idioma principal foi alterado de en para "pt_BR" , e fallback para "en". Portanto a língua nativa do faker-br se torna o português, com fallback para ingles que possui implementaçoes não disponiveis nas outras linguagens As funçoẽs nativas do faker foram mantidas.
Instalacão:
npm install faker-br
Faker-br CLI
para aplicaçoes em linha de comando:
- sh/bash:
1 $ npm install -g faker-br 2 $ echo meu cpf é `faker-br br.cpf` 3 meu cpf é 65444122529
Inclusão da seguintes funções:
-
gerador de CPF
-
gerador de CNPJ
-
gerador de cartão de crédito válido
-
Aumento nos nomes em português, reduzindo probabilidade de colisão de nomes-sobrenomes, resultantes combinação
-
A fazer:
- gerador de RG (todo)
- gerador de CEP (todo)
- gerador de profissões (todo)
A geração de cartao de credito no faker.js, gera numeros não validados. O faker-br usa geração de numeros válidos por "Luhn algorithm -Mod 10"
A medida do possível, este módulo respeita a estrutura do faker.js (4.0.x) permitindo a substituição direta:
// original
// const faker = require('faker');
// usando faker-br
const faker = require('faker-br');
Uso
var faker = require('faker-br');
let meuCpf = faker.br.cpf();
As funçoes básicas são do faker 4.1 (https://github.com/Marak/faker.js).
Browser
<script src = "faker-br.js" type = "text/javascript"></script>
Node.js
var faker = require('faker-br');
Aplicação
var randomcpf = faker.br.cpf();
var randomCnpj = faker.br.cnpj();
console.log(faker.br.cnpj()) ;
API
Implementações para pt_BR
API exclusiva para pt_BR
namespace: .br
Namespace exclusivo para campos brasileiros.
-
.br.cpf(
) - opts(Object opcional)
- format:boolean retorna valor formatado
- opts(Object opcional)
-
.br.cnpj(
) - opts(Object opcional)
- format:boolean retorna valor formatado
name
- adição de mais nomes para pt-br o que aumenta o numero de combinações, reduzindo repetiçoes.
- adição de campos nao traduzidos para pt_BR marcados como "new", originalmente existentes em inglês.
name.gender name.firstname (extended) (extended: 2756 items, original:91 ) name.male_first_name (new) (extended: 2043 items, original:0 ) name.female_first_name (new) (extended: 713 items,original:0 ) name.name (direct imnport) name.gender (new) name.prefix (new) name.title (translated)
modulos traduzidos
commerce: color,department.product name name: gender prefix
API Methods
faker-br
-
br
- cpf
- cnpj
-
address
- zipCode
- zipCodeByState
- zipCodeValid
- zipCodeValidByState
- city
- cityPrefix
- citySuffix
- streetName
- streetAddress
- streetSuffix
- streetPrefix
- secondaryAddress
- county
- country
- countryCode
- state
- stateAbbr
- latitude
- longitude
-
commerce
- color
- department
- productName
- price
- productAdjective
- productMaterial
- product
-
company
- suffixes
- companyName
- companySuffix
- catchPhrase
- bs
- catchPhraseAdjective
- catchPhraseDescriptor
- catchPhraseNoun
- bsAdjective
- bsBuzz
- bsNoun
-
database
- column
- type
- collation
- engine
-
date
- past
- future
- between
- recent
- soon
- month
- weekday
-
fake
-
finance
- account
- accountName
- mask
- amount
- transactionType
- currencyCode
- currencyName
- currencySymbol
- bitcoinAddress
- ethereumAddress
- iban
- bic
-
hacker
- abbreviation
- adjective
- noun
- verb
- ingverb
- phrase
-
helpers
- randomize
- slugify
- replaceSymbolWithNumber
- replaceSymbols
- shuffle
- mustache
- createCard
- contextualCard
- userCard
- createTransaction
-
image
- image
- avatar
- imageUrl
- abstract
- animals
- business
- cats
- city
- food
- nightlife
- fashion
- people
- nature
- sports
- technics
- transport
- dataUri
-
internet
- avatar
- exampleEmail
- userName
- protocol
- url
- domainName
- domainSuffix
- domainWord
- ip
- ipv6
- userAgent
- color
- mac
- password
-
lorem
- word
- words
- sentence
- slug
- sentences
- paragraph
- paragraphs
- text
- lines
-
name
- firstName
- lastName
- findName
- jobTitle
- prefix
- suffix
- title
- jobDescriptor
- jobArea
- jobType
-
phone
- phoneNumber
- phoneNumberFormat
- phoneFormats
-
random
- number
- float
- arrayElement
- objectElement
- uuid
- boolean
- word
- words
- image
- locale
- alphaNumeric
- hexaDecimal
-
system
- fileName
- commonFileName
- mimeType
- commonFileType
- commonFileExt
- fileType
- fileExt
- directoryPath
- filePath
- semver
Localization
Individual Localization Packages
By default, requiring faker
will include all locale data.
In a production environment, you may only want to include the locale data for a specific set of locales.
1// loads only de locale 2var faker-br = require('faker/locale/de');
Setting a randomness seed
If you want consistent results, you can set your own seed:
1faker.seed(123); 2us of version `v2.0.0` faker-br has support for multiple localities. 3 4The default language locale is set to English. 5 6Setting a new locale is simple: 7 8```js 9// sets locale to de 10faker.setLocale("de"); 11// or 12faker.locale = "de";
var firstRandom = faker.random.number();
// Setting the seed again resets the sequence. faker.seed(123);
var secondRandom = faker.random.number();
console.log(firstRandom === secondRandom);
## Tests
npm install .
make test
You can view a code coverage report generated in coverage/lcov-report/index.html.
## Building faker-br
faker-br uses [gulp](http://gulpjs.com/) to automate it's build process. Running the following build command will generate new browser builds, documentation, and code examples for the project.
npm run-script build
## Building JSDocs
npm run-script doc
## Maintainer
#### Tamnil Saito Junior <tamnil@gmail.com>
Faker-br - Copyright (c) 2018
Tamnil Saito Junior
http://github.com/tamnil/faker-br/
Faker-br was forked by and has used data definitions from:
* http://github.com/marak/faker.js/
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-----------------------------------
Permissão é concedida, gratuitamente, a qualquer pessoa que obtiver
uma cópia deste software e dos arquivos de documentação associados
"Software"), para lidar com o Software sem restrições, incluindo
sem limitação os direitos de usar, copiar, modificar, mesclar, publicar,
distribuir, sublicenciar e / ou vender cópias do Software, e para
permitir que pessoas a quem o Software é fornecido façam isso, sujeitas a
as seguintes condições:
O aviso de copyright acima e este aviso de permissão devem ser
incluído em todas as cópias ou partes substanciais do Software.
O SOFTWARE É FORNECIDO "COMO ESTÁ", SEM GARANTIA DE QUALQUER TIPO,
EXPRESSA OU IMPLÍCITA, INCLUINDO, MAS NÃO SE LIMITANDO ÀS GARANTIAS
COMERCIABILIDADE, ADEQUAÇÃO A UM FIM ESPECÍFICO E
NÃO INFRAÇÃO. EM NENHUM CASO, OS AUTORES OU OS TITULARES DOS DIREITOS DE AUTOR
RESPONSÁVEL POR QUALQUER REIVINDICAÇÃO, DANOS OU OUTRAS RESPONSABILIDADES, QUER EM AÇÃO
CONTRATO, DELITO OU DE OUTRA FORMA, DECORRENTE DE, FORA OU EM CONEXÃO
COM O SOFTWARE OU O USO OU OUTRAS OFERTAS NO SOFTWARE.
No vulnerabilities found.
No security vulnerabilities found.
Other packages similar to faker-br
validation-br
Brazilian personal documents validation - cpf, cnpj, titulo, pis/pasep, cnh, renavam, processos judiciais, protocolo federal, código de rastreamento dos correios
faker-generator
<div align="center"> <h1> <br/> faker-generator <br/> <br/> </h1>
gerador-br
Gerador de Dados Fictícios - Brasil