• Stars
    star
    204
  • Rank 192,063 (Top 4 %)
  • Language
    JavaScript
  • Created over 13 years ago
  • Updated over 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Random name generator for Node.js

Moniker

A random name generator for Node.js.

Synopsis

Moniker provides a default adjective/noun generator. Use it like this:

var Moniker = require('moniker');
console.log(Moniker.choose());
// Example output: murky-hands

You can also make a custom generator. Generators create random names using dictionaries. Moniker has built-in noun, verb, and adjective dictionaries, or you can add your own.

var Moniker = require('moniker');
var names = Moniker.generator([Moniker.adjective, Moniker.noun]);
console.log(names.choose());

Installation

Install Moniker using NPM:

npm install moniker

API

Generators

generator(dictionaries, options)

Create a new Generator. When a new name is generated, a word is chosen from each item in dictionaries in order.

Each dictionary may be a Dictionary instance, a string path to a file of words separated by spaces or newlines, or a function that should return a Dictionary when called.

The options are optional and are passed along to the new Generator and any new Dictionary. They default to:

{
  maxSize: undefined,
  encoding: 'utf-8',
  glue: '-'
}

Generator(options)

A name generator. Be sure to .use() some dictionaries afterward. Options may include:

{
  glue: '-'
}

generator.use(dictionary, options)

Add a new dictionary to this generator. When a new name is generated, a word is chosen from each dictionary in order.

The dictionary may be a Dictionary instance, a string path to a file of words separated by spaces or newlines, or a function that should return a Dictionary when called. The options are passed along to each newly-constructed Dictionary.

generator.choose()

Create a new name.

Dictionaries

adjective(options)

Create a Dictionary of using the builtin adjectives list.

noun(options)

Create a Dictionary of using the builtin noun list.

verb(options)

Create a Dictionary of using the builtin verb list.

read(path, options)

Create a Dictionary by reading words from a file. The file should be a list of words separated by spaces or newlines.

Dictionary()

A dictionary is a list of words.

dict.read(path, options)

Load words from path into this dictionary. Options default to:

{
  maxSize: undefined,
  encoding: 'utf-8',
}

Words larger than maxSize are ignored.

dict.choose()

Return a random word from this dictionary.

More Repositories

1

node-mail

This SMTP client library for Node.JS helps you send email safely and easily.
JavaScript
113
star
2

ReParse

ReParse is a parser combinator library for Javascript like Haskell's Parsec.
JavaScript
36
star
3

node-kyoto

Kyoto Cabinet bindings for Node.JS
C++
23
star
4

rewind

Automatically reload a node application when files change.
JavaScript
13
star
5

uuidjs

libuuid bindings for Node.JS
C++
7
star
6

keyboard.js

friendly, cross-browser keyboard support
JavaScript
6
star
7

begin.js

A control construct for callback-style asynchronous Javascript.
JavaScript
6
star
8

DefineJS

An AMD wrapper for Node modules
JavaScript
6
star
9

Toji

Kyoto Cabinet bindings for Node.js with an Avro mapper.
JavaScript
6
star
10

sic

Scheme Incremental Compiler
Scheme
4
star
11

jquery-value

Adds .value(), an extensible version of .val()
JavaScript
3
star
12

scribbles

Nothing in particular
JavaScript
3
star
13

node-text

A collection of utilities for manipulating text in Node.JS
JavaScript
3
star
14

jquery.transform-ui

A jQuery UI widget for jquery.transform
JavaScript
3
star
15

nodebot

An IRC bot implemented in Node.js
JavaScript
2
star
16

literate.js

Generate documents from Javascript source written in a literate style.
JavaScript
2
star
17

hello-clojure

Learn Clojure by example.
Clojure
1
star
18

node-base64

Base64 encoding and decoding for Node.JS
JavaScript
1
star
19

sicp-61a

Homework for Brian Harvey's CS61A Volume 1
Scheme
1
star
20

View.js

A system for defining javascript UI glue for roles.
JavaScript
1
star
21

setup.js

Manage library folders and external dependency folders in your project by including setup.js.
JavaScript
1
star
22

node-chrome-host

Use the Chrome Extension API through a Node web service.
JavaScript
1
star