

API Reference – Faker Elixir (octopus) v1.0.2

if(localStorage.getItem('night-mode')) document.body.className += ' night-mode';

Faker Elixir (octopus) v1.0.2

 API Reference

=============================================

* [Modules](#modules)

* [Exceptions](#exceptions)

Modules

=======

[FakerElixir](FakerElixir.html)

FakerElixir is an Elixir package that **generates fake data** for you. Whether you need to **seed** your database, create **factories** for your project, FakerElixir is here for you

[FakerElixir.Address](FakerElixir.Address.html)

Generate fake data for the domain address

[FakerElixir.App](FakerElixir.App.html)

Generate fake data for the domain app

[FakerElixir.Avatar](FakerElixir.Avatar.html)

Generate fake data for the domain avatar

[FakerElixir.Bank](FakerElixir.Bank.html)

Generate fake date related to the Bank domain

[FakerElixir.Boolean](FakerElixir.Boolean.html)

Generate fake data for the domain boolean

[FakerElixir.Color](FakerElixir.Color.html)

Generate fake date for the domain Color

[FakerElixir.Commerce](FakerElixir.Commerce.html)

Generate fake data for the domain Commerce

[FakerElixir.Crypto](FakerElixir.Crypto.html)

Generate fake data for the domain crypto

[FakerElixir.Currency](FakerElixir.Currency.html)

Generate fake data for the domain currency

[FakerElixir.Date](FakerElixir.Date.html)

Generate fake data for the domain Date

[FakerElixir.File](FakerElixir.File.html)

Generate fake data for the domain File

[FakerElixir.Helper](FakerElixir.Helper.html)

Provide useful helpers

[FakerElixir.Internet](FakerElixir.Internet.html)

Generate fake data for the domain Internet

[FakerElixir.Lorem](FakerElixir.Lorem.html)

Generate fake data for the domain lorem

[FakerElixir.Name](FakerElixir.Name.html)

Generate fake data for the domain lorem

[FakerElixir.Number](FakerElixir.Number.html)

Generate fake data for the domain Number

[FakerElixir.Phone](FakerElixir.Phone.html)

Generate fake date for the domain Phone

Exceptions

==========

[OverflowError](OverflowError.html)



 

FakerElixir – Faker Elixir (octopus) v1.0.2

if(localStorage.getItem('night-mode')) document.body.className += ' night-mode';

Faker Elixir (octopus) v1.0.2

 FakerElixir

===========================================

FakerElixir is an Elixir package that **generates fake data** for you. Whether you need to **seed** your database, create **factories** for your project, FakerElixir is here for you.

 Installation

---------------

Can’t wait to generate some fake data ? Follow the steps:

1. Add `faker_elixir_octopus` to your list of dependencies in `mix.exs`:

```

  def deps do

    [{:faker_elixir_octopus, "> 0.0.0"}]

  end

```

1. Ensure `faker_elixir` is started before your application:

```

  def application do

    [applications: [:faker_elixir_octopus]]

  end

```

1. Run in the root of your project:

```

  $ mix deps.get

```

1. Faker Elixir is now a part of your application and ready to use!

 Usage

--------

Since I’m quite sure you are using Phoenix, I will show you a basic example:

```

defmodule Zombie.AwesomeController do

  use Zombie.Web, :controller

  def index(conn, _params) do

    text conn, FakerElixir.Helper.pick(["zombie", "human"])

  end

end

```

Now if you keep refreshing your browser, the value should change. Awesome, you just understood how to use Faker.

 Summary

==========

[Functions](#functions)

------------------------

[get\_locale()](#get_locale/0)

Return the current locale set

[set\_locale(locale)](#set_locale/1)

The default locale used by FakerElixir is `:en`

 Functions

============

get\_locale()

Return the current locale set

```

iex> FakerElixir.get_locale

:en

```

set\_locale(locale)

The default locale used by FakerElixir is `:en`.

Right now only 4 locales are available: `:fr`, `:en`, `:es`, `:it`.

If you set a different locale, FakerElixir will just fallback to `:en` (If you didn’t provide a custom locale)

Note: Keep in mind you can set the locale at the runtime, the locale set will keep his state until you set another locale

Examples

--------

```

iex> FakerElixir.set_locale(:en)

:ok

iex> FakerElixir.Address.city

"Baltimore"

iex> FakerElixir.set_locale(:fr)

:ok

iex> FakerElixir.Address.city

"Issy-les-Moulineaux"

```



 

FakerElixir.Address – Faker Elixir (octopus) v1.0.2

if(localStorage.getItem('night-mode')) document.body.className += ' night-mode';

Faker Elixir (octopus) v1.0.2

 FakerElixir.Address

===================================================

Generate fake data for the domain address

 Summary

==========

[Functions](#functions)

------------------------

[building\_number()](#building_number/0)

Return building number

[city()](#city/0)

Return city name

[country()](#country/0)

Return country name

[country\_code()](#country_code/0)

Return country code

[latitude()](#latitude/0)

Return a latitude

[longitude()](#longitude/0)

Return a longitude

[make\_country()](#make_country/0)

Return country struct with code & name

[secondary\_address()](#secondary_address/0)

Return secondary address

[state()](#state/0)

Return a state name

[state\_code()](#state_code/0)

Return a state code

[street\_address()](#street_address/0)

Return street address

[street\_name()](#street_name/0)

Return street name

[street\_suffix()](#street_suffix/0)

Return street suffix

[time\_zone()](#time_zone/0)

Return a time zone

[zip\_code()](#zip_code/0)

Return a zip code

 Functions

============

building\_number()

Return building number

Examples

--------

```

iex> FakerElixir.Address.building_number

"542"

```

city()

Return city name

Examples

--------

```

iex> FakerElixir.Address.city

"Portland"

```

country()

Return country name

Examples

--------

```

iex> FakerElixir.Address.country

"Iceland"

```

country\_code()

Return country code

Examples

--------

```

iex> FakerElixir.Address.country_code

"NY"

```

latitude()

Return a latitude

Examples

--------

```

iex> FakerElixir.Address.latitude

-71.67369045432866

```

longitude()

Return a longitude

Examples

--------

```

iex> FakerElixir.Address.longitude

-114.67722189422487

```

make\_country()

Return country struct with code & name.

Examples

--------

```

iex> FakerElixir.Address.make_country

%{code: "MY", name: "Malaysia"}

```

secondary\_address()

Return secondary address

Examples

--------

```

iex> FakerElixir.Address.secondary_address

"Apt. 752"

```

state()

Return a state name

Examples

--------

```

iex> FakerElixir.Address.state

"New Jersey"

```

state\_code()

Return a state code

Examples

--------

```

iex> FakerElixir.Address.state_code

"TX"

```

street\_address()

Return street address

Examples

--------

```

iex> FakerElixir.Address.street_address

"786 Willow Parkways"

```

street\_name()

Return street name

Examples

--------

```

iex> FakerElixir.Address.street_name

"McLaughlin Mills"

```

street\_suffix()

Return street suffix

Examples

--------

```

iex> FakerElixir.Address.street_suffix

"Lodge"

```

time\_zone()

Return a time zone

Examples

--------

```

iex> FakerElixir.Address.time_zone

"Europe/Sarajevo"

```

zip\_code()

Return a zip code

Examples

--------

```

iex> FakerElixir.Address.zip_code

"59146-7626"

```



 

FakerElixir.App – Faker Elixir (octopus) v1.0.2

if(localStorage.getItem('night-mode')) document.body.className += ' night-mode';

Faker Elixir (octopus) v1.0.2

 FakerElixir.App

===============================================

Generate fake data for the domain app

 Summary

==========

[Functions](#functions)

------------------------

[author()](#author/0)

Return an author name

[name()](#name/0)

Return an application name

[version()](#version/0)

Return a version number

 Functions

============

author()

Return an author name

Examples

--------

```

iex> FakerElixir.App.author

"Antonio Konopelski"

```

name()

Return an application name

Examples

--------

```

iex> FakerElixir.App.name

"Chocolada"

```

version()

Return a version number

Examples

--------

```

iex> FakerElixir.App.version

"8.1.7"

```



 

FakerElixir.Avatar – Faker Elixir (octopus) v1.0.2

if(localStorage.getItem('night-mode')) document.body.className += ' night-mode';

Faker Elixir (octopus) v1.0.2

 FakerElixir.Avatar

==================================================

Generate fake data for the domain avatar

 Summary

==========

[Functions](#functions)

------------------------

[robohash()](#robohash/0)

Return avatar url of a robot with a `size` of `300x300`

[robohash(slug)](#robohash/1)

Return avatar url of a robot with the `slug` given and a `size` of `300x300`

[robohash(slug, size)](#robohash/2)

Return avatar url of a robot with the `slug` and `size` given

[robohash(slug, size, type)](#robohash/3)

Return avatar url of a robot with the `slug`, `size` and `type` given

[robohash(slug, size, type, set)](#robohash/4)

Return avatar url of a robot with the `slug`, `size`, `type` and `set` given

[robohash(slug, size, type, set, bgset)](#robohash/5)

Return avatar url of a robot with the `slug`, `size`, `type`, `set` and `bgset` given

 Functions

============

robohash()

Return avatar url of a robot with a `size` of `300x300`

Examples

--------

```

iex> FakerElixir.Avatar.robohash

"https://robohash.org/fceuxke.png?size=300x300"

```

robohash(slug)

Return avatar url of a robot with the `slug` given and a `size` of `300x300`

Examples

--------

```

iex> FakerElixir.Avatar.robohash("zombies-must-die")

"https://robohash.org/zombies-must-die.png?size=300x300"

```

robohash(slug, size)

Return avatar url of a robot with the `slug` and `size` given

Examples

--------

```

iex> FakerElixir.Avatar.robohash("zombies-forever", "400x400")

"https://robohash.org/zombies-forever.png?size=400x400"

```

robohash(slug, size, type)

Return avatar url of a robot with the `slug`, `size` and `type` given

Examples

--------

```

iex> FakerElixir.Avatar.robohash("i-love-a-zombie", "300x300", "jpg")

"https://robohash.org/i-love-a-zombie.jpg?size=300x300"

```

robohash(slug, size, type, set)

Return avatar url of a robot with the `slug`, `size`, `type` and `set` given

Examples

--------

```

iex > FakerElixir.Avatar.robohash("boring-slug", "230x230", "bmp", "set1")

"https://robohash.org/boring-slug.bmp?size=230x230&set=set1"

```

robohash(slug, size, type, set, bgset)

Return avatar url of a robot with the `slug`, `size`, `type`, `set` and `bgset` given

Examples

--------

```

iex> FakerElixir.Avatar.robohash("ahahahaha", "198x198", "jpg", "set2", "bg2")

"https://robohash.org/ahahahaha.jpg?size=198x198&set=set2&bgset=bg2"

```



 

FakerElixir.Bank – Faker Elixir (octopus) v1.0.2

if(localStorage.getItem('night-mode')) document.body.className += ' night-mode';

Faker Elixir (octopus) v1.0.2

 FakerElixir.Bank

================================================

Generate fake date related to the Bank domain

 Summary

==========

[Functions](#functions)

------------------------

[credit\_card\_cvv()](#credit_card_cvv/0)

Generate a credit card CVV

[credit\_card\_expiration\_date()](#credit_card_expiration_date/0)

Return a credit card expiration date (more chances to be a valid one)

[credit\_card\_expiration\_date(atom)](#credit_card_expiration_date/1)

Return a valid or invalid credit card expiration date

[credit\_card\_number()](#credit_card_number/0)

Return a credit card number

[credit\_card\_type()](#credit_card_type/0)

Return a credit card type

[make\_credit\_card()](#make_credit_card/0)

Generate a credit card with details

[name()](#name/0)

Return the name of a bank

 Functions

============

credit\_card\_cvv()

Generate a credit card CVV

Examples

--------

```

iex> FakerElixir.Bank.credit_card_cvv

"914"

```

credit\_card\_expiration\_date()

Return a credit card expiration date (more chances to be a valid one)

Examples

--------

```

iex> FakerElixir.Bank.credit_card_expiration_date

"08/2017"

```

credit\_card\_expiration\_date(atom)

Return a valid or invalid credit card expiration date

Examples

--------

```

iex> FakerElixir.Bank.credit_card_expiration_date(:valid)

"06/2023"

```

```

iex> FakerElixir.Bank.credit_card_expiration_date(:invalid)

"03/2009"

```

credit\_card\_number()

Return a credit card number

Examples

--------

```

iex> FakerElixir.Bank.credit_card_number

"34521702751096"

```

credit\_card\_type()

Return a credit card type

Examples

--------

```

iex> FakerElixir.Bank.credit_card_type

"MasterCard"

```

make\_credit\_card()

Generate a credit card with details

Examples

--------

```

iex> FakerElixir.Bank.make_credit_card

%{cvv: "188", expiration_date: "12/2006", name: "LLEWELLYN WEBER", number: "601141761193874", type: "Discover Card"}

```

name()

Return the name of a bank

Examples

--------

```

iex> FakerElixir.Bank.name

"Goldman Sachs Group"

```



 

FakerElixir.Boolean – Faker Elixir (octopus) v1.0.2

if(localStorage.getItem('night-mode')) document.body.className += ' night-mode';

Faker Elixir (octopus) v1.0.2

 FakerElixir.Boolean

===================================================

Generate fake data for the domain boolean

 Summary

==========

[Functions](#functions)

------------------------

[boolean()](#boolean/0)

Return a boolean with **equal** chance to be `true` or `false`

[boolean(ratio)](#boolean/1)

Return a boolean with a **ratio** chance to be `true`

 Functions

============

boolean()

Return a boolean with **equal** chance to be `true` or `false`

Examples

--------

```

iex> FakerElixir.Boolean.boolean

true

```

boolean(ratio)

Return a boolean with a **ratio** chance to be `true`

Examples

--------

It will be always `true`:

```

iex> FakerElixir.Boolean.boolean(1)

true

```

It will be always `false`:

```

iex> FakerElixir.Boolean.boolean(0)

false

```

10% chance to be `true`:

```

iex> FakerElixir.Boolean.boolean(0.1)

false

```

90% chance to be `true`:

```

iex> FakerElixir.Boolean.boolean(0.9)

true

```



 

FakerElixir.Color – Faker Elixir (octopus) v1.0.2

if(localStorage.getItem('night-mode')) document.body.className += ' night-mode';

Faker Elixir (octopus) v1.0.2

 FakerElixir.Color

=================================================

Generate fake date for the domain Color

 Summary

==========

[Functions](#functions)

------------------------

[hex()](#hex/0)

Return hex

[hsl()](#hsl/0)

Return hsl

[make\_hsl()](#make_hsl/0)

Return a list with hsl values

[make\_rgb()](#make_rgb/0)

Return a list with rgb values

[name()](#name/0)

Return name

[rgb()](#rgb/0)

Return rgb

 Functions

============

hex()

Return hex

Examples

--------

```

iex> FakerElixir.Color.hex

"#1671B0"

```

hsl()

Return hsl

Examples

--------

```

iex> FakerElixir.Color.hsl

"hsl(130, 40%, 41%)"

```

make\_hsl()

Return a list with hsl values

Examples

--------

```

iex> FakerElixir.Color.make_hsl

[236, "13%", "77%"]

```

make\_rgb()

Return a list with rgb values

Examples

--------

```

iex> FakerElixir.Color.make_rgb

[65, 137, 5]

```

name()

Return name

Examples

--------

```

iex> FakerElixir.Color.name

"white"

```

rgb()

Return rgb

Examples

--------

```

iex> FakerElixir.Color.rgb

"rgb(152, 228, 47)"

```



 

FakerElixir.Commerce – Faker Elixir (octopus) v1.0.2

if(localStorage.getItem('night-mode')) document.body.className += ' night-mode';

Faker Elixir (octopus) v1.0.2

 FakerElixir.Commerce

====================================================

Generate fake data for the domain Commerce

 Summary

==========

[Functions](#functions)

------------------------

[coupon()](#coupon/0)

Return discount code

[coupon(nb\_digits)](#coupon/1)

Return discount code with the number of digits wanted

[product()](#product/0)

Return product name

[sku()](#sku/0)

Return a common Stock-keeping unit

 Functions

============

coupon()

Return discount code

Example

-------

```

iex> FakerElixir.Commerce.coupon

"StellarDeal683"

```

coupon(nb\_digits)

Return discount code with the number of digits wanted

Example

-------

```

FakerElixir.Commerce.coupon(4)

"PremiumSale5496"

```

product()

Return product name

Example

-------

```

FakerElixir.Commerce.product

"Tasty Fresh Skirt"

```

sku()

Return a common Stock-keeping unit

Example

-------

```

FakerElixir.Commerce.sku

"3YW9Q3S6"

```



 

FakerElixir.Crypto – Faker Elixir (octopus) v1.0.2

if(localStorage.getItem('night-mode')) document.body.className += ' night-mode';

Faker Elixir (octopus) v1.0.2

 FakerElixir.Crypto

==================================================

Generate fake data for the domain crypto

 Summary

==========

[Functions](#functions)

------------------------

[md5()](#md5/0)

Return `md5` hash

[sha1()](#sha1/0)

Return `sha1` hash

[sha224()](#sha224/0)

Return `sha224` hash

[sha256()](#sha256/0)

Return `sha256` hash

[sha384()](#sha384/0)

Return `sha384` hash

[sha512()](#sha512/0)

Return `sha512` hash

 Functions

============

md5()

Return `md5` hash

Example

-------

```

iex> FakerElixir.Crypto.md5

"9FE3CFD7113162785ED3D59C73166766"

```

sha1()

Return `sha1` hash

Example

-------

```

iex> FakerElixir.Crypto.sha1

"7D6757DDD455FC6AA25C0D78C1CDE73B21028CD7"

```

sha224()

Return `sha224` hash

Example

-------

```

iex> FakerElixir.Crypto.sha224

"824B34965B6A3E48BE71E09A54F63BC216845D794EB378E756EE759D"

```

sha256()

Return `sha256` hash

Example

-------

```

iex> FakerElixir.Crypto.sha256

"4762E04FB860A8A7C4D58B495DE133355D069CF618A55BBACA98583DF105818C"

```

sha384()

Return `sha384` hash

Example

-------

```

iex> FakerElixir.Crypto.sha384

"9C01EBA98F4A52F76948D48A0FB3C63C26DE451667F8957C6420B6D26183F93C28A3A344406C77FF74C877EE5AA3AD10"

```

sha512()

Return `sha512` hash

Example

-------

```

iex> FakerElixir.Crypto.sha512

"06C1CC54DC49E53B1274D9A0DD951B76DD45731E0AB319D98575DEA1955F6A0B20D5B70548190119AED52A5254127A60511257673C332F759F9510B8F32AAC26"

```



 

FakerElixir.Currency – Faker Elixir (octopus) v1.0.2

if(localStorage.getItem('night-mode')) document.body.className += ' night-mode';

Faker Elixir (octopus) v1.0.2

 FakerElixir.Currency

====================================================

Generate fake data for the domain currency

 Summary

==========

[Functions](#functions)

------------------------

[code()](#code/0)

Return currency code

[make()](#make/0)

Return currency struct with different keys

[name()](#name/0)

Return currency name

[symbol()](#symbol/0)

Return currency symbol

 Functions

============

code()

Return currency code

Example

-------

```

iex> FakerElixir.Currency.code

"ZMK"

```

make()

Return currency struct with different keys

Example

-------

```

iex> FakerElixir.Currency.make

%{code: "UAH", country: "Ukraine", name: "Ukrainian Hryvnia", symbol: "₴"}

```

name()

Return currency name

Example

-------

```

iex> FakerElixir.Currency.name

"East Caribbean Dollar"

```

symbol()

Return currency symbol

Example

-------

```

iex> FakerElixir.Currency.symbol

"€"

```



 

FakerElixir.Date – Faker Elixir (octopus) v1.0.2

if(localStorage.getItem('night-mode')) document.body.className += ' night-mode';

Faker Elixir (octopus) v1.0.2

 FakerElixir.Date

================================================

Generate fake data for the domain Date

 Summary

==========

[Functions](#functions)

------------------------

[backward(range)](#backward/1)

Return a date in the future

[birthday()](#birthday/0)

Return birthday date

[forward(range)](#forward/1)

Return a date in the future

 Functions

============

backward(range)

Return a date in the future

Examples

--------

Context: 19 august 2016

```

# Generate a random date time for yesterday

iex > FakerElixir.Date.backward(1)

"2016-08-18 05:58:04Z"

# Generate a random date time for the day before yesterday

iex > FakerElixir.Date.backward(2)

"2016-08-17 00:15:28Z"

# Generate a random date time between yesterday and the day before yesterday

iex > FakerElixir.Date.backward(1..2)

"2016-08-17 03:48:32Z"

```

birthday()

Return birthday date

Examples

--------

```

iex > FakerElixir.Date.birthday

"1988-03-07 16:28:37Z"

```

forward(range)

Return a date in the future

Examples

--------

Context: 19 august 2016

```

# Generate a random date time for tomorrow

iex > FakerElixir.Date.forward(1)

"2016-08-20 19:29:28Z"

# Generate a random date time for after tomorrow

iex > FakerElixir.Date.forward(2)

"2016-08-21 19:06:12Z"

# Generate a random date time between tomorrow and after tomorrow

iex > FakerElixir.Date.forward(1..2)

"2016-08-20 11:18:18Z"

```



 

FakerElixir.File – Faker Elixir (octopus) v1.0.2

if(localStorage.getItem('night-mode')) document.body.className += ' night-mode';

Faker Elixir (octopus) v1.0.2

 FakerElixir.File

================================================

Generate fake data for the domain File

 Summary

==========

[Functions](#functions)

------------------------

[extension()](#extension/0)

Return an extension

[extension(category)](#extension/1)

Return an extension for the category given

[mime()](#mime/0)

Return a mime

[mime(category)](#mime/1)

Return a mime for the category given

[name()](#name/0)

Return a file name

[name(category)](#name/1)

Return a file name for the category given

 Functions

============

extension()

Return an extension

Examples

--------

```

iex> FakerElixir.File.extension

"png"

```

extension(category)

Return an extension for the category given

Allowed categories: `:image`, `:audio`, `:text`, `:video`, `:office`

Examples

--------

```

iex> FakerElixir.File.extension(:audio)

"mp3"

```

mime()

Return a mime

Examples

--------

```

iex> FakerElixir.File.mime

"application/javascript"

```

mime(category)

Return a mime for the category given

Allowed categories: `:application`, `:audio`, `:image`,

`:message`, `:model`, `:multipart`, `:text`, `:video`

Examples

--------

```

iex> FakerElixir.File.mime(:message)

"message/rfc822"

```

name()

Return a file name

Examples

--------

```

iex> FakerElixir.File.name

"aut.css"

```

name(category)

Return a file name for the category given

Allowed categories: `:image`, `:audio`, `:text`, `:video`, `:office`

Examples

--------

```

iex> FakerElixir.File.name(:video)

mollitia.avi"

```



 

FakerElixir.Helper – Faker Elixir (octopus) v1.0.2

if(localStorage.getItem('night-mode')) document.body.className += ' night-mode';

Faker Elixir (octopus) v1.0.2

 FakerElixir.Helper

==================================================

Provide useful helpers

 Summary

==========

[Functions](#functions)

------------------------

[cycle(id, enumerable)](#cycle/2)

Will iterate through the enumerable as a constant cycle. Really useful when you want to seed your database with a pre-defined cycle

[letterify(pattern)](#letterify/1)

Fill a pattern with random letters

[numerify(pattern)](#numerify/1)

Fill a pattern with random number

[pick(enumerable)](#pick/1)

Pick randomly a value in an enumerable

[unique!(id, func)](#unique!/2)

Will generate only unique values for the function given. If **unique!/2** can’t generate an unique value after X tries it raises an **OverflowError**

 Functions

============

cycle(id, enumerable)

Will iterate through the enumerable as a constant cycle. Really useful when you want to seed your database with a pre-defined cycle

**Warning:** The id (first param given) should be unique for each different cycle

Examples

--------

#### Basic

```

iex(1)> FakerElixir.Helper.cycle(:zombies, ["Peter", "Audrey", "Laurent", "Frank"])

"Peter"

iex(2)> FakerElixir.Helper.cycle(:zombies, ["Peter", "Audrey", "Laurent", "Frank"])

"Audrey"

iex(3)> FakerElixir.Helper.cycle(:zombies, ["Peter", "Audrey", "Laurent", "Frank"])

"Laurent"

iex(4)> FakerElixir.Helper.cycle(:zombies, ["Peter", "Audrey", "Laurent", "Frank"])

"Frank"

iex(5)> FakerElixir.Helper.cycle(:zombies, ["Peter", "Audrey", "Laurent", "Frank"])

"Peter"

iex(6)> FakerElixir.Helper.cycle(:zombies, ["Peter", "Audrey", "Laurent", "Frank"])

"Audrey"

iex(7)> FakerElixir.Helper.cycle(:zombies, ["Peter", "Audrey", "Laurent", "Frank"])

"Laurent"

iex(8)> FakerElixir.Helper.cycle(:zombies, ["Peter", "Audrey", "Laurent", "Frank"])

"Frank"

# ... and so on.

```

#### Seed example

```

defmodule Seed do

  alias FakerElixir.Helper

  def make do

    warriors = Stream.repeatedly(fn() -> fixture(:warrior) end)

      |> Enum.take(5)

  end

  defp fixture(:warrior) do

    %{

      name: Helper.cycle(:name, ["anubis", "zeus", "behamut"]),

      lvl: Helper.cycle(:lvl, [10, 25, 90])

    }

  end

end

iex> Seed.make

[

  %{lvl: 10, name: "anubis"},

  %{lvl: 25, name: "zeus"},

  %{lvl: 90, name: "behamut"},

  %{lvl: 10, name: "anubis"},

  %{lvl: 25, name: "zeus"}

]

```

letterify(pattern)

Fill a pattern with random letters

Examples

--------

```

iex > FakerElixir.Helper.letterify("###")

"ahh"

iex > FakerElixir.Helper.letterify("#.#.#.#")

"k.e.n.u"

```

numerify(pattern)

Fill a pattern with random number

Examples

--------

```

iex > FakerElixir.Helper.numerify("Apt. ###")

"Apt. 902"

iex > FakerElixir.Helper.numerify("06.##.##.##.##")

"06.67.18.21.27"

```

pick(enumerable)

Pick randomly a value in an enumerable

Examples

--------

```

iex> FakerElixir.Helper.pick(["paris", "athens", "london"])

"london"

```

```

iex> FakerElixir.Helper.pick(0..100)

51

```

unique!(id, func)

Will generate only unique values for the function given. If **unique!/2** can’t generate an unique value after X tries it raises an **OverflowError**. 

**Warning:** The id (first param given) should be unique for each different unique functions

Examples

--------

### Generate unique emails

```

# Create stream to generate unique emails

stream = Stream.repeatedly(fn ->

  FakerElixir.Helper.unique!(:unique_emails, fn -> FakerElixir.Internet.email(:popular) end)

end)

# Grab 400 unique emails

emails = 

  stream |> Enum.take(400)

```

### Basic Seed

In this example you are sure the names and emails generated in the fixture are unique !

```

defmodule Seed do

  alias FakerElixir.Helper

  def make do

    warriors = Stream.repeatedly(fn() -> fixture(:zombie) end)

      |> Enum.take(50)

  end

  defp fixture(:zombie) do

    %{

      name: Helper.unique!(:names, fn -> FakerElixir.Name.name end),

      email: Helper.unique!(:emails, fn -> FakerElixir.Internet.email(:popular) end)

    }

  end

end

iex> Seed.make

[

  %{email: "leclerc@gmail.com", name: "Mathilde Rousselle"},

  %{email: "sarah@gmail.com", name: "Ambre Marie"},

  %{email: "lola@hotmail.fr", name: "Paul Carton"},

  %{email: "raffin.louise@gmail.com", name: "Lola Beguin"},

  %{email: "de.elisa@yahoo.fr", name: "Enzo Perret"},

  %{email: "clemence.dubos@free.fr", name: "Chloé Devaux"},

  %{email: "justine@hotmail.fr", name: "Mathilde Pouliquen"},

  %{email: "rousselle.jeanne@hotmail.fr", name: "Léo Monin"},

  %{email: "monin.julien@gmail.com", ...},

  %{email: "metais.celia@yahoo.fr", ...}

]

```



 

FakerElixir.Internet – Faker Elixir (octopus) v1.0.2

if(localStorage.getItem('night-mode')) document.body.className += ' night-mode';

Faker Elixir (octopus) v1.0.2

 FakerElixir.Internet

====================================================

Generate fake data for the domain Internet

 Summary

==========

[Functions](#functions)

------------------------

[email()](#email/0)

Return an email

[email(name)](#email/1)

Return an email with the name given

[email(atom, name)](#email/2)

Examples

--------

[password(atom)](#password/1)

Return a password given by an user

[url()](#url/0)

Return an url

[url(atom)](#url/1)

Return an url with https://

[user\_agent()](#user_agent/0)

Return a user agent string

[user\_agent(type)](#user_agent/1)

Return a user agent string for the type given

[user\_name()](#user_name/0)

Return an user name

[user\_name(name)](#user_name/1)

Return an user name for the name given

 Functions

============

email()

Return an email

Examples

--------

```

iex> FakerElixir.Internet.email

"demarcus@ezra.io"

```

You can set `:popular` to generate an email with a popular domain

```

FakerElixir.Internet.email(:popular)

"candelario@gmail.com"

```

You can set `:school` to generate an email with an university domain

```

FakerElixir.Internet.email(:school)

"trycia@uab.edu"

```

email(name)

Return an email with the name given

Examples

--------

```

iex> FakerElixir.Internet.email("Peter Moleski")

"peter.moleski@ethel.net"

```

email(atom, name)

Examples

--------

```

iex> FakerElixir.Internet.email(:popular, "Peter Sobieska")

"peter.sobieska@hotmail.com"

```

```

iex> FakerElixir.Internet.email(:school, "Harry potter")

"harry.potter@pittstate.edu"

```

password(atom)

Return a password given by an user

Examples

--------

```

iex> FakerElixir.Internet.password(:weak)

"robbie"

```

```

iex> FakerElixir.Internet.password(:normal)

"francesco6"

```

```

iex> FakerElixir.Internet.password(:strong)

"tOu%Mt*B16ueLs!0uA3rDA"

```

url()

Return an url

Examples

--------

```

iex> FakerElixir.Internet.url

"http://www.alejandra-connelly.com/"

```

url(atom)

Return an url with https://

Examples

--------

```

iex> FakerElixir.Internet.url(:safe)

"https://www.stefan-little.org/"

```

user\_agent()

Return a user agent string

Examples

--------

```

iex> FakerElixir.Internet.user_agent

"Mozilla/5.0 (iPad; CPU OS 8_1 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Version/8.0 Mobile/12B411 Safari/600.1.4"

```

user\_agent(type)

Return a user agent string for the type given

Allowed types: `:bot`, `:browser`, `:chrome`, `:desktop`,

`:firefox`, `:console`, `:ie`, `:opera`, `:phone`,

`:playstation`, `:safari`, `:tablet`, `:wii`, `:xbox`

Note:

* `:browser` randomly picks a user agent from `:ie`, `:opera`, `:firefox`, `:safari`

* `:console` randomly picks a user agent from `:playstation`, `:xbox`, `:wii`

Examples

--------

```

iex> FakerElixir.Internet.user_agent(:chrome)

"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.124 Safari/537.36"

```

user\_name()

Return an user name

Examples

--------

```

iex> FakerElixir.Internet.user_name

"chadrick"

```

user\_name(name)

Return an user name for the name given

Examples

--------

```

iex> FakerElixir.Internet.user_name("Jeremie GES")

"jeremie.ges"

```



 

FakerElixir.Lorem – Faker Elixir (octopus) v1.0.2

if(localStorage.getItem('night-mode')) document.body.className += ' night-mode';

Faker Elixir (octopus) v1.0.2

 FakerElixir.Lorem

=================================================

Generate fake data for the domain lorem

 Summary

==========

[Functions](#functions)

------------------------

[character()](#character/0)

Return an alpha numeric character

[characters()](#characters/0)

Return some alpha numeric characters

[characters(range)](#characters/1)

Return `x` number of alpha numeric characters within the `range` given or `number` given

[sentence()](#sentence/0)

Return a sentence

[sentences()](#sentences/0)

Return some sentences

[sentences(range)](#sentences/1)

Return `x` sentences within the `range` given or `number` given

[word()](#word/0)

Return a word

[words()](#words/0)

Return some words

[words(range)](#words/1)

Return `x` number of words within the `range` given or `number` given

 Functions

============

character()

Return an alpha numeric character

Examples

--------

```

iex> FakerElixir.Lorem.character

"c"

```

characters()

Return some alpha numeric characters

Examples

--------

```

iex> FakerElixir.Lorem.characters

"0ycp0x"

```

characters(range)

Return `x` number of alpha numeric characters within the `range` given or `number` given

Examples

--------

```

iex> FakerElixir.Lorem.characters(10..30)

"rhch0bceu38240vds"

```

```

iex> FakerElixir.Lorem.characters(10)

"tw3aw6n3ez"

```

sentence()

Return a sentence

Examples

--------

```

iex> FakerElixir.Lorem.sentence

"Qui maiores quaerat iusto quod in totam consequatur perspiciatis necessitatibus vitae ut aut earum voluptas."

```

sentences()

Return some sentences

Examples

--------

```

iex> FakerElixir.Lorem.sentences

"Aspernatur illo dicta quia ut qui nihil distinctio debitis est laudantium ut ipsa facilis dolorum. Sed omnis natus ut officia magnam aut ut vel aperiam."

```

sentences(range)

Return `x` sentences within the `range` given or `number` given

Examples

--------

```

iex> FakerElixir.Lorem.sentences(3..5)

"Culpa velit labore tenetur quia ipsum ullam dolore ut et commodi. Fuga quia dolore nihil non laudantium molestias nemo voluptas ea voluptatum aut aspernatur voluptatem. Repellendus illo dolorem incidunt quasi possimus quam quae alias recusandae unde aliquam optio rem velit sint eum. Quo aliquid itaque ratione eum blanditiis commodi explicabo perspiciatis nesciunt pariatur dolor eius voluptas."

```

```

iex> FakerElixir.Lorem.sentences(2)

"Qui omnis distinctio optio quisquam non optio id sequi assumenda corrupti distinctio et et inventore libero mollitia et. Cum doloremque sapiente mollitia nulla harum pariatur natus voluptates maxime consequuntur sunt commodi blanditiis ut nam."

```

word()

Return a word

Examples

--------

```

iex> FakerElixir.Lorem.word

"et"

```

words()

Return some words

Examples

--------

```

iex> FakerElixir.Lorem.words

"pariatur ea eos quibusdam velit debitis et"

```

words(range)

Return `x` number of words within the `range` given or `number` given

Examples

--------

```

iex> FakerElixir.Lorem.words(2..4)

"laudantium rem saepe qui"

```

```

iex> FakerElixir.Lorem.words(3)

"sapiente optio dolor"

```



 

FakerElixir.Name – Faker Elixir (octopus) v1.0.2

if(localStorage.getItem('night-mode')) document.body.className += ' night-mode';

Faker Elixir (octopus) v1.0.2

 FakerElixir.Name

================================================

Generate fake data for the domain lorem

 Summary

==========

[Functions](#functions)

------------------------

[first\_name()](#first_name/0)

Return a first name

[last\_name()](#last_name/0)

Return a last name

[name()](#name/0)

Return a first name and a last name

[name\_with\_middle()](#name_with_middle/0)

Return a first name, middle name and last name

[prefix()](#prefix/0)

Return a prefix

[suffix()](#suffix/0)

Return a suffix

[title()](#title/0)

Return a title

 Functions

============

first\_name()

Return a first name

Examples

--------

```

iex> FakerElixir.Name.first_name

"Ari"

```

last\_name()

Return a last name

Examples

--------

```

iex> FakerElixir.Name.last_name

"Miller"

```

name()

Return a first name and a last name

Examples

--------

```

iex> FakerElixir.Name.name

"Louie Corkery"

```

name\_with\_middle()

Return a first name, middle name and last name

Examples

--------

```

iex> FakerElixir.Name.name_with_middle

"Annalise Francesco Schowalter"

```

prefix()

Return a prefix

Examples

--------

```

iex> FakerElixir.Name.prefix

"Mr."

```

suffix()

Return a suffix

Examples

--------

```

iex> FakerElixir.Name.suffix

"PhD"

```

title()

Return a title

Examples

--------

```

iex> FakerElixir.Name.title

"Principal Branding Orchestrator"

```



 

FakerElixir.Number – Faker Elixir (octopus) v1.0.2

if(localStorage.getItem('night-mode')) document.body.className += ' night-mode';

Faker Elixir (octopus) v1.0.2

 FakerElixir.Number

==================================================

Generate fake data for the domain Number

 Summary

==========

[Functions](#functions)

------------------------

[between(range)](#between/1)

Return a number between the range given

[between(min, max)](#between/2)

Return a number between the min and max given

[decimal()](#decimal/0)

Return a random decimal number

[decimal(left\_digits)](#decimal/1)

Return a random decimal number with `x` left digits

[decimal(left\_digits, right\_digits)](#decimal/2)

Return a random decimal number with `x` left digits and `x`

right digits

[digit()](#digit/0)

Return a digit

[digits()](#digits/0)

Return random digits

[digits(length)](#digits/1)

Return `x` digits

 Functions

============

between(range)

Return a number between the range given

Examples

--------

```

iex> FakerElixir.Number.between(15..150)

130

```

between(min, max)

Return a number between the min and max given

Examples

--------

```

iex> FakerElixir.Number.between(15, 150)

18

iex> FakerElixir.Number.between(11.22, 13.88)

11.24

iex> FakerElixir.Number.between(12, 12.35)

12.11

```

decimal()

Return a random decimal number

Examples

--------

```

iex> FakerElixir.Number.decimal

"70.8"

```

decimal(left\_digits)

Return a random decimal number with `x` left digits

Examples

--------

```

iex> FakerElixir.Number.decimal(3)

"918.43"

```

decimal(left\_digits, right\_digits)

Return a random decimal number with `x` left digits and `x`

right digits

Examples

--------

```

iex> FakerElixir.Number.decimal(1, 3)

"2.298"

```

digit()

Return a digit

Examples

--------

```

iex> FakerElixir.Number.digit

3

```

digits()

Return random digits

Examples

--------

```

iex> FakerElixir.Number.digits

452

```

digits(length)

Return `x` digits

Examples

--------

```

iex> FakerElixir.Number.digits(4)

7025

```



 

FakerElixir.Phone – Faker Elixir (octopus) v1.0.2

if(localStorage.getItem('night-mode')) document.body.className += ' night-mode';

Faker Elixir (octopus) v1.0.2

 FakerElixir.Phone

=================================================

Generate fake date for the domain Phone

 Summary

==========

[Functions](#functions)

------------------------

[cell()](#cell/0)

Return a cell phone number

[home()](#home/0)

Return a domestic phone number

 Functions

============

cell()

Return a cell phone number

Examples

--------

```

iex> FakerElixir.Phone.cell

"1-714-443-8836"

```

home()

Return a domestic phone number

Examples

--------

```

iex> FakerElixir.Phone.home

"355.369.3998 x19434"

```



 

OverflowError – Faker Elixir (octopus) v1.0.2

if(localStorage.getItem('night-mode')) document.body.className += ' night-mode';

Faker Elixir (octopus) v1.0.2

 OverflowError

 

 exception

==========================================================

 Summary

==========

[Functions](#functions)

------------------------

[exception(msg)](#exception/1)

Callback implementation for `c:Exception.exception/1`

[message(exception)](#message/1)

Callback implementation for `c:Exception.message/1`

 Functions

============

exception(msg)

#### Specs

```

exception([String.t](http://elixir-lang.org/docs/stable/elixir/String.html#t:t/0)) :: [Exception.t](http://elixir-lang.org/docs/stable/elixir/Exception.html#t:t/0)

```

```

exception([Keyword.t](http://elixir-lang.org/docs/stable/elixir/Keyword.html#t:t/0)) :: [Exception.t](http://elixir-lang.org/docs/stable/elixir/Exception.html#t:t/0)

```

Callback implementation for `c:Exception.exception/1`.

message(exception)

#### Specs

```

message([Exception.t](http://elixir-lang.org/docs/stable/elixir/Exception.html#t:t/0)) :: [String.t](http://elixir-lang.org/docs/stable/elixir/String.html#t:t/0)

```

Callback implementation for `c:Exception.message/1`.

