1.0.2 • Published 6 months ago

@aurelle/idiomatic-slug v1.0.2

Weekly downloads
-
License
ISC
Repository
-
Last release
6 months ago

idiomatic-slug

Generates slugs made of an adjective and a noun.

Browser and NodeJS compatible.

Usage

import { generate } from '@aurelle/idiomatic-slug'

console.log(generate())
// angry-alarm

console.log(generate({ separator = ' ' }))
// angry alarm

It's also possible to generate a random adjective or noun separately:

import { noun, adjective } from '@aurelle/idiomatic-slug'

console.log(noun())
// alarm

console.log(adjective())
// angry

Concerns

Uniqueness

This package uses local wordlists that, when combined into an adjective-noun slug, make up for a total of 2,910,512 unique slugs. While this may seem huge you want to apply extra care if you rely on this slug as your only source of uniqueness (which I wouldn't recommend).

Memory footprint

To keep it simple and fast, the wordlists are loaded in memory as Javascripts arrays. As such, this has little impact on the general memory consumption. While this should not be that big of a deal, especially on systems that have the luxury of running NodeJS, that's worth noting.

1.0.2

6 months ago

1.0.1

6 months ago

1.0.0

6 months ago