0.1.0 • Published 5 years ago
tfaker v0.1.0
tfaker.js
Faking Targaryen data has never been easier
Compatibility
Zero dependencies policy is to ensure tfaker long-term compatibility with 0.10.48.
Import
var tfaker = require("tfaker"); // everywhere with npm (tfaker is in node_modules)
var tfaker = require("./tfaker"); // locally with git clone (absolute path to tfaker/index.js)
Methods
Targaryens
- tfaker.firstName()
// random output => "Aegon"
- tfaker.lastName()
// output => "Targaryen"
- tfaker.fullName()
// random output => "Visenya Targaryen"
- tfaker.dragon()
// random output => "Meraxes"
- tfaker.email()
// random output => "dragonchan35@dragonstone.wst"
- tfaker.country()
// random output => "Westeros"
- tfaker.region()
// random output => "The Red Waste"
- tfaker.city()
// random output => "Braavos"
Kittens
- tfaker.placeKitten()
// display 100px kitten image. output => "http://placekitten.com/100/100"
NB: this method can also use one or two Integer arguments, translating into width & height in pixels:
tfaker.placeKitten(420); // one parameter for squares => "http://placekitten.com/420/420"
tfaker.placeKitten(800, 600); // two for width & height => "http://placekitten.com/800/600"
Utils
- tfaker.realDate()
// random Date(last century) => "Wed Jul 31 1985 00:10:18 GMT+0100(CEST)"
- tfaker.islamicDate()
// islamic new Date(); output => "Jumuah, 28 Muharram 1441 AH"
NB: this method accepts either an adjustment Integer parameter, or a "zif" / "fake" string parameter:
tfaker.islamicDate(1); // returns islamicDate(1) +1 day => "Jumuah, 29 Muharram 1441 AH".
tfaker.islamicDate("zif"); // returns random past date within 8O years => "Sabt, 4 Jumadal Ula 1384 AH"
tfaker.islamicDate("fake"); // works the same
Stumbled upon this function while searching for lunar calendars for Westeros. Since faker.js doesn't have this feature, I've thought it would be cool to have. Afterall the Valyrian Freehold was very tolerant of other religions.
EZ Tweaks
Each file in ./content
is named after the method calling it, and is basically an array of content. You can customize any of those methods by dropping your stuff into the array.
F.A.Q
Have you heard about Babeljs
Babeljs is an awesome, one of a kind library * thumbs up *
Issues (jk! if anything PLEASE DO)
Pull Requests
What's next
./TODO.md
Credits
- faker.js obviously the main inspiration source. Excellent library that I intend to continue to use in harmony with mine.
- Dany for the
"bEsT sEaSoN eVEr"
and also best eyebrows. - placekitten.com for the awesome free service. Click 'em
- jeffreylancaster This goldmine helped me to parse stuff like cities & regions. Thank you !
- al-habib.info Liked your function for being both concise and digestible.