diff options
| author | Matthew Bergman <[email protected]> | 2014-02-17 22:33:03 -0500 |
|---|---|---|
| committer | Matthew Bergman <[email protected]> | 2014-02-17 22:33:03 -0500 |
| commit | 31d526a4897d150ffd90ebddd2ec1291fdaedc72 (patch) | |
| tree | 0d89bf88523b377f25e5e8fb7160ce10bfbc057e /scripts/import.js | |
| parent | 47527ec7391b15f915b25e983da80e98360ed04a (diff) | |
| parent | d470a1009058a02706c53379c5019ad43ed924e1 (diff) | |
| download | faker-31d526a4897d150ffd90ebddd2ec1291fdaedc72.tar.xz faker-31d526a4897d150ffd90ebddd2ec1291fdaedc72.zip | |
Merge pull request #70 from FotoVerite/master
Keep up to date.
Diffstat (limited to 'scripts/import.js')
| -rw-r--r-- | scripts/import.js | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/scripts/import.js b/scripts/import.js new file mode 100644 index 00000000..546915c2 --- /dev/null +++ b/scripts/import.js @@ -0,0 +1,23 @@ +var fs = require( "fs" ); + +function importNames( inputFile, outputFile ) { + var input = fs.readFileSync( __dirname + "/" + inputFile ), + names = String( input ).split( "\n" ), + output; + + names = names + .map( function( name ) { + name = name.trim(); + name = name.charAt( 0 ).toUpperCase() + name.substr( 1 ).toLowerCase(); + return name; + }).filter( function( name ) { + return name !== ""; + }); + + output = "module.exports = [\n '" + names.join( "',\n '" ) + "'\n];\n"; + + fs.writeFileSync( __dirname + "/" + outputFile, output ); +} + +importNames( "../data/male-names.txt", "../lib/male_names.js" ); +importNames( "../data/female-names.txt", "../lib/female_names.js" );
\ No newline at end of file |
