API Docs for: 1.0.0
Show:

Generator Class

Defined in: index.js:68
Module: Generator

A word generator utility

Patterns

A pattern describes how to generate words. It consists of a series of characters, each referencing a group. If the letter is uppercase, the result will also be in uppercase.

Example:

var generator = new Generator();
generator.pattern('Cvcvcv');

generator.generate(); // returns something like 'Tafenu'

Groups

Groups are simple arrays with characters.

Constructor

Generator

()

Defined in index.js:68

Item Index

Methods

Methods

generate

(
  • [callback]
)
String

Defined in index.js:103

Generates a word using this instances pattern and groups.

Parameters:

  • [callback] Callback (error, result) optional

    node-style callback with the word as second parameter

Returns:

String: the word

generate

(
  • [callback]
)
String static

Defined in index.js:136

generates a default-configured word, with optional callback

Parameters:

  • [callback] Callback (error, result) optional

    node-style callback with word as second parameter

Returns:

String: the word

group

(
  • key
  • [value]
)
Array Character

Defined in index.js:114

Gives the group for the key, or sets this group

Parameters:

  • key Character

    the name of this group (one character, lowercase)

  • [value] Array Character optional

    the new array of characters for this group

Returns:

Array Character: the current group (in case of setting, the old group)

pattern

(
  • [pattern]
)
String

Defined in index.js:124

Gives the pattern, or sets it

Parameters:

  • [pattern] String optional

    the pattern, see chapter in documentation for details

Returns:

String: the current pattern (the old, if set)