Code Monkey home page Code Monkey logo

naija-faker's Introduction

Naija Faker

npm (scoped) npm (scoped) npm (scoped)

Naija Faker is a javascript library that generates fake typical nigerian data ranging from name, address, phone number, lgas and states for you.

Installation

Install the package in your existing project

npm install @codegrenade/naija-faker

Basic Usage/Examples

Import or require the the package in your project to initialize the faker generator.

import faker from '@codegrenade/naija-faker'

or

const faker = require('@codegrenade/naija-faker)

Configuration for data choice (optional)

sets default language and gender for names to be generated and the local network provider for phone number

faker.config({
	language: "yoruba",
	gender: "male",
	network: "glo",
})

NB: Yoruba, Igbo and Hausa are the only Nigerian languages supported at the moment.

Generate fake data by calling faker methods.

faker.title() // Mrs.

faker.name() // Temilade Abolade

faker.address() // 45, Alhaji Kazeem Street, Kaduna

faker.phoneNumber() // 09123456634

faker.email() // [email protected]

faker.states() // array of states in Nigeria

faker.lgas() // array of states in Nigeria
// call to person method
faker.person() 

// object of person details
{
  title: 'Engr.',
  firstName: 'Akintunde',
  lastName: 'Owoyele',
  fullName: 'Akintunde Owoyele',
  email: '[email protected]',
  phone: '+2349093636382',
  address: '63, Ebubedike Uzoma Avenue, Awka'
}

If you want a person of a particular language and gender

// returns person details of a male from the hausa language
faker.person("hausa", "male") 
// call to people method
faker.people()

// array of person objects
[
{
  title: 'Engr.',
  firstName: 'Akintunde',
  lastName: 'Owoyele',
  fullName: 'Akintunde Owoyele',
  email: '[email protected]',
  phone: '+2349093636382',
  address: '63, Ebubedike Uzoma Avenue, Awka'
}
{
  title: 'Mr.',
  firstName: 'Olayinka',
  lastName: 'Adedayo',
  fullName: 'Olayinka Adedayo',
  email: '[email protected]',
  phone: '+2348189416772',
  address: 'Km 9, Lanre Ayotunde Crescent, Ilorin'
}
]

The people method returns 10 persons by default. If you want more persons to be returned by the method, use the example below.

faker.peole(20) // returns 20 persons in the array

Specifing desired parameter values

// returns a male title
faker.title("male") 

// returns an igbo language name
faker.name("igbo") 

// returns a yoruba name for the male gender
faker.name("yoruba", "male") 

// returns a phone number from the mtn network
faker.phoneNumber("mtn")

// returns an email address from the name supplied
faker.email("Aboderin Joshua")

Contributing

Please feel free to fork the package and contribute by submitting a pull request to enhance the functionlities.

License

Naija Faker is release under the MIT License. See LICENSE for details.

Feedback

If you have any feedback, please reach out to me at [email protected]

Author

naija-faker's People

Contributors

detunjisamuel avatar kodegrenade avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.