npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

sirrobert-name-tokens

v1.0.0

Published

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

Downloads

5

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).