Install with npm:
npm install ng-faker --save-dev
Install with yarn:
yarn add ng-faker --dev
For now, we don't have support for the browser directly. We're working on that and should have that up really soon.
var ngfaker = require('ng-faker');
var randomName = ngfaker.name.firstName(); // Annabelle
var randomWord = ngfaker.lorem.phrase(); // Thanks so much.
ngfaker contains a super useful generator method ngfaker.fake for combining ngfaker API methods using a mustache string format.
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().
- 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
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...
Adding a new locale is equally easy:
ngFaker.addLocale('ef', {
title: 'Efik',
name: [
"Efik1", "Efik2"
],
lorem: [],
address: []
})
npm run test
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.
- Bolaji Olajide
- Rotimi Babalola
- Oyindamola Subair
![]() 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: