0.0.1 • Published 9 years ago

fixturer v0.0.1

Weekly downloads
2
License
MIT
Repository
github
Last release
9 years ago

fixturer

A small module to generate fixtures

Installation

The project is not yet in the npm registry but you can install it as follow

npm install --save-dev zeropaper/fixturer

Usage

Can be used as a tool-belt

var fixturer = require('fixturer');
var randomInterger = fixturer.random(3, 10);

or with a JSON definition.

var json = {
    "id": "<%= uuid() %>",
    "name": {
        "first": "<%= personeName(true, false, false) %>",
        "last": "<%= personeName(false, true, false) %>",
        "middle": "<%= personeName(false, false, true) %>"
    }
};

fixturer(json);

It should be possible to use it in a browser.. but... I didn't test it.

Methods

loremIpsum

Generate a random text

random

randomItem

randomString

randomDate

evilScript

evilLink

personName

Person name generation

Params

  • {bool} first - if strictly false, no first name part
  • {bool} last - if strictly false, no last name part
  • {bool} middle - if truthy, adds a middle name part
  • {string} gender - can be 'male', 'female', random if not defined (I know it's a bit limited)

thingName

Thing name generation

Params

  • {int} count - the number of words used

License

The MIT License (MIT)