Skip to content

Latest commit

 

History

History
82 lines (59 loc) · 2.92 KB

README.md

File metadata and controls

82 lines (59 loc) · 2.92 KB

ember-fakerjs

NPM Build Status Ember Observer Score Ember Version Download count Code Climate Test Coverage

Faker.js template helpers.

This addon provides helpers that can assist with adding fake/fixture data to your applications. This can be especially useful when scaffolding your application or building demos.

Installation

ember install ember-fakerjs

Demo

Demo

Usage

Helpers

The list of helpers available are:

  • faker-fake use this to generate content by directly using the faker API
  • faker-random utility that provides parameterized access to the random subsection of the faker API
  • faker-text, faker-sentence, faker-sentences - generate lorem content

Example usage:

{{faker-random "number" max=100}}
{{faker-random "arrayelement" array("Link" "Ganon" "Zelda")}}
{{faker-sentence 10}} {{!-- create a 10-word sentence --}}
{{faker-sentences 5}} {{!-- create a 5-sentence string --}}
<img src={{faker-fake "{{image.avatar}}"}} alt="avatar">
<a href={{concat "mailto:" (faker-fake "{{internet.email}}")}}>Send Email!</a>
{{faker-fake "{{name.lastName}}, {{name.firstName}} {{name.suffix}}"}}
{{faker-text 10}} {{!-- create a random variation of lorem that repeats 10 times --}}

ES6

This addon provides the ability to import faker as an ES6 module.

import faker from "faker";

Compatibility

  • Ember.js v3.20 or above
  • Node.js v12 or above

Contributing

See the Contributing guide for details.

License

This project is licensed under the MIT License.