• Stars
    star
    250
  • Rank 161,784 (Top 4 %)
  • Language
    TypeScript
  • License
    BSD 3-Clause "New...
  • Created over 9 years ago
  • Updated over 1 year ago

Reviews

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

Repository Details

Generate Heroku-like random names to use in your node applications.

HaikunatorJS

Build Status Latest Version Coverage Status

Generate Heroku-like random names to use in your node applications.

Installation

npm install --save haikunator

Usage

Haikunator is pretty simple.

var Haikunator = require('haikunator')
// ES6: import Haikunator from 'haikunator'

// Instantiate Haikunator without options
var haikunator = new Haikunator()

// Instantiate Haikunator with default options
var customHaikunator = new Haikunator({
  adjectives: ['custom', 'adjectives'],
  nouns: ['custom', 'nouns'],
  seed: 'custom-seed',

  // class defaults
  defaults: {
    tokenLength: 8,
    tokenChars: 'HAIKUNATOR',
    // ...
  },
})

// default usage
haikunator.haikunate() // => "wispy-dust-1337"

// custom length (default=4)
haikunator.haikunate({ tokenLength: 6 }) // => "patient-king-887265"

// use hex instead of numbers
haikunator.haikunate({ tokenHex: true }) // => "purple-breeze-98e1"

// use custom chars instead of numbers/hex
haikunator.haikunate({ tokenChars: 'HAIKUNATE' }) // => "summer-atom-IHEA"

// don't include a token
haikunator.haikunate({ tokenLength: 0 }) // => "cold-wildflower"

// use a different delimiter
haikunator.haikunate({ delimiter: '.' }) // => "restless.sea.7976"

// no token, space delimiter
haikunator.haikunate({ tokenLength: 0, delimiter: ' ' }) // => "delicate haze"

// no token, empty delimiter
haikunator.haikunate({ tokenLength: 0, delimiter: '' }) // => "billowingleaf"

Options

The following options are available:

var Haikunator = require('haikunator')

var haikunator = new Haikunator({
  adjectives: ['custom', 'adjectives'],
  nouns: ['custom', 'nouns'],
  seed: 'custom-seed', // Custom seed

  // Class wide defaults, can get overridden by haikunate(options)
  defaults: {
    delimiter: '-',
    tokenLength: 4,
    tokenHex: false,
    tokenChars: '0123456789',
  },
})

// Same options are also available on the haikunate method
haikunator.haikunate({
  delimiter: '-',
  tokenLength: 4,
  tokenHex: false,
  tokenChars: '0123456789',
})

If tokenHex is true, any tokens specified in tokenChars are ignored

Contributing

Everyone is encouraged to help improve this project. Here are a few ways you can help:

Other Languages

Haikunator is also available in other languages. Check them out:

More Repositories

1

github-actions-badge

๐Ÿ›ก๏ธ Shields.io Badge for your GitHub Actions
Go
191
star
2

haikunatorpy

Generate Heroku-like random names to use in your python applications
Python
120
star
3

haikunatorphp

Generate Heroku-like random names to use in your php applications.
PHP
103
star
4

haikunatorgo

Generate Heroku-like random names to use in your go applications.
Go
52
star
5

sweetify-django

SweetAlert integration for Django
Python
47
star
6

haikunatorjava

Generate Heroku-like random names to use in your Java applications
Java
28
star
7

haikunator.net

Generate Heroku-like random names to use in your .NET applications
C#
23
star
8

sweetify

SweetAlert flash messages for Ruby on Rails
Ruby
21
star
9

codecov-action

A GitHub action that sends your code coverage to codecov.io
Dockerfile
8
star
10

haikunatordart

Generate Heroku-like random names to use in your dart applications
Dart
8
star
11

cain

๐Ÿ“œ CAIN - Simple Media Management
Go
5
star
12

sync-dotenv

๐Ÿ”€ Keep your .env.example in sync with changes to your .env file
Go
5
star
13

homedir

Go library for detecting and expanding the user's home directory
Go
4
star
14

steam-account-switcher

simple steam account switcher that lives in your taskbar
Go
3
star
15

go-migrate-rice

rice source driver for golang-migrate/migrate
Go
3
star
16

tower-helmet

tower-helmet helps you secure your tower server by setting various HTTP headers. It's not a silver bullet, but it can help!
Rust
2
star
17

dotenv-build

dotenv-build helps you to supply your .env file as compile time environment variables in your build.rs
Rust
2
star
18

box

๐Ÿ“ฆ BOX - cli boxes
Go
1
star
19

mailgen

Mailgen: Rust crate that generates clean, responsive HTML and text e-mails for sending transactional mail
Rust
1
star
20

env

a tiny .env wrapper
Go
1
star
21

haikunatorperl

Generate Heroku-like random names to use in your perl 6 applications.
Perl 6
1
star