Generating Fake Nigerian data for Javascript Applications

Rotimi Babalola
Backticks & Tildes
Published in
2 min readMar 13, 2018

Generating fake data for your JS applications can be a hassle sometimes. Thankfully there are packages like faker.js that help us with this problem. But as a developer in Nigeria, there are times you want to generate fake Nigerian data on the fly. Maybe you to populate a drop-down with all the 36 states of the federation or you want to seed a database with some Igbo or Hausa names. Generating this data all by yourself can be a hassle which is why we decided to create ng-faker 😎💃

Quick ng-faker example

const ngfaker = require('ng-faker');const firstName = ngfaker.name.firstName();
const lastName = ngfaker.name.lastName();
const fullName = ngfaker.name.fullName();
const localGovernment = ngfaker.address.localGovernment();
const phoneNumber = ngfaker.phone.phoneNumber();

Check the API docs for the full list of methods.

Locales

Locales determine what kind of data is generated by ng-faker. By default, it’s set to English but you can change it by doing:

// sets locale to Yoruba
ngfaker.setLocale("yo");
ngfaker.name.firstName(); // Oyinda// sets locale to Igbo
ngfaker.setLocale("ig");
ngfaker.name.firstName(); // Akunna// sets locale to Hausa
ngfaker.setLocale("ha");
ngfaker.name.firstName(); // Aishah

For now, only 4 locales —English, Hausa, Igbo, and Yoruba are supported. We are looking to add more locales soon and we encourage anyone who has data to support us with a pull request. 😉

Contributing

Open source contributions are welcome and in fact encouraged. If you have a list of names (for a different locale e.g. Ijaw, Efik, Birom, Igala etc.) or you want to expand the current list of names feel free to raise a pull request with your contributions. If coding is not your thing, you can raise an issue with your contributions.

Furthermore, if you have bug fixes, feature requests or anything let us know on the GitHub repo or via email.

We hope you enjoy using this package. Happy coding!!!

--

--