UNPKG

short-animal-id

Version:

Generates short ids with animal name prefixes

75 lines (57 loc) 927 B
## short-animal-id Generates short ids with animal name prefixes. This strives for easily pronunciable and short IDs. **NOTE**: This package is not cryptographically random, nor are IDs guaranteed to be unique. ## Import ```js import idGenerators from "short-animal-id"; let { animalId, numericId, alphanumericId } = idGenerators; ``` ## Examples Example adding multiple ids together ```js console.log(`${animalId()}${numericId()}_${alphanumericId(4, true)}`); /** Crane0_P06H Sandpiper3_6Xzs Squid6_uPFL Turkey8_ndIG Pheasant4_Jdm6 */ ``` ## API ### `animalId()` ```js animalId(); /** Grouse Oryx Raven Squid Dinosaur */ ``` ### `numericId(length)` > length (1 by default) ```js numericId(6); /** 734254 408672 211560 044299 714564 */ ``` ### `alphanumericId(length, includeUppercase)` > length (1 by default) > includeUppercase (false by default) ```js alphanumericId(4); /** vh1o h361 fbbh gm5i tc64 */ ```