1.0.2 • Published 2 years ago

hashed-release-name v1.0.2

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

hashed-release-name

Generate a human readable release name based on a hash.

This project is based on the project-name-generator NPM module which unfortunately does not a random seed.

var hrn = require('hashed-release-name');

console.log(hrn()); //= Something like 'fruity wombat'

console.log(hrn({alliterative: true})); //= Something like 'chalky clown'

console.log(hrn({hash: 123, alliterative: true})); //= Something like 'mushy mastadon' (but will ALWAYS return the same result unless the hash changes)

API

This module returns a single function which can be called as ([hash], [options]).

Options is an object which can contain any of the below:

OptionTypeDefaultDescription
hashstringDate.now()Alternate way to specify the hash
alliterativebooleanfalseboolean Generated name should be alliterative (e.g. 'wicked wombat')
adjectivesstring or array./data/adjectives.jsonA word list of adjectives, if this is a string the file path specified will be processed as JSON
nounsstring or array./data/nouns.jsonA word list of nouns, if this is a string the file path specified will be processed as JSON
samplerfunction(See code)Function called as (list, settings) to return a random choice from a word list
samplerAlliterativefunction(See code)Function called as (list, settings, firstChar) to return a random choice from a word list, limited by alliteration
mapperfunctionword => wordAdditional transforms to apply on a per-word basis to the output
joinerstring" "String sequence to join the generated terms by
transformerstring | phrase => phraseFunction to run the whole generated phrase though before returning