nf

ng-faker

Generate fake nigerian data with this package

Showing:

Popularity

Downloads/wk

281

GitHub Stars

91

Maintenance

Last Commit

2yrs ago

Contributors

13

Package

Dependencies

0

Size (min+gzip)

11.4KB

License

MIT

Type Definitions

Tree-Shakeable

No?

Categories

Readme

NG-Faker

Build Status Coverage Status star this repo fork this repo npm Open Source Love Open Source Love

Usage

Installation

Install with npm:

npm install ng-faker --save-dev

Install with yarn:

yarn add ng-faker --dev

Browser

For now, we don't have support for the browser directly. We're working on that and should have that up really soon.

Node.js

    var ngfaker = require('ng-faker');

    var randomName = ngfaker.name.firstName(); // Annabelle
    var randomWord = ngfaker.lorem.phrase(); // Thanks so much.

API

ngfaker.fake()

ngfaker contains a super useful generator method ngfaker.fake for combining ngfaker API methods using a mustache string format.

Example

console.log(ngfaker.fake("{{name.prefix}}, {{name.firstName}} {{name.lastName}}"));
// outputs: "Dr. Annabelle Smith"

This will interpolate the format string with the value of methods name.prefix(), name.lastName() and name.firstName().

API Methods

  • account
    • bank
    • accountNumber
  • address
    • state
    • states
    • localGovernment
    • localGovernments
  • lorem
    • word
    • phrase
  • name
    • firstName
    • lastName
    • prefix
    • fullName
  • phone
    • phoneNumber
    • serviceProvider
  • fake
  • random
    • boolean
    • number
    • arrayElement
    • objectElement
    • alphanumeric
    • hexadecimal

Localization

The default language locale is set to English.

Setting a new locale is simple:

var ngfaker = require('ng-faker');
// sets locale to yo (Yoruba)
ngfaker.setLocale("yo");
// or
ngfaker.locale = "yo";
  • yo - Yoruba

  • en - English

  • ha - hausa

  • ig - igbo

  • ek - Efik

  • bn - Benin

  • ur - urhobo

    Other locales will be added soon...

Custom Locale

Adding a new locale is equally easy:

ngFaker.addLocale('ef', {
  title: 'Efik',
  name: [
    "Efik1", "Efik2"
  ],
  lorem: [],
  address: []
})

Tests

    npm run test

Version Release Schedule

If you require the absolute latest version of ng-faker the master branch on the official repo should always be up to date and working.

Maintainers

  • Bolaji Olajide
  • Rotimi Babalola
  • Oyindamola Subair

Contributors


Rotimi Babalola

Bolaji Olajide

Subair Oyindamola

Olamilekan Odukoya

Ayomiga

JCobhams
:---::---::---:

Seun Faluyi

Neiva07

nero-adaware
:---::---::---:

|
sudo-kaizen

ng-faker was inspired by and has used data definitions and logic from:

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100