Skip to content

Commit a8d0b1a

Browse files
committed
Add country name to location block #111
1 parent 53d6e12 commit a8d0b1a

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

api/1.3/api.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
More street/city names for NL dataset
55
Fixed Norwegian id generation bug
66
Fixed Switzerland phone number format
7+
Add country name to location block
78
*/
89

910
const fs = require('fs');
@@ -154,6 +155,7 @@ class Generator {
154155
street: range(1, 9999) + ' ' + randomItem(this.datasets[nat].street),
155156
city: randomItem(this.datasets[nat].cities),
156157
state: randomItem(this.datasets[nat].states),
158+
country: this.fullNatName(nat),
157159
postcode: range(10000, 99999),
158160
coordinates: {
159161
latitude: faker.address.latitude(),
@@ -370,6 +372,28 @@ class Generator {
370372

371373
return password;
372374
}
375+
376+
fullNatName(nat) {
377+
let mapping = {
378+
AU: "australia",
379+
BR: "brazil",
380+
CA: "canada",
381+
CH: "switzerland",
382+
DE: "germany",
383+
DK: "denmark",
384+
ES: "spain",
385+
FI: "finland",
386+
FR: "france",
387+
GB: "united kingdom",
388+
IE: "ireland",
389+
IR: "iran",
390+
NL: "netherlands",
391+
NZ: "new zealand",
392+
TR: "turkey",
393+
US: "united states",
394+
};
395+
return mapping[nat];
396+
}
373397
}
374398

375399
function random(mode, length) {

0 commit comments

Comments
 (0)