Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/onedebos/naija-faker

An npm package that allows you to generate Nigerian data like names, banks, emails, states and more.
https://github.com/onedebos/naija-faker

naija-faker nigerian-banks nigerian-data nigerian-faker nigerian-names nigerian-states

Last synced: about 1 month ago
JSON representation

An npm package that allows you to generate Nigerian data like names, banks, emails, states and more.

Awesome Lists containing this project

README

        

![release](https://badge.fury.io/js/naija-faker.svg) ![issues](https://img.shields.io/github/issues/onedebos/naija-faker) ![forks](https://img.shields.io/github/forks/onedebos/naija-faker) ![stars](https://img.shields.io/github/stars/onedebos/naija-faker?&color=brightgreen) [![Maintenance](https://img.shields.io/badge/Maintained%3F-yes-green.svg)](https://GitHub.com/onedebos/naija-faker) ![ci](https://travis-ci.com/onedebos/naija-faker.svg?branch=master)
![test](/badges/badge-functions.svg) ![test](/badges/badge-statements.svg) ![test](/badges/badge-branches.svg) ![test](/badges/badge-lines.svg)

# naija-faker

This package helps you generate fake Nigerian data on the fly for use in your projects.

[See it on NPM](https://www.npmjs.com/package/naija-faker)

# Getting Started

**To get started, follow the instructions below**

- install the package `npm install naija-faker`
- import it in your app using:

```js
// if using ES6
import naijaFaker from "naija-faker";

// or

import {
getFirstName,
getLastName,
getPerson,
getPersonList,
getNameList,
getBank,
getState,
getPhoneNumber,
getAddress,
} from "naija-faker";

// without ES6
const naijaFaker = require("naija-faker");
```

- use it!

```js
naijaFaker.getFirstName();
```

# Available methods

### Generate an array of people with first name, last name, age, bank, state and phone number

- To generate an array of people, simply pass an `amt` value to `getPersonList()` i.e `getPersonList({amt: 2})`
- **NB: Default `amt` is 5**

```js
getPersonList({ amt: 2 });
//outputs:
[
{
fName: "abdul",
lName: "qadr",
age: 40,
email: "[email protected]",
state: "ekiti",
phoneNumber: "+234-805-940-4016",
address: "102b, opebi road, opebi, abakaliki",
},
{
fName: "frank",
lName: "edoho",
age: 23,
email: "[email protected]",
state: "delta",
phoneNumber: "+234-705-261-5977",
address: "223, ambeez plaza, zone 5, onne",
},
];
```

### Generate a random First name or Last name

- `getFirstName() //=> 'abraham'`
- `getLastName() //=> 'fatai'`

### Generate a random First name or Last name that starts with a letter/letters

- `getFirstName('r') //=> 'rahman'`
- `getLastName('bo') //=> 'bolanle'`

### Generate a person Object with random values for First name, Last name and Age

- **NB: Default age is between 18 - 50**

```js
getPerson();
// outputs:
{
fName: 'abdul', lName: 'qadr', age: 20,
email: '[email protected]', state:'ekiti',
phoneNumber:'+234-805-940-4016', address: 'plaza 1121, odunuga street, igboho'
}

```

- To change the default `min` and `max` values for age, pass in min and max values as an object like below.

```js
getPerson({ min: 20, max: 50 });
// outputs:
{
fName: 'abdul', lName: 'qadr', age: 40,
email: '[email protected]', state:'ekiti', bank:'Access bank', phoneNumber:'+234-805-940-4016',
networkProvider: 'Globacom',
address: '9329, stanton oval, kwara, kosofe'
}

```

### Generate an array of only names

- Simply pass `amt` to `getNameList()` e.g

**NB: Default `amt` is 5**

```js
getNameList({ amt: 5 });
```

### Generate a random Nigerian state

- Simply call `getState() //=> 'Ondo'`

### Generate a bank name

- Simply call `getBank() //=> 'Access Bank'`

### Generate an address

- Simply call `getAddress() //=> 'Plot 83, Nasarawa, Bauchi'`

### Generate a phone number

- Simply call `getPhoneNumber() //=> '+234-805-940-4016'`

### Test

- To run the tests

```
npm install
npm test
```

## Authors

👤 **Adebola Adeniran**

- Github: [@githubhandle](https://github.com/onedebos)
- Twitter: [@twitterhandle](https://twitter.com/debosthefirst)
- Linkedin: [linkedin](https://www.linkedin.com/in/adebola-niran/)
- Web: [Adebola](https://adebola.dev)

## 🤝 Contributors

👤 **Mayank Bucha**

- Github: [@githubhandle](https://github.com/mayankbucha)
- Linkedin: [linkedin](https://www.linkedin.com/in/mayank-bucha-a50958174/)
- Email: [gmail]([email protected])

👤 **Nikhil Chaurasia**

- Github: [Github](https://github.com/nikhil-chaurasia14)
- Linkedin: [linkedin](https://www.linkedin.com/in/nikhil-chaurasia-613755192)
- Email: [Gmail]([email protected])

## Show your support

Give a ⭐️ if you like this project!

## Acknowledgments

## 📝 License

This project is [MIT](lic.url) licensed.