Skip to content

jiro4989/faker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

faker

gh-actions

faker is a Nim package that generates fake data for you. faker is heavily inspired by Python Faker.

WIP

nimble install faker
import faker

block:
  let fake = newFaker("ja_JP")
  echo fake.address()
  # -> 茨城県港区東三島31丁目3番16号

  echo fake.name()
  # -> 若松 香織

block:
  # default locale is `LANG` environment variables

  let fake = newFaker()
  echo fake.address()
  # -> 94622 Cesar Camp Apt. 13 South Caitlyn, HI 35128

  echo fake.name()
  # -> Bruce Wagner DDS
$ faker address
大阪府調布市湯宮27丁目24番12号

# Set locale and run
$ LANG=en_US.UTF-8 faker name
Mr. Leonard Johns

I understand only English and Japanese.

Locale Description
en_US English
ja_JP Japanese
fa_IR Persian

TODO list.

  • [ ] base
  • [o] faker.provider.address
  • [o] faker.provider.automotive
  • [o] faker.provider.bank
  • [ ] faker.provider.barcode
  • [ ] faker.provider.color
  • [o] faker.provider.company
  • [ ] faker.provider.credit_card
  • [o] faker.provider.currency
  • [ ] faker.provider.date_time
  • [o] faker.provider.file
  • [ ] faker.provider.geo
  • [ ] faker.provider.internet
  • [o] faker.provider.isbn
  • [o] faker.provider.job
  • [ ] faker.provider.lorem
  • [o] faker.provider.misc
  • [o] faker.provider.person
  • [o] faker.provider.phone_number
  • [ ] faker.provider.profile
  • [ ] faker.provider.python
  • [o] faker.provider.ssn
  • [o] faker.provider.user_agent

You can generate a new module with nimble genMod task. Run below.

$ nimble genMod new_module

Please see other module implements, and edit a generated module.

You can update src/faker/provider/*.nim codes with generator tool. Run below if you had edited a new module.

$ nimble tool
$ ./tools/generator

See src/faker/provider/*.nim. A new provider will be generated.

Welcome ❤️

MIT