/funny-names

Prep for submitting a pull request to Faker

Funny Names

A pull request for the faker library

GL

  • Keep it PG-13
  • No sex, drugs, violence, or racism

Process

Prepare names

Collect names

Separate commas

Resort

Clean up unexpected symbols

&
or
and

Look through Drs and DDS and ists

Make all ists ‘dr’s
Make all DDSs drs
Resort
Cull drs

Remove offensive ones

cock
dick
job
whore
willie
cunt
suck
fuck
nuts
tits
nipples
her
bang
hump
behind
cherry
testicle
ball
sack
sex
gyn
weiner
groin
fanny
blow
moan
ness
pussy
tit

Remove translations (in parentheses)

\s\(.*

Remove duplicates

Remove missed modfiers

-
Commas
or

Remove single words

Read through

Replace hyphens with spaces

Final sort

Prepare code

Fork repo

Run tests and environment

Add tests for change and make pass

Base off of Name api

Faker::Name.name #=> “Tyshawn Johns Sr.” Faker::Name.name_with_middle #=> “Aditya Elton Douglas” Faker::Name.first_name #=> “Kaci” Faker::Name.last_name #=> “Ernser” Faker::Name.prefix #=> “Mr.” Faker::Name.suffix #=> “IV” Faker::Name.title #=> “Legacy Creative Director”

How to organize?
  • Would it be better to store them as arrays based on length (and random from them) or to store them as one array (and use regexes)?
    • The most common operation will be random among them.
    • The less common ones will be finding a name of a certain length or content
API
name

selects from all

with initial

selects one with an initial

first_last

selects two word combos ^([a-zA-Z.-']+\s?){2}$

first_middle_last

selects three word combos

Add docs

Rebase

Fix leak

RuntimeError: Faker::FunnyName.name_with_initial has an entropy leak; use “Faker::Config.random.rand” or “Array#sample(random: Faker::Config.random)”. Method to lookup for: sample, shuffle, rand

Pull request