@pixium-digital/random-namer
TypeScript icon, indicating that this package has built-in type declarations

0.0.5 • Public • Published

Random Namer

This project aims to simply provide random usernames, team names, gamertags, adjectives, colors to use in testing data.

Installation

yarn install @pixium-digital/random-namer

Usage

import { RandomNamer, RandomType } from "@pixium-digital/random-namer"

const list = RandomNamer(RandomType.TEAM, { toGenerate: 3, allUnique: true, addId: true })
// ['voiceless-sea#4457', 'delicate-star#6563', 'even-nest#9988']

const list = RandomNamer(RandomType.GAMERTAG, { toGenerate: 2 })
// ['The Best Yoda', 'I_Cant_Play']

Here is the list of random types that can be passed:

export enum RandomType {
    ADJECTIVE,
    COLOR,
    EXTENDED_COLOR,
    GAMERTAG,
    NOUN,
    TEAM,
}

Here are the parameters available to pass to the function

{
    toGenerate: number // Number of items to generate
    allUnique?: boolean // Should the generated items be unique?
    addId?: boolean // Should the items be apended with an ID (discord like) #3949
}

Others

Extended Colors

If you are suing the RandomType.EXTENDED_COLOR you will get a array of ExtendedColors instead of strings.

ExtendedColor are defined in the following format:

export interface ExtendedColor {
    id: string
    name: string
    hex: string
    r: number
    g: number
    b: number
}

randomId

You can also use the randomId function as it is exported

import {randomId} from "@pixium-digital/random-namer"

const ID = randomId()
// 3945

Author

Burlet Mederic mederic.burlet@pixiumdigital.com https://github.com/pixiumdigital https://pixiumdigital.com

Readme

Keywords

none

Package Sidebar

Install

npm i @pixium-digital/random-namer

Weekly Downloads

0

Version

0.0.5

License

GPL-3.0-only

Unpacked Size

135 kB

Total Files

18

Last publish

Collaborators

  • crimson-med