Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
jiro4989 committed Jan 11, 2021
1 parent f1f8b6f commit 6d7bf8b
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 14 deletions.
14 changes: 14 additions & 0 deletions src/faker/provider/internet/interfaces.nim
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,17 @@ proc safeEmail*(f: Faker): string
proc freeEmail*(f: Faker): string
proc email*(f: Faker): string
proc topLevelDomain*(f: Faker): string

const
safeDomainNames = @["example.org", "example.com", "example.net"]
freeDomainNames = @["gmail.com", "yahoo.co.jp", "hotmail.com"]
topLevelDomains = @["com", "biz", "info", "net", "org"]

proc safeDomainName*(f: Faker): string =
f.rand.sample(safeDomainNames)

proc freeDomainName*(f: Faker): string =
f.rand.sample(freeDomainNames)

proc topLevelDomain*(f: Faker): string =
f.rand.sample(topLevelDomains)
14 changes: 0 additions & 14 deletions src/faker/provider/internet/internet_en_US.nim
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,6 @@ include interfaces
import strutils
import ../person

const
safeDomainNames = @["example.org", "example.com", "example.net"]
freeDomainNames = @["gmail.com", "yahoo.co.jp", "hotmail.com"]
topLevelDomains = @["com", "biz", "info", "net", "org"]

proc safeDomainName*(f: Faker): string =
f.rand.sample(safeDomainNames)

proc freeDomainName*(f: Faker): string =
f.rand.sample(freeDomainNames)

proc safeEmail*(f: Faker): string =
f.firstName.toLower & "@" & f.safeDomainName

Expand All @@ -26,6 +15,3 @@ proc email*(f: Faker): string =
else:
f.safeDomainName
f.firstName.toLower & "@" & domain

proc topLevelDomain*(f: Faker): string =
f.rand.sample(topLevelDomains)
17 changes: 17 additions & 0 deletions src/faker/provider/internet/internet_ja_JP.nim
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
include interfaces
import strutils
import ../person/person_ja_JP

proc safeEmail*(f: Faker): string =
f.firstRomanizedName.toLower & "@" & f.safeDomainName

proc freeEmail*(f: Faker): string =
f.firstRomanizedName.toLower & "@" & f.freeDomainName

proc email*(f: Faker): string =
let domain =
if rand(1) == 0:
f.freeDomainName
else:
f.safeDomainName
f.firstRomanizedName.toLower & "@" & domain

0 comments on commit 6d7bf8b

Please sign in to comment.