zoo-ids
Version:
Generate predictable and unique identifiers composed of adjectives and animal names
1,746 lines (1,734 loc) • 29 kB
JavaScript
;
Object.defineProperty(exports, '__esModule', { value: true });
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
var __assign = function() {
__assign = Object.assign || function __assign(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
function __spreadArray(to, from, pack) {
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
return to.concat(ar || Array.prototype.slice.call(from));
}
var alea = function () {
var seed = [];
for (var _i = 0; _i < arguments.length; _i++) {
seed[_i] = arguments[_i];
}
return getRandomGenerator(__spreadArray([], seed, true));
};
var getRandomGenerator = function (seed) {
// Johannes Baagøe <baagoe@baagoe.com>, 2010
var s0 = 0;
var s1 = 0;
var s2 = 0;
var c = 1;
if (seed.length == 0) {
seed = [+new Date()];
}
var mash = getMasher();
s0 = mash(' ');
s1 = mash(' ');
s2 = mash(' ');
for (var i = 0; i < seed.length; i++) {
s0 -= mash(seed[i]);
if (s0 < 0) {
s0 += 1;
}
s1 -= mash(seed[i]);
if (s1 < 0) {
s1 += 1;
}
s2 -= mash(seed[i]);
if (s2 < 0) {
s2 += 1;
}
}
var random = function () {
var t = 2091639 * s0 + c * 2.3283064365386963e-10; // 2^-32
s0 = s1;
s1 = s2;
return (s2 = t - (c = t | 0));
};
random.version = 'Alea 0.9';
random.seed = seed;
return random;
};
function getMasher() {
var n = 0xefc8249d;
var masher = function (data) {
data = data.toString();
for (var i = 0; i < data.length; i++) {
n += data.charCodeAt(i);
var h = 0.02519603282416938 * n;
n = h >>> 0;
h -= n;
h *= n;
n = h >>> 0;
h -= n;
n += h * 0x100000000; // 2^32
}
return (n >>> 0) * 2.3283064365386963e-10; // 2^-32
};
masher.version = 'Mash 0.9';
return masher;
}
// Adapted from https://gist.github.com/hugsy/8910dc78d208e40de42deb29e62df913#file-english-adjectives-txt
// In total, 1347 adjectives
var adjectives = [
'abandoned',
'able',
'absolute',
'adorable',
'adventurous',
'academic',
'acceptable',
'acclaimed',
'accomplished',
'accurate',
'aching',
'acidic',
'acrobatic',
'active',
'actual',
'adept',
'admirable',
'admired',
'adolescent',
'adorable',
'adored',
'advanced',
'afraid',
'affectionate',
'aged',
'aggravating',
'aggressive',
'agile',
'agitated',
'agonizing',
'agreeable',
'ajar',
'alarmed',
'alarming',
'alert',
'alienated',
'alive',
'all',
'altruistic',
'amazing',
'ambitious',
'ample',
'amused',
'amusing',
'anchored',
'ancient',
'angelic',
'angry',
'anguished',
'animated',
'annual',
'another',
'antique',
'anxious',
'any',
'apprehensive',
'appropriate',
'apt',
'arctic',
'arid',
'aromatic',
'artistic',
'ashamed',
'assured',
'astonishing',
'athletic',
'attached',
'attentive',
'attractive',
'austere',
'authentic',
'authorized',
'automatic',
'avaricious',
'average',
'aware',
'awesome',
'awful',
'awkward',
'babyish',
'bad',
'back',
'baggy',
'bare',
'barren',
'basic',
'beautiful',
'belated',
'beloved',
'beneficial',
'better',
'best',
'bewitched',
'big',
'big-hearted',
'biodegradable',
'bite-sized',
'bitter',
'black',
'black-and-white',
'bland',
'blank',
'blaring',
'bleak',
'blind',
'blissful',
'blond',
'blue',
'blushing',
'bogus',
'boiling',
'bold',
'bony',
'boring',
'bossy',
'both',
'bouncy',
'bountiful',
'bowed',
'brave',
'breakable',
'brief',
'bright',
'brilliant',
'brisk',
'broken',
'bronze',
'brown',
'bruised',
'bubbly',
'bulky',
'bumpy',
'buoyant',
'burdensome',
'burly',
'bustling',
'busy',
'buttery',
'buzzing',
'calculating',
'calm',
'candid',
'canine',
'capital',
'carefree',
'careful',
'careless',
'caring',
'cautious',
'cavernous',
'celebrated',
'charming',
'cheap',
'cheerful',
'cheery',
'chief',
'chilly',
'chubby',
'circular',
'classic',
'clean',
'clear',
'clear-cut',
'clever',
'close',
'closed',
'cloudy',
'clueless',
'clumsy',
'cluttered',
'coarse',
'cold',
'colorful',
'colorless',
'colossal',
'comfortable',
'common',
'compassionate',
'competent',
'complete',
'complex',
'complicated',
'composed',
'concerned',
'concrete',
'confused',
'conscious',
'considerate',
'constant',
'content',
'conventional',
'cooked',
'cool',
'cooperative',
'coordinated',
'corny',
'corrupt',
'costly',
'courageous',
'courteous',
'crafty',
'crazy',
'creamy',
'creative',
'creepy',
'criminal',
'crisp',
'critical',
'crooked',
'crowded',
'cruel',
'crushing',
'cuddly',
'cultivated',
'cultured',
'cumbersome',
'curly',
'curvy',
'cute',
'cylindrical',
'damaged',
'damp',
'dangerous',
'dapper',
'daring',
'darling',
'dark',
'dazzling',
'dead',
'deadly',
'deafening',
'dear',
'dearest',
'decent',
'decimal',
'decisive',
'deep',
'defenseless',
'defensive',
'defiant',
'deficient',
'definite',
'definitive',
'delayed',
'delectable',
'delicious',
'delightful',
'delirious',
'demanding',
'dense',
'dental',
'dependable',
'dependent',
'descriptive',
'deserted',
'detailed',
'determined',
'devoted',
'different',
'difficult',
'digital',
'diligent',
'dim',
'dimpled',
'dimwitted',
'direct',
'disastrous',
'discrete',
'disfigured',
'disgusting',
'disloyal',
'dismal',
'distant',
'downright',
'dreary',
'dirty',
'disguised',
'dishonest',
'dismal',
'distant',
'distinct',
'distorted',
'dizzy',
'dopey',
'doting',
'double',
'downright',
'drab',
'drafty',
'dramatic',
'dreary',
'droopy',
'dry',
'dual',
'dull',
'dutiful',
'each',
'eager',
'earnest',
'early',
'easy',
'easy-going',
'ecstatic',
'edible',
'educated',
'elaborate',
'elastic',
'elated',
'elderly',
'electric',
'elegant',
'elementary',
'elliptical',
'embarrassed',
'embellished',
'eminent',
'emotional',
'empty',
'enchanted',
'enchanting',
'energetic',
'enlightened',
'enormous',
'enraged',
'entire',
'envious',
'equal',
'equatorial',
'essential',
'esteemed',
'ethical',
'euphoric',
'even',
'evergreen',
'everlasting',
'every',
'evil',
'exalted',
'excellent',
'exemplary',
'exhausted',
'excitable',
'excited',
'exciting',
'exotic',
'expensive',
'experienced',
'expert',
'extraneous',
'extroverted',
'extra-large',
'extra-small',
'fabulous',
'failing',
'faint',
'fair',
'faithful',
'fake',
'false',
'familiar',
'famous',
'fancy',
'fantastic',
'far',
'faraway',
'far-flung',
'far-off',
'fast',
'fat',
'fatal',
'fatherly',
'favorable',
'favorite',
'fearful',
'fearless',
'feisty',
'feline',
'female',
'feminine',
'few',
'fickle',
'filthy',
'fine',
'finished',
'firm',
'first',
'firsthand',
'fitting',
'fixed',
'flaky',
'flamboyant',
'flashy',
'flat',
'flawed',
'flawless',
'flickering',
'flimsy',
'flippant',
'flowery',
'fluffy',
'fluid',
'flustered',
'focused',
'fond',
'foolhardy',
'foolish',
'forceful',
'forked',
'formal',
'forsaken',
'forthright',
'fortunate',
'fragrant',
'frail',
'frank',
'frayed',
'free',
'French',
'fresh',
'frequent',
'friendly',
'frightened',
'frightening',
'frigid',
'frilly',
'frizzy',
'frivolous',
'front',
'frosty',
'frozen',
'frugal',
'fruitful',
'full',
'fumbling',
'functional',
'funny',
'fussy',
'fuzzy',
'gargantuan',
'gaseous',
'general',
'generous',
'gentle',
'genuine',
'giant',
'giddy',
'gigantic',
'gifted',
'giving',
'glamorous',
'glaring',
'glass',
'gleaming',
'gleeful',
'glistening',
'glittering',
'gloomy',
'glorious',
'glossy',
'glum',
'golden',
'good',
'good-natured',
'gorgeous',
'graceful',
'gracious',
'grand',
'grandiose',
'granular',
'grateful',
'grave',
'gray',
'great',
'greedy',
'green',
'gregarious',
'grim',
'grimy',
'gripping',
'grizzled',
'gross',
'grotesque',
'grouchy',
'grounded',
'growing',
'growling',
'grown',
'grubby',
'gruesome',
'grumpy',
'guilty',
'gullible',
'gummy',
'hairy',
'half',
'handmade',
'handsome',
'handy',
'happy',
'happy-go-lucky',
'hard',
'hard-to-find',
'harmful',
'harmless',
'harmonious',
'harsh',
'hasty',
'hateful',
'haunting',
'healthy',
'heartfelt',
'hearty',
'heavenly',
'heavy',
'hefty',
'helpful',
'helpless',
'hidden',
'hideous',
'high',
'high-level',
'hilarious',
'hoarse',
'hollow',
'homely',
'honest',
'honorable',
'honored',
'hopeful',
'horrible',
'hospitable',
'hot',
'huge',
'humble',
'humiliating',
'humming',
'humongous',
'hungry',
'hurtful',
'husky',
'icky',
'icy',
'ideal',
'idealistic',
'identical',
'idle',
'idiotic',
'idolized',
'ignorant',
'ill',
'illegal',
'ill-fated',
'ill-informed',
'illiterate',
'illustrious',
'imaginary',
'imaginative',
'immaculate',
'immaterial',
'immediate',
'immense',
'impassioned',
'impeccable',
'impartial',
'imperfect',
'imperturbable',
'impish',
'impolite',
'important',
'impossible',
'impractical',
'impressionable',
'impressive',
'improbable',
'impure',
'inborn',
'incomparable',
'incompatible',
'incomplete',
'inconsequential',
'incredible',
'indelible',
'inexperienced',
'indolent',
'infamous',
'infantile',
'infatuated',
'inferior',
'infinite',
'informal',
'innocent',
'insecure',
'insidious',
'insignificant',
'insistent',
'instructive',
'insubstantial',
'intelligent',
'intent',
'intentional',
'interesting',
'internal',
'international',
'intrepid',
'ironclad',
'irresponsible',
'irritating',
'itchy',
'jaded',
'jagged',
'jam-packed',
'jaunty',
'jealous',
'jittery',
'joint',
'jolly',
'jovial',
'joyful',
'joyous',
'jubilant',
'judicious',
'juicy',
'jumbo',
'junior',
'jumpy',
'juvenile',
'kaleidoscopic',
'keen',
'key',
'kind',
'kindhearted',
'kindly',
'klutzy',
'knobby',
'knotty',
'knowledgeable',
'knowing',
'known',
'kooky',
'kosher',
'lame',
'lanky',
'large',
'last',
'lasting',
'late',
'lavish',
'lawful',
'lazy',
'leading',
'lean',
'leafy',
'left',
'legal',
'legitimate',
'light',
'lighthearted',
'likable',
'likely',
'limited',
'limp',
'limping',
'linear',
'lined',
'liquid',
'little',
'live',
'lively',
'livid',
'loathsome',
'lone',
'lonely',
'long',
'long-term',
'loose',
'lopsided',
'lost',
'loud',
'lovable',
'lovely',
'loving',
'low',
'loyal',
'lucky',
'lumbering',
'luminous',
'lumpy',
'lustrous',
'luxurious',
'mad',
'made-up',
'magnificent',
'majestic',
'major',
'male',
'mammoth',
'married',
'marvelous',
'masculine',
'massive',
'mature',
'meager',
'mealy',
'mean',
'measly',
'meaty',
'medical',
'mediocre',
'medium',
'meek',
'mellow',
'melodic',
'memorable',
'menacing',
'merry',
'messy',
'metallic',
'mild',
'milky',
'mindless',
'miniature',
'minor',
'minty',
'miserable',
'miserly',
'misguided',
'misty',
'mixed',
'modern',
'modest',
'moist',
'monstrous',
'monthly',
'monumental',
'moral',
'mortified',
'motherly',
'motionless',
'mountainous',
'muddy',
'muffled',
'multicolored',
'mundane',
'murky',
'mushy',
'musty',
'muted',
'mysterious',
'naive',
'narrow',
'nasty',
'natural',
'naughty',
'nautical',
'near',
'neat',
'necessary',
'needy',
'negative',
'neglected',
'negligible',
'neighboring',
'nervous',
'new',
'next',
'nice',
'nifty',
'nimble',
'nippy',
'nocturnal',
'noisy',
'nonstop',
'normal',
'notable',
'noted',
'noteworthy',
'novel',
'noxious',
'numb',
'nutritious',
'nutty',
'obedient',
'obese',
'oblong',
'oily',
'oblong',
'obvious',
'occasional',
'odd',
'oddball',
'offbeat',
'offensive',
'official',
'old',
'old-fashioned',
'only',
'open',
'optimal',
'optimistic',
'opulent',
'orange',
'orderly',
'organic',
'ornate',
'ornery',
'ordinary',
'original',
'other',
'our',
'outlying',
'outgoing',
'outlandish',
'outrageous',
'outstanding',
'oval',
'overcooked',
'overdue',
'overjoyed',
'overlooked',
'palatable',
'pale',
'paltry',
'parallel',
'parched',
'partial',
'passionate',
'past',
'pastel',
'peaceful',
'peppery',
'perfect',
'perfumed',
'periodic',
'perky',
'personal',
'pertinent',
'pesky',
'pessimistic',
'petty',
'phony',
'physical',
'piercing',
'pink',
'pitiful',
'plain',
'plaintive',
'plastic',
'playful',
'pleasant',
'pleased',
'pleasing',
'plump',
'plush',
'polished',
'polite',
'political',
'pointed',
'pointless',
'poised',
'poor',
'popular',
'portly',
'posh',
'positive',
'possible',
'potable',
'powerful',
'powerless',
'practical',
'precious',
'present',
'prestigious',
'pretty',
'precious',
'previous',
'pricey',
'prickly',
'primary',
'prime',
'pristine',
'private',
'prize',
'probable',
'productive',
'profitable',
'profuse',
'proper',
'proud',
'prudent',
'punctual',
'pungent',
'puny',
'pure',
'purple',
'pushy',
'putrid',
'puzzled',
'puzzling',
'quaint',
'qualified',
'quarrelsome',
'quarterly',
'queasy',
'querulous',
'questionable',
'quick',
'quick-witted',
'quiet',
'quintessential',
'quirky',
'quixotic',
'quizzical',
'radiant',
'ragged',
'rapid',
'rare',
'rash',
'raw',
'recent',
'reckless',
'rectangular',
'ready',
'real',
'realistic',
'reasonable',
'red',
'reflecting',
'regal',
'regular',
'reliable',
'relieved',
'remarkable',
'remorseful',
'remote',
'repentant',
'required',
'respectful',
'responsible',
'repulsive',
'revolving',
'rewarding',
'rich',
'rigid',
'right',
'ringed',
'ripe',
'roasted',
'robust',
'rosy',
'rotating',
'rotten',
'rough',
'round',
'rowdy',
'royal',
'rubbery',
'rundown',
'ruddy',
'rude',
'runny',
'rural',
'rusty',
'sad',
'safe',
'salty',
'same',
'sandy',
'sane',
'sarcastic',
'sardonic',
'satisfied',
'scaly',
'scarce',
'scared',
'scary',
'scented',
'scholarly',
'scientific',
'scornful',
'scratchy',
'scrawny',
'second',
'secondary',
'second-hand',
'secret',
'self-assured',
'self-reliant',
'selfish',
'sentimental',
'separate',
'serene',
'serious',
'serpentine',
'several',
'severe',
'shabby',
'shadowy',
'shady',
'shallow',
'shameful',
'shameless',
'sharp',
'shimmering',
'shiny',
'shocked',
'shocking',
'shoddy',
'short',
'short-term',
'showy',
'shrill',
'shy',
'sick',
'silent',
'silky',
'silly',
'silver',
'similar',
'simple',
'simplistic',
'sinful',
'single',
'sizzling',
'skeletal',
'skinny',
'sleepy',
'slight',
'slim',
'slimy',
'slippery',
'slow',
'slushy',
'small',
'smart',
'smoggy',
'smooth',
'smug',
'snappy',
'snarling',
'sneaky',
'sniveling',
'snoopy',
'sociable',
'soft',
'soggy',
'solid',
'somber',
'some',
'spherical',
'sophisticated',
'sore',
'sorrowful',
'soulful',
'soupy',
'sour',
'Spanish',
'sparkling',
'sparse',
'specific',
'spectacular',
'speedy',
'spicy',
'spiffy',
'spirited',
'spiteful',
'splendid',
'spotless',
'spotted',
'spry',
'square',
'squeaky',
'squiggly',
'stable',
'staid',
'stained',
'stale',
'standard',
'starchy',
'stark',
'starry',
'steep',
'sticky',
'stiff',
'stimulating',
'stingy',
'stormy',
'straight',
'strange',
'steel',
'strict',
'strident',
'striking',
'striped',
'strong',
'studious',
'stunning',
'stupendous',
'stupid',
'sturdy',
'stylish',
'subdued',
'submissive',
'substantial',
'subtle',
'suburban',
'sudden',
'sugary',
'sunny',
'super',
'superb',
'superficial',
'superior',
'supportive',
'sure-footed',
'surprised',
'suspicious',
'svelte',
'sweaty',
'sweet',
'sweltering',
'swift',
'sympathetic',
'tall',
'talkative',
'tame',
'tan',
'tangible',
'tart',
'tasty',
'tattered',
'taut',
'tedious',
'teeming',
'tempting',
'tender',
'tense',
'tepid',
'terrible',
'terrific',
'testy',
'thankful',
'that',
'these',
'thick',
'thin',
'third',
'thirsty',
'this',
'thorough',
'thorny',
'those',
'thoughtful',
'threadbare',
'thrifty',
'thunderous',
'tidy',
'tight',
'timely',
'tinted',
'tiny',
'tired',
'torn',
'total',
'tough',
'traumatic',
'treasured',
'tremendous',
'tragic',
'trained',
'tremendous',
'triangular',
'tricky',
'trifling',
'trim',
'trivial',
'troubled',
'true',
'trusting',
'trustworthy',
'trusty',
'truthful',
'tubby',
'turbulent',
'twin',
'ugly',
'ultimate',
'unacceptable',
'unaware',
'uncomfortable',
'uncommon',
'unconscious',
'understated',
'unequaled',
'uneven',
'unfinished',
'unfit',
'unfolded',
'unfortunate',
'unhappy',
'unhealthy',
'uniform',
'unimportant',
'unique',
'united',
'unkempt',
'unknown',
'unlawful',
'unlined',
'unlucky',
'unnatural',
'unpleasant',
'unrealistic',
'unripe',
'unruly',
'unselfish',
'unsightly',
'unsteady',
'unsung',
'untidy',
'untimely',
'untried',
'untrue',
'unused',
'unusual',
'unwelcome',
'unwieldy',
'unwilling',
'unwitting',
'unwritten',
'upbeat',
'upright',
'upset',
'urban',
'usable',
'used',
'useful',
'useless',
'utilized',
'utter',
'vacant',
'vague',
'vain',
'valid',
'valuable',
'vapid',
'variable',
'vast',
'velvety',
'venerated',
'vengeful',
'verifiable',
'vibrant',
'vicious',
'victorious',
'vigilant',
'vigorous',
'villainous',
'violet',
'violent',
'virtual',
'virtuous',
'visible',
'vital',
'vivacious',
'vivid',
'voluminous',
'wan',
'warlike',
'warm',
'warmhearted',
'warped',
'wary',
'wasteful',
'watchful',
'waterlogged',
'watery',
'wavy',
'wealthy',
'weak',
'weary',
'webbed',
'wee',
'weekly',
'weepy',
'weighty',
'weird',
'welcome',
'well-documented',
'well-groomed',
'well-informed',
'well-lit',
'well-made',
'well-off',
'well-to-do',
'well-worn',
'wet',
'which',
'whimsical',
'whirlwind',
'whispered',
'white',
'whole',
'whopping',
'wicked',
'wide',
'wide-eyed',
'wiggly',
'wild',
'willing',
'wilted',
'winding',
'windy',
'winged',
'wiry',
'wise',
'witty',
'wobbly',
'woeful',
'wonderful',
'wooden',
'woozy',
'wordy',
'worldly',
'worn',
'worried',
'worrisome',
'worse',
'worst',
'worthless',
'worthwhile',
'worthy',
'wrathful',
'wretched',
'writhing',
'wrong',
'wry',
'yawning',
'yearly',
'yellow',
'yellowish',
'young',
'youthful',
'yummy',
'zany',
'zealous',
'zesty',
'zigzag',
];
// Adapted from http://en.wikipedia.org/wiki/List_of_animal_names
// In total, 221 animals
var animals = [
'aardvark',
'albatross',
'alligator',
'alpaca',
'ant',
'anteater',
'antelope',
'ape',
'armadillo',
'donkey',
'baboon',
'badger',
'barracuda',
'bat',
'bear',
'beaver',
'bee',
'bison',
'boar',
'buffalo',
'butterfly',
'camel',
'capybara',
'caribou',
'cassowary',
'cat',
'caterpillar',
'cattle',
'chamois',
'cheetah',
'chicken',
'chimpanzee',
'chinchilla',
'chough',
'clam',
'cobra',
'cockroach',
'cod',
'cormorant',
'coyote',
'crab',
'crane',
'crocodile',
'crow',
'curlew',
'deer',
'dinosaur',
'dog',
'dogfish',
'dolphin',
'dotterel',
'dove',
'dragonfly',
'duck',
'dugong',
'dunlin',
'eagle',
'echidna',
'eel',
'eland',
'elephant',
'elk',
'emu',
'falcon',
'ferret',
'finch',
'fish',
'flamingo',
'fly',
'fox',
'frog',
'gaur',
'gazelle',
'gerbil',
'giraffe',
'gnat',
'gnu',
'goat',
'goldfinch',
'goldfish',
'goose',
'gorilla',
'goshawk',
'grasshopper',
'grouse',
'guanaco',
'gull',
'hamster',
'hare',
'hawk',
'hedgehog',
'heron',
'herring',
'hippopotamus',
'hornet',
'horse',
'human',
'hummingbird',
'hyena',
'ibex',
'ibis',
'jackal',
'jaguar',
'jay',
'jellyfish',
'kangaroo',
'kingfisher',
'koala',
'kookabura',
'kouprey',
'kudu',
'lapwing',
'lark',
'lemur',
'leopard',
'lion',
'llama',
'lobster',
'locust',
'loris',
'louse',
'lyrebird',
'magpie',
'mallard',
'manatee',
'mandrill',
'mantis',
'marten',
'meerkat',
'mink',
'mole',
'mongoose',
'monkey',
'moose',
'mosquito',
'mouse',
'mule',
'narwhal',
'newt',
'nightingale',
'octopus',
'okapi',
'opossum',
'oryx',
'ostrich',
'otter',
'owl',
'oyster',
'panther',
'parrot',
'partridge',
'peafowl',
'pelican',
'penguin',
'pheasant',
'pig',
'pigeon',
'pony',
'porcupine',
'porpoise',
'quail',
'quelea',
'quetzal',
'rabbit',
'raccoon',
'rail',
'ram',
'rat',
'raven',
'reindeer',
'rhinoceros',
'rook',
'salamander',
'salmon',
'sandpiper',
'sardine',
'scorpion',
'seahorse',
'seal',
'shark',
'sheep',
'shrew',
'skunk',
'snail',
'snake',
'sparrow',
'spider',
'spoonbill',
'squid',
'squirrel',
'starling',
'stingray',
'stinkbug',
'stork',
'swallow',
'swan',
'tapir',
'tarsier',
'termite',
'tiger',
'toad',
'trout',
'turkey',
'turtle',
'viper',
'vulture',
'wallaby',
'walrus',
'wasp',
'weasel',
'whale',
'wildcat',
'wolf',
'wolverine',
'wombat',
'woodcock',
'woodpecker',
'worm',
'wren',
'yak',
'zebra',
];
var defaultOptions = {
numAdjectives: 2,
delimiter: '',
caseStyle: 'titlecase',
};
var cachedGenerator = alea();
function generateId(
// eslint-disable-next-line @typescript-eslint/no-explicit-any
seed, options) {
if (seed === void 0) { seed = null; }
if (options === void 0) { options = {}; }
var generator = seed == null ? cachedGenerator : alea(seed);
var fullOptions = __assign(__assign({}, defaultOptions), options);
var numAdjectives = fullOptions.numAdjectives, delimiter = fullOptions.delimiter, caseStyle = fullOptions.caseStyle;
var result = '';
for (var i = 0; i < numAdjectives; i++) {
var adjective = getRandomElement(generator, adjectives);
result += getFormattedWord(adjective, {
numAdjectives: numAdjectives,
delimiter: delimiter,
caseStyle: caseStyle,
});
result += fullOptions.delimiter;
}
var animal = getRandomElement(generator, animals);
result += getFormattedWord(animal, fullOptions);
if (caseStyle === 'camelcase') {
return result.charAt(0).toLowerCase() + result.slice(1);
}
return result;
}
function getRandomElement(generator, words) {
var index = Math.floor(generator() * words.length);
return words[Math.min(index, words.length - 1)];
}
function getFormattedWord(word, options) {
if (word.includes('-')) {
return word
.split('-')
.map(function (w) { return getFormattedWord(w, options); })
.join(options.delimiter);
}
switch (options.caseStyle) {
case 'titlecase':
case 'camelcase':
return word.charAt(0).toUpperCase() + word.slice(1);
case 'uppercase':
return word.toUpperCase();
case 'togglecase':
return getToggleCaseWord(word);
case 'lowercase':
default:
return word;
}
}
function getToggleCaseWord(word) {
return word
.split('')
.map(function (c, i) { return (i % 2 === 0 ? c : c.toUpperCase()); })
.join('');
}
exports.generateId = generateId;