https://github.com/hash-bang/hashed-release-name
Generate a simple project release name from a hash (Git, MD5, SHA1 etc.)
https://github.com/hash-bang/hashed-release-name
Last synced: 20 days ago
JSON representation
Generate a simple project release name from a hash (Git, MD5, SHA1 etc.)
- Host: GitHub
- URL: https://github.com/hash-bang/hashed-release-name
- Owner: hash-bang
- License: mit
- Created: 2018-02-28T00:51:15.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2022-09-27T23:56:05.000Z (over 2 years ago)
- Last Synced: 2025-05-05T22:56:33.758Z (20 days ago)
- Language: JavaScript
- Size: 14.6 KB
- Stars: 4
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
hashed-release-name
===================
Generate a human readable release name based on a hash.This project is based on the [project-name-generator](https://www.npmjs.com/package/project-name-generator) NPM module which unfortunately does not a random seed.
```javascript
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:
| Option | Type | Default | Description |
|----------------------|---------------------|--------------------------|----------------------------------------------------------------------------------------------------------------------|
| `hash` | `string` | `Date.now()` | Alternate way to specify the hash |
| `alliterative` | `boolean` | `false` | boolean Generated name should be alliterative (e.g. 'wicked wombat') |
| `adjectives` | `string` or `array` | `./data/adjectives.json` | A word list of adjectives, if this is a string the file path specified will be processed as JSON |
| `nouns` | `string` or `array` | `./data/nouns.json` | A word list of nouns, if this is a string the file path specified will be processed as JSON |
| `sampler` | `function` | (See code) | Function called as `(list, settings)` to return a random choice from a word list |
| `samplerAlliterative` | `function` | (See code) | Function called as `(list, settings, firstChar)` to return a random choice from a word list, limited by alliteration |
| `mapper` | `function` | `word => word` | Additional transforms to apply on a per-word basis to the output |
| `joiner` | `string` | `" "` | String sequence to join the generated terms by |
| `transformer` | `string` ` | phrase => phrase` | Function to run the whole generated phrase though before returning |