diff options
| author | FotoVerite <[email protected]> | 2014-02-17 22:14:46 -0500 |
|---|---|---|
| committer | FotoVerite <[email protected]> | 2014-02-17 22:14:46 -0500 |
| commit | 87d4da49587a7a12ba22607d54f2415962a36faf (patch) | |
| tree | 06aad177e2cc06a6f29ff96859328fbf3ac5a9c9 /scripts | |
| parent | 84ed0c68a0672b5e07b0bcdf2c2b84b2ea07d1b3 (diff) | |
| parent | 6453ba2e877aa71fe1347c66de0c566dfde80f51 (diff) | |
| download | faker-87d4da49587a7a12ba22607d54f2415962a36faf.tar.xz faker-87d4da49587a7a12ba22607d54f2415962a36faf.zip | |
Merge branch 'master' of github.com:cyanos/Faker.js into cyanos-master
Conflicts:
Faker.js
MinFaker.js
Readme.md
examples/js/Faker.js
package.json
Diffstat (limited to 'scripts')
| -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 |
