From eabb008cd53f61ba7730f91bc8c4ece4ad8f821d Mon Sep 17 00:00:00 2001 From: Francisco Lira Date: Thu, 24 Aug 2023 05:51:42 +0100 Subject: [PATCH 1/2] feat(names_pt/br): separate male and female names --- lib/faker/person/pt_br.ex | 325 ++++++++++++++++++++++---------------- 1 file changed, 188 insertions(+), 137 deletions(-) diff --git a/lib/faker/person/pt_br.ex b/lib/faker/person/pt_br.ex index 38b02bc03..300d66ade 100644 --- a/lib/faker/person/pt_br.ex +++ b/lib/faker/person/pt_br.ex @@ -21,9 +21,12 @@ defmodule Faker.Person.PtBr do """ @spec name() :: String.t() def name, do: name(Faker.random_between(0, 9)) - defp name(0), do: "#{prefix()} #{first_name()} #{last_name()} #{suffix()}" - defp name(1), do: "#{prefix()} #{first_name()} #{last_name()}" - defp name(2), do: "#{first_name()} #{last_name()} #{suffix()}" + defp name(0), do: "#{male_prefix()} #{male_first_name()} #{last_name()} #{suffix()}" + defp name(1), do: "#{male_prefix()} #{male_first_name()} #{last_name()}" + defp name(2), do: "#{male_first_name()} #{last_name()} #{suffix()}" + defp name(3), do: "#{male_first_name()} #{last_name()}" + defp name(4), do: "#{female_prefix()} #{female_first_name()} #{last_name()}" + defp name(5), do: "#{female_first_name()} #{last_name()}" defp name(n) when is_integer(n) do "#{first_name()} #{last_name()}" @@ -44,209 +47,127 @@ defmodule Faker.Person.PtBr do "Antonia" """ @spec first_name() :: String.t() - sampler(:first_name, [ + def first_name, do: first_name(Faker.random_between(0, 1)) + defp first_name(0), do: "#{male_first_name()}" + defp first_name(1), do: "#{female_first_name()}" + + @doc """ + Returns a random male first name + + ## Examples + + iex> Faker.Person.PtBr.male_first_name() + "Augusto" + iex> Faker.Person.PtBr.male_first_name() + "Benjamin" + iex> Faker.Person.PtBr.male_first_name() + "Kaique" + iex> Faker.Person.PtBr.male_first_name() + "Frederico" + """ + @spec male_first_name() :: String.t() + sampler(:male_first_name, [ "Alessandro", "Alexandre", - "Alice", - "Alícia", - "Aline", - "Amanda", - "Ana", "Antônio", "Arthur", - "Beatriz", "Benício", "Benjamin", "Bernardo", - "Bianca", "Breno", - "Bruna", "Bryan", "Caio", - "Carla", "Carlos", - "Catarina", - "Cauã", - "Cecília", - "Célia", "César", - "Clara", - "Dalila", "Daniel", "Danilo", "Davi", "Deneval", - "Djalma", - "Eduarda", "Eduardo", "Elísio", "Emanuel", "Emanuelly", "Enrico", "Enzo", - "Esther", "Fabiano", "Fábio", - "Fabrícia", "Fabrício", - "Felícia", "Feliciano", "Felipe", "Félix", - "Fernanda", "Francisco", "Frederico", "Gabriel", - "Gabriela", - "Giovanna", "Gúbio", "Guilherme", "Gustavo", "Heitor", - "Helena", "Hélio", - "Heloísa", "Henrique", "Hugo", "Ígor", "Isaac", - "Isabel", - "Isabela", - "Isabella", - "Isabelly", - "Isadora", - "Isis", - "Janaína", - "Joana", "João", "Joaquim", - "Júlia", "Júlio", - "Karla", "Kléber", - "Ladislau", - "Lara", - "Larissa", - "Laura", - "Lavínia", "Leonardo", - "Letícia", - "Lívia", - "Lorena", "Lorenzo", - "Lorraine", "Lucas", "Lucca", - "Luiza", - "Manuela", - "Marcela", "Marcelo", - "Márcia", "Márcio", "Marcos", - "Margarida", - "Maria", - "Mariana", - "Marina", - "Marli", "Matheus", - "Meire", - "Melissa", - "Mércia", "Miguel", - "Morgana", "Murilo", - "Natália", "Nataniel", "Nicolas", "Nicole", "Norberto", - "Núbia", - "Ofélia", "Pablo", - "Paula", "Paulo", "Pedro", "Pietro", "Rafael", - "Rafaela", "Raul", - "Rebeca", "Ricardo", - "Roberta", "Roberto", "Salvador", "Samuel", - "Sara", - "Sarah", "Silas", - "Sílvia", "Sirineu", - "Sophia", - "Suélen", - "Talita", "Tertuliano", "Theo", "Thiago", "Thomas", - "Valentina", "Vicente", "Víctor", "Vinicius", "Vitor", - "Vitória", "Warley", "Washington", "Yago", "Yango", - "Yasmin", "Yuri", - "Adriana", - "Agatha", - "Alessandra", - "Allana", - "Ana Beatriz", - "Ana Cecília", - "Ana Clara", - "Ana Júlia", - "Ana Laura", - "Ana Lívia", - "Ana Luiza", - "Ana Sophia", - "Ana Vitória", "André", "Anthony", - "Antonella", - "Antonia", "Arthur Gabriel", "Arthur Henrique", "Arthur Miguel", "Augusto", - "Aurora", - "Ayla", - "Bárbara", "Bento", "Bruno", - "Calebe", - "Camila", "Carlos Eduardo", - "Carolina", - "Clarice", "Davi Lucas", "Davi Lucca", "Davi Luiz", "Davi Miguel", - "Elisa", - "Eloah", - "Emilly", "Enzo Gabriel", "Enzo Miguel", "Erick", "Fernando", - "Francisca", - "Gabrielly", "Gael", - "Giulia", "Henry", "Ian", "Igor", @@ -259,15 +180,10 @@ defmodule Faker.Person.PtBr do "João Pedro", "João Vitor", "José", - "Juliana", "Kaique", "Kauê", - "Laís", "Levi", - "Liz", - "Louise", "Luan", - "Luana", "Lucas Gabriel", "Luiz", "Luiz Felipe", @@ -275,6 +191,147 @@ defmodule Faker.Person.PtBr do "Luiz Henrique", "Luiz Miguel", "Luiz Otávio", + "Mathias", + "Nathan", + "Noah", + "Oliver", + "Otávio", + "Pedro Henrique", + "Pedro Henrique", + "Pedro Lucas", + "Pedro Miguel", + "Rodrigo", + "Ruan", + "Ryan", + "Tiago", + "Tomás", + "Vinícius", + "Vitor Hugo" + ]) + + @doc """ + Returns a random female first name + + ## Examples + + iex> Faker.Person.PtBr.female_first_name() + "Luna" + iex> Faker.Person.PtBr.female_first_name() + "Amanda" + iex> Faker.Person.PtBr.female_first_name() + "Maria Isis" + iex> Faker.Person.PtBr.female_first_name() + "Antonia" + """ + + @spec female_first_name() :: String.t() + sampler(:female_first_name, [ + "Alice", + "Alícia", + "Aline", + "Amanda", + "Ana", + "Beatriz", + "Bianca", + "Bruna", + "Carla", + "Catarina", + "Cauã", + "Cecília", + "Célia", + "Clara", + "Dalila", + "Djalma", + "Eduarda", + "Esther", + "Fabrícia", + "Felícia", + "Fernanda", + "Gabriela", + "Giovanna", + "Helena", + "Heloísa", + "Isabel", + "Isabela", + "Isabella", + "Isabelly", + "Isadora", + "Isis", + "Janaína", + "Joana", + "Júlia", + "Karla", + "Ladislau", + "Lara", + "Larissa", + "Laura", + "Lavínia", + "Letícia", + "Lívia", + "Lorena", + "Lorraine", + "Luiza", + "Manuela", + "Marcela", + "Márcia", + "Margarida", + "Maria", + "Mariana", + "Marina", + "Marli", + "Meire", + "Melissa", + "Mércia", + "Morgana", + "Natália", + "Núbia", + "Ofélia", + "Paula", + "Rafaela", + "Rebeca", + "Roberta", + "Sara", + "Sarah", + "Sílvia", + "Sophia", + "Suélen", + "Talita", + "Valentina", + "Vitória", + "Yasmin", + "Adriana", + "Agatha", + "Alessandra", + "Allana", + "Ana Beatriz", + "Ana Cecília", + "Ana Clara", + "Ana Júlia", + "Ana Laura", + "Ana Lívia", + "Ana Luiza", + "Ana Sophia", + "Ana Vitória", + "Antonella", + "Antonia", + "Aurora", + "Ayla", + "Bárbara", + "Calebe", + "Camila", + "Carolina", + "Clarice", + "Elisa", + "Eloah", + "Emilly", + "Francisca", + "Gabrielly", + "Giulia", + "Juliana", + "Laís", + "Liz", + "Louise", + "Luana", "Luna", "Maitê", "Malu", @@ -294,31 +351,15 @@ defmodule Faker.Person.PtBr do "Maria Valentina", "Maria Vitória", "Mariah", - "Mathias", "Maya", "Milena", "Mirella", - "Nathan", - "Noah", - "Oliver", "Olívia", - "Otávio", "Patricia", - "Pedro Henrique", - "Pedro Henrique", - "Pedro Lucas", - "Pedro Miguel", "Pérola", "Pietra", - "Rodrigo", - "Ruan", - "Ryan", "Sophie", - "Stella", - "Tiago", - "Tomás", - "Vinícius", - "Vitor Hugo" + "Stella" ]) @doc """ @@ -601,25 +642,35 @@ defmodule Faker.Person.PtBr do ]) @doc """ - Returns a random prefix + Returns a random male prefix ## Examples - iex> Faker.Person.PtBr.prefix() + iex> Faker.Person.PtBr.male_prefix() "Sr." - iex> Faker.Person.PtBr.prefix() + iex> Faker.Person.PtBr.male_prefix() + "Dr." + """ + @spec male_prefix() :: String.t() + sampler(:male_prefix, [ + "Sr.", + "Dr." + ]) + + @doc """ + Returns a random female_prefix + + ## Examples + + iex> Faker.Person.PtBr.female_prefix() "Sra." - iex> Faker.Person.PtBr.prefix() - "Sr." - iex> Faker.Person.PtBr.prefix() + iex> Faker.Person.PtBr.female_prefix() "Dra." """ - @spec prefix() :: String.t() - sampler(:prefix, [ - "Sr.", + @spec female_prefix() :: String.t() + sampler(:female_prefix, [ "Sra.", "Srta.", - "Dr.", "Dra." ]) From a4720dad9724ae7215cf61d6f213d0a10449d92f Mon Sep 17 00:00:00 2001 From: Francisco Lira Date: Thu, 24 Aug 2023 14:56:09 +0100 Subject: [PATCH 2/2] correct tests --- CHANGELOG.md | 14 ++++++++++++ lib/faker.ex | 2 +- lib/faker/address.ex | 2 +- lib/faker/address/pt_br.ex | 32 +++++++++++++-------------- lib/faker/file.ex | 20 ++++++++--------- lib/faker/lorem.ex | 2 +- lib/faker/person/pt_br.ex | 44 +++++++++++++++++++++----------------- lib/faker/util.ex | 6 +++--- 8 files changed, 70 insertions(+), 52 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ef1e56ead..ff32fd280 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,19 +9,27 @@ Change log itself follows [Keep a CHANGELOG](http://keepachangelog.com) format. ## Unreleased ### Added + - `Faker.Fruits.En` - add english fruits [[@KevinDaSilvaS](https://github.com/KevinDaSilvaS)] +- `Faker.Person.PtBr.female_first_name` - add Brazilian Portuguese female first name generator [[@FranciscoLira](https://github.com/FranciscoLira)] +- `Faker.Person.PtBr.male_first_name` - add Brazilian Portuguese male first name generator [[@FranciscoLira](https://github.com/FranciscoLira)] +- `Faker.Person.PtBr.female_prefix` - add Brazilian Portuguese female prefix generator [[@FranciscoLira](https://github.com/FranciscoLira)] +- `Faker.Person.PtBr.male_prefix` - add Brazilian Portuguese male prefix generator [[@FranciscoLira](https://github.com/FranciscoLira)] ### Changed + - `Faker.Commerce.PtBr` - add more products in product_name_product [[@igorgbr](https://github.com/igorgbr)] - `Faker.Fruits.PtBr` - fix typo in nectarina [[@KevinDaSilvaS](https://github.com/KevinDaSilvaS)] - `Faker.Internet.image_url/0` - switched unresponsive placeholder.it with picsum.photos [[@almirsarajcic](https://github.com/almirsarajcic)] - `Faker.Vehicle.En` - fix spelling of some common makes/models [[@nskins](https://github.com/nskins)] +- `Faker.Person.PtBr.first_name` - separate male from female names. [[@FranciscoLira](https://github.com/FranciscoLira)] ### Deprecated ### Removed ### Fixed + - `Faker.Currency.code/0` remove duplicates/replace old currencies [[@yassinrais](https://github.com/yassinrais)] - `Faker.Adress.PtBr` - fix model documentation [[@laraujo7](https://github.com/laraujo7)] - `Faker.Address.En/0` corrected formatting for US and Britian [[@atavistock](https://github.com/atavistock)] @@ -31,6 +39,7 @@ Change log itself follows [Keep a CHANGELOG](http://keepachangelog.com) format. ## 0.17.0 ### Added + - `Faker.Internet.StatusCode` [[@emmetreza](https://github.com/emmetreza)] - CI workflow using GitHub Actions [[@anthonator](https://github.com/anthonator)] - `Faker.Cat.PtBr` [[@f-francine](https://github.com/f-francine)] @@ -39,6 +48,7 @@ Change log itself follows [Keep a CHANGELOG](http://keepachangelog.com) format. - `Faker.Commerce.PtBr` [[@f-francine](https://github.com/f-francine)] ### Changed + - `Faker.Vehicles` add makes and models that are multi-word, refactor existing fns [[jersearls](https://github.com/jersearls)] - `Faker.Avatar` switch to `https` to prevent redirect [[igas](https://github.com/igas)] - Updated build badge for GitHub Actions [[@anthonator](https://github.com/anthonator)] @@ -46,6 +56,7 @@ Change log itself follows [Keep a CHANGELOG](http://keepachangelog.com) format. ### Deprecated ### Removed + - Travis CI for CI workflow [[@anthonator](https://github.com/anthonator)] ### Fixed @@ -53,6 +64,7 @@ Change log itself follows [Keep a CHANGELOG](http://keepachangelog.com) format. - `Faker.Team` `creature/0` and `name/0` documentation examples fixed [[@yuriploc](https://github.com/yuriploc)] - Fix bidirectional formatting [[@MichalDolata](https://github.com/MichalDolata)] - Extra split for Virgin Islands in the country sampler [[intercaetera](https://github.com/intercaetera)] + ### Security ## 0.16.0 @@ -127,6 +139,7 @@ Change log itself follows [Keep a CHANGELOG](http://keepachangelog.com) format. - `Faker.Phone.PtBr`[[@netond](https://github.com/netond)] ### Changed + - Fix `Faker.Code.Iban.iban` and `Faker.Gov.It.fiscal_id` doctests [[@vbrazo](https://github.com/vbrazo)] - `Faker.Address.Es` [[@emig](https://github.com/emig)] - Set minimum Elixir version to 1.6 @@ -145,6 +158,7 @@ Change log itself follows [Keep a CHANGELOG](http://keepachangelog.com) format. - Elixir 1.4 and 1.5 support ### Fixed + - `Faker.Util.upper_letter/0` documentation examples [[@michaelfich](https://github.com/michaelfich)] ### Security diff --git a/lib/faker.ex b/lib/faker.ex index 337a4ec11..6560d503d 100644 --- a/lib/faker.ex +++ b/lib/faker.ex @@ -47,7 +47,7 @@ defmodule Faker do acc end - @alphabet 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz' + @alphabet ~c"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" defp letter do Enum.at(@alphabet, random_between(0, Enum.count(@alphabet) - 1)) end diff --git a/lib/faker/address.ex b/lib/faker/address.ex index 30f276635..5c7dc7c19 100644 --- a/lib/faker/address.ex +++ b/lib/faker/address.ex @@ -3,7 +3,7 @@ defmodule Faker.Address do alias Faker.Person - @geobase32 '0123456789bcdefghjkmnpqrstuvwxyz' + @geobase32 ~c"0123456789bcdefghjkmnpqrstuvwxyz" @moduledoc """ Functions for generating addresses. diff --git a/lib/faker/address/pt_br.ex b/lib/faker/address/pt_br.ex index 032c11286..9e93f9231 100644 --- a/lib/faker/address/pt_br.ex +++ b/lib/faker/address/pt_br.ex @@ -34,13 +34,13 @@ defmodule Faker.Address.PtBr do ## Examples iex> Faker.Address.PtBr.city() - "Senador Kaique Paulista" + "Senador Suélen das Pedras" iex> Faker.Address.PtBr.city() - "São Roberta dos Dourados" + "São Pedro Lucas do Sul" iex> Faker.Address.PtBr.city() - "Salto das Flores" + "Três Pedro Henrique" iex> Faker.Address.PtBr.city() - "Kléber" + "João Gabriel Alegre" """ @spec city() :: String.t() def city do @@ -1034,13 +1034,13 @@ defmodule Faker.Address.PtBr do ## Examples iex> Faker.Address.PtBr.street_address() - "Estação Kaique, 2" + "Estação Suélen, 646" iex> Faker.Address.PtBr.street_address() - "Lagoa Matheus, 0832" + "Recanto Arthur, 970" iex> Faker.Address.PtBr.street_address() - "Estrada Diegues, s/n" + "Trecho Júlia Viana, s/n" iex> Faker.Address.PtBr.street_address() - "Praia Limeira, 020" + "Passarela Morais, s/n" """ @spec street_address() :: String.t() def street_address do @@ -1053,13 +1053,13 @@ defmodule Faker.Address.PtBr do ## Examples iex> Faker.Address.PtBr.street_address(true) - "Estação Kaique, 2 Sala 461" + "Estação Suélen, 646 AP 083" iex> Faker.Address.PtBr.street_address(false) - "Conjunto Rodrigo, 970" + "Setor da Penha, s/n" iex> Faker.Address.PtBr.street_address(false) - "Trecho Davi Luiz Limeira, 020" + "Trecho Júlia Viana, s/n" iex> Faker.Address.PtBr.street_address(false) - "Sítio Maria Eduarda, 097" + "Passarela Morais, s/n" """ @spec street_address(true | any) :: String.t() def street_address(true), do: street_address() <> " " <> secondary_address() @@ -1071,13 +1071,13 @@ defmodule Faker.Address.PtBr do ## Examples iex> Faker.Address.PtBr.street_name() - "Estação Kaique" + "Estação Suélen" iex> Faker.Address.PtBr.street_name() - "Morro Louise Macieira" + "Colônia Macieira" iex> Faker.Address.PtBr.street_name() - "Loteamento Maria Alice Junqueira" + "Loteamento Emanuel Albuquerque" iex> Faker.Address.PtBr.street_name() - "Condomínio da Maia" + "Setor da Penha" """ @spec street_name() :: String.t() def street_name do diff --git a/lib/faker/file.ex b/lib/faker/file.ex index bfc99194a..2c7860423 100644 --- a/lib/faker/file.ex +++ b/lib/faker/file.ex @@ -39,13 +39,13 @@ defmodule Faker.File do ## Examples iex> Faker.File.file_extension() - "wav" + "txt" iex> Faker.File.file_extension() - "wav" + "html" iex> Faker.File.file_extension() - "doc" + "flac" iex> Faker.File.file_extension() - "mov" + "odt" """ @spec file_extension() :: String.t() def file_extension do @@ -84,11 +84,11 @@ defmodule Faker.File do iex> Faker.File.file_name() "aliquam.jpg" iex> Faker.File.file_name() - "deleniti.doc" + "deleniti.flac" iex> Faker.File.file_name() "qui.jpg" iex> Faker.File.file_name() - "quibusdam.csv" + "quibusdam.webm" """ @spec file_name() :: String.t() def file_name do @@ -121,13 +121,13 @@ defmodule Faker.File do ## Examples iex> Faker.File.mime_type() - "text/css" + "model/mesh" iex> Faker.File.mime_type() - "message/http" + "image/tiff" iex> Faker.File.mime_type() - "application/ogg" + "message/partial" iex> Faker.File.mime_type() - "model/x3d+xml" + "audio/webm" """ @spec mime_type :: String.t() def mime_type do diff --git a/lib/faker/lorem.ex b/lib/faker/lorem.ex index 1dd90af1c..eb1b1b6a9 100644 --- a/lib/faker/lorem.ex +++ b/lib/faker/lorem.ex @@ -498,7 +498,7 @@ defmodule Faker.Lorem do end defp character do - alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789' + alphabet = ~c"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789" Enum.at(alphabet, Faker.random_between(0, Enum.count(alphabet) - 1)) end end diff --git a/lib/faker/person/pt_br.ex b/lib/faker/person/pt_br.ex index 300d66ade..4265f309c 100644 --- a/lib/faker/person/pt_br.ex +++ b/lib/faker/person/pt_br.ex @@ -11,22 +11,26 @@ defmodule Faker.Person.PtBr do ## Examples iex> Faker.Person.PtBr.name() - "Sra. Kaique Mendes Neto" + "Dr. Hélio Mendes Neto" iex> Faker.Person.PtBr.name() - "Roberta Garcês" + "Bernardo Mangueira" iex> Faker.Person.PtBr.name() - "Sr. Vitor Albuquerque" + "Sr. Arthur Santana Neto" iex> Faker.Person.PtBr.name() - "Maria Laura da Penha Jr." + "João Gabriel Resende" """ @spec name() :: String.t() - def name, do: name(Faker.random_between(0, 9)) + def name, do: name(Faker.random_between(0, 12)) defp name(0), do: "#{male_prefix()} #{male_first_name()} #{last_name()} #{suffix()}" defp name(1), do: "#{male_prefix()} #{male_first_name()} #{last_name()}" defp name(2), do: "#{male_first_name()} #{last_name()} #{suffix()}" defp name(3), do: "#{male_first_name()} #{last_name()}" - defp name(4), do: "#{female_prefix()} #{female_first_name()} #{last_name()}" - defp name(5), do: "#{female_first_name()} #{last_name()}" + + defp name(i) when i == 4 or i == 5, + do: "#{female_prefix()} #{female_first_name()} #{last_name()}" + + defp name(i) when i == 6 or i == 7, + do: "#{female_first_name()} #{last_name()}" defp name(n) when is_integer(n) do "#{first_name()} #{last_name()}" @@ -38,16 +42,16 @@ defmodule Faker.Person.PtBr do ## Examples iex> Faker.Person.PtBr.first_name() - "Augusto" + "Luiz Henrique" iex> Faker.Person.PtBr.first_name() - "Amanda" + "Suélen" iex> Faker.Person.PtBr.first_name() - "Kaique" + "Arthur Henrique" iex> Faker.Person.PtBr.first_name() - "Antonia" + "Bernardo" """ @spec first_name() :: String.t() - def first_name, do: first_name(Faker.random_between(0, 1)) + def first_name(), do: first_name(Faker.random_between(0, 1)) defp first_name(0), do: "#{male_first_name()}" defp first_name(1), do: "#{female_first_name()}" @@ -57,13 +61,13 @@ defmodule Faker.Person.PtBr do ## Examples iex> Faker.Person.PtBr.male_first_name() - "Augusto" + "Bruno" iex> Faker.Person.PtBr.male_first_name() - "Benjamin" + "Luiz Henrique" iex> Faker.Person.PtBr.male_first_name() - "Kaique" + "Hélio" iex> Faker.Person.PtBr.male_first_name() - "Frederico" + "Mathias" """ @spec male_first_name() :: String.t() sampler(:male_first_name, [ @@ -215,13 +219,13 @@ defmodule Faker.Person.PtBr do ## Examples iex> Faker.Person.PtBr.female_first_name() - "Luna" + "Maria Helena" iex> Faker.Person.PtBr.female_first_name() - "Amanda" + "Alessandra" iex> Faker.Person.PtBr.female_first_name() - "Maria Isis" + "Ayla" iex> Faker.Person.PtBr.female_first_name() - "Antonia" + "Suélen" """ @spec female_first_name() :: String.t() diff --git a/lib/faker/util.ex b/lib/faker/util.ex index 34bae38d1..677ec22f6 100644 --- a/lib/faker/util.ex +++ b/lib/faker/util.ex @@ -51,7 +51,7 @@ defmodule Faker.Util do iex> Faker.Util.sample_uniq(0, &Faker.Internet.email/0) ** (FunctionClauseError) no function clause matching in Faker.Util.sample_uniq/3 """ - @spec sample_uniq(pos_integer, (() -> any), MapSet.t()) :: [any] + @spec sample_uniq(pos_integer, (-> any), MapSet.t()) :: [any] def sample_uniq(count, sampler, acc \\ MapSet.new()) when is_integer(count) and count > 0 and is_function(sampler, 0) do case MapSet.size(acc) do @@ -84,7 +84,7 @@ defmodule Faker.Util do Enum.map(0..(n - 1), &fun.(&1)) end - @spec list(integer, (() -> any)) :: [any] + @spec list(integer, (-> any)) :: [any] def list(n, fun) when is_function(fun, 0) do Enum.map(0..(n - 1), fn _ -> fun.() end) end @@ -103,7 +103,7 @@ defmodule Faker.Util do iex> Faker.Util.join(2, " or ", &Faker.Color.name/0) "Purple or White" """ - @spec join(integer, binary, (() -> binary)) :: binary + @spec join(integer, binary, (-> binary)) :: binary def join(n, joiner \\ "", fun) do Enum.join(list(n, fun), joiner) end