File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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
910const 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
375399function random ( mode , length ) {
You can’t perform that action at this time.
0 commit comments