Git Product home page Git Product logo

ng-faker's Introduction

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:

ng-faker's People

Contributors

akhilome avatar ayomi-kun avatar bolajiolajide avatar mykeels avatar neiva07 avatar nero-adaware avatar nero2009 avatar olamilekan000 avatar orimdominic avatar seunzone 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.