# sirrobert-name-tokens

> A module for generating name tokens for easier ids for humans.

Latest version **1.0.0** (published 2017-06-27) · MIT license · 0 weekly downloads

## Install

```sh
npm install sirrobert-name-tokens
pnpm add sirrobert-name-tokens
yarn add sirrobert-name-tokens
bun add sirrobert-name-tokens
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2017-06-27 |
| First published | 2017-06-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Sir Robert Burbridge |
| Maintainers | sirrobert |

## Links

- npm: https://www.npmjs.com/package/sirrobert-name-tokens
- Repository: git@bitbucket.com:sirrobert/node-name-tokens
- npm.io page: https://npm.io/package/sirrobert-name-tokens

## Recent versions

- 1.0.0 (latest) — 2017-06-27

## README

# Overview

A module for generating human-readable name tokens automatically.

# Usage

## Installation

Install locally or globally.

    npm install [--global] sirrobert-name-tokens

## Invocation

The module has a node interface as well as a command-line interface.

### Command Line

You can install the binary (globally if you like):

    npm install sirrobert-name-tokens
    npm install sirrobert-name-tokens --global

Then you can generate names from the command line:

    $> ./node_modules/sirrobert-name-token/bin/name
    secret-station

### Programming Interface

    const Name = require("sirrobert-name-tokens");

#### Create a name

    var name = Name.generate();

#### Create a name with a custom words list.

    Name.loadWords('nouns'      , './my-nouns-file.txt'      );
    Name.loadWords('adjectives' , './my-adjectives-file.txt' );
    var name = Name.generate();

Word files are simple lists of words (not JSON).  Here is an examples word
file.

		weird
		welcome
		west
		western
		wheel
		while
		white
		whole
 
The list is split on whitespace using `words = text.split(/[\s\r\n]+/)`.

#### Custom Delimiters

By default the module uses '-' as a word delimiter.  You can customize it by
setting `Name.separator` like this:

    const Name = require('sirrobert-name-tokens');
    Name.generate();        // e.g. "munificent-twist"
    Name.separator = '_';   // Change the separator to underscore. 
    Name.generate();        // e.g. "honest_monitor"
    Name.separator = '@@@'  // Change the separator to "@@@".
    Name.generate();        // e.g. "obtuse@@@picture"

Separators are anything at all (they will be implicitly cast to strings).
This includes using an empty string (""), which effectively concatenates the
adjective and name.

# TO DO

I may want to add an option for allowing more variation by increasing the
number of adjectives.  For example, something like

    Name.length = 1;  // Use noun only.
    Name.length = 2;  // Default.  A noun modified by a single adjective.
    Name.length = 3;  // A noun modified by two adjectives.
    Name.length = 9;  // A noun modified by eight adjectives.

# A note on the module namespace (sirrobert-)

The 'sirrobert-' module prefix is a staging namespace for my modules I am
testing with a small group of people.  It will be moved to a general
namespace (for example, the `sirrobert-` prefix removed).

---
_Source: https://npm.io/package/sirrobert-name-tokens · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
