https://github.com/yosriady/haiku
:mount_fuji: Generate memorable names similar to Xaddress or Heroku
https://github.com/yosriady/haiku
elixir utility-library
Last synced: about 1 year ago
JSON representation
:mount_fuji: Generate memorable names similar to Xaddress or Heroku
- Host: GitHub
- URL: https://github.com/yosriady/haiku
- Owner: yosriady
- Created: 2016-08-26T05:49:13.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2019-09-20T17:03:54.000Z (almost 7 years ago)
- Last Synced: 2025-04-20T05:20:06.514Z (about 1 year ago)
- Topics: elixir, utility-library
- Language: Elixir
- Homepage: https://hex.pm/packages/haiku
- Size: 81.1 KB
- Stars: 20
- Watchers: 2
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Haiku
Generates memorable names similar to Xaddress or Heroku. Supports custom
words, custom delimiters, and custom reducer functions.
## Installation
Add `haiku` to your list of dependencies in `mix.exs`:
```elixir
def deps do
[{:haiku, "~> 0.3.1"}]
end
```
## Usage
```elixir
iex> Haiku.build
"quiet-morning-5933"
iex> Haiku.build(delimiter: '.')
"quiet.morning.5933"
iex> Haiku.build(range: 99)
"quiet-morning-45"
iex> Haiku.build(delimiter: '.', range: 99)
"quiet.morning.45"
```
## Configuration
In your `config.exs`:
```
config :haiku,
delimiter: '.',
range: 9999,
adjectives: ~w(autumn hidden bitter misty),
nouns: ~w(meadow sun glade bird)
reducer_module: MyModule
reducer_function: :custom_reduce
```
> Note that `reducer_function/4` has 4-arity and expects the following order: `[delimiter, adjective, noun, number]`. It must return a string.
> For example:
>
> ```
> def custom_reduce(delimiter, adjective, noun, number) do
> "#{number}#{if number, do: delimiter}#{adjective}#{noun}""
> end
> ```
## Thanks
**haiku** © 2016+, Yos Riady. Released under the [MIT] License.
Authored and maintained by Yos Riady with help from contributors ([list][contributors]).
> [yos.io](http://yos.io) ·
> GitHub [@yosriady](https://github.com/yosriady)
[MIT]: http://mit-license.org/
[contributors]: http://github.com/yosriady/haiku/contributors