From 479df6d40823ae10bf72a1597a306e6e9a54f7fc Mon Sep 17 00:00:00 2001 From: koehr Date: Sat, 22 Jan 2022 18:26:55 +0100 Subject: [PATCH] random name generator functions --- functions/random-names/dicts.js | 1 + functions/random-names/generators.js | 123 ++++++++++++++++++++ functions/random-names/random-names.js | 35 +++++- functions/random-names/random-names.test.js | 28 +++++ 4 files changed, 182 insertions(+), 5 deletions(-) create mode 100644 functions/random-names/dicts.js create mode 100644 functions/random-names/generators.js create mode 100644 functions/random-names/random-names.test.js diff --git a/functions/random-names/dicts.js b/functions/random-names/dicts.js new file mode 100644 index 0000000..6ec845c --- /dev/null +++ b/functions/random-names/dicts.js @@ -0,0 +1 @@ +module.exports = {"adjectives":["abandoned","able","absolute","academic","acceptable","acclaimed","accomplished","accurate","aching","acidic","acrobatic","active","actual","adept","admirable","admired","adolescent","adorable","adored","advanced","adventurous","affectionate","afraid","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","back","bad","baggy","bare","barren","basic","beautiful","belated","beloved","beneficial","best","better","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","dark","darling","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","dirty","disastrous","discrete","disfigured","disguised","disgusting","dishonest","disloyal","dismal","distant","distinct","distorted","dizzy","dopey","doting","double","downright","drab","drafty","dramatic","dreary","droopy","dry","dual","dull","dutiful","each","eager","early","earnest","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","excitable","excited","exciting","exemplary","exhausted","exotic","expensive","experienced","expert","extra-large","extra-small","extraneous","extroverted","fabulous","failing","faint","fair","faithful","fake","false","familiar","famous","fancy","fantastic","far","far-flung","far-off","faraway","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","frequent","fresh","friendly","frightened","frightening","frigid","frilly","frivolous","frizzy","front","frosty","frozen","frugal","fruitful","full","fumbling","functional","funny","fussy","fuzzy","gargantuan","gaseous","general","generous","gentle","genuine","giant","giddy","gifted","gigantic","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","idiotic","idle","idolized","ignorant","ill","ill-fated","ill-informed","illegal","illiterate","illustrious","imaginary","imaginative","immaculate","immaterial","immediate","immense","impartial","impassioned","impeccable","imperfect","imperturbable","impish","impolite","important","impossible","impractical","impressionable","impressive","improbable","impure","inborn","incomparable","incompatible","incomplete","inconsequential","incredible","indelible","indolent","inexperienced","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","jumpy","junior","juvenile","kaleidoscopic","keen","key","kind","kindhearted","kindly","klutzy","knobby","knotty","knowing","knowledgeable","known","kooky","kosher","lame","lanky","large","last","lasting","late","lavish","lawful","lazy","leading","leafy","lean","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","obvious","occasional","odd","oddball","offbeat","offensive","official","oily","old","old-fashioned","only","open","optimal","optimistic","opulent","orange","orderly","ordinary","organic","original","ornate","ornery","other","our","outgoing","outlandish","outlying","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","pointed","pointless","poised","polished","polite","political","poor","popular","portly","posh","positive","possible","potable","powerful","powerless","practical","precious","present","prestigious","pretty","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","ready","real","realistic","reasonable","recent","reckless","rectangular","red","reflecting","regal","regular","reliable","relieved","remarkable","remorseful","remote","repentant","repulsive","required","respectful","responsible","revolving","rewarding","rich","right","rigid","ringed","ripe","roasted","robust","rosy","rotating","rotten","rough","round","rowdy","royal","rubbery","ruddy","rude","rundown","runny","rural","rusty","sad","safe","salty","same","sandy","sane","sarcastic","sardonic","satisfied","scaly","scarce","scared","scary","scented","scholarly","scientific","scornful","scratchy","scrawny","second","second-hand","secondary","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","sophisticated","sore","sorrowful","soulful","soupy","sour","Spanish","sparkling","sparse","specific","spectacular","speedy","spherical","spicy","spiffy","spirited","spiteful","splendid","spotless","spotted","spry","square","squeaky","squiggly","stable","staid","stained","stale","standard","starchy","stark","starry","steel","steep","sticky","stiff","stimulating","stingy","stormy","straight","strange","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","talkative","tall","tame","tan","tangible","tart","tasty","tattered","taut","tedious","teeming","tempting","tender","tense","tepid","terrible","terrific","testy","thankful","that","these","thick","thin","third","thirsty","this","thorny","thorough","those","thoughtful","threadbare","thrifty","thunderous","tidy","tight","timely","tinted","tiny","tired","torn","total","tough","tragic","trained","traumatic","treasured","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","violent","violet","virtual","virtuous","visible","vital","vivacious","vivid","voluminous","wan","warlike","warm","warmhearted","warped","wary","wasteful","watchful","waterlogged","watery","wavy","weak","wealthy","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"],"adverbs":["abnormally","aboard","about","abroad","absentmindedly","absolutely","abundantly","accidentally","accordingly","actively","actually","acutely","admiringly","affectionately","affirmatively","after","afterwards","agreeably","almost","already","always","amazingly","angrily","annoyingly","annually","anxiously","anyhow","anyplace","anyway","anywhere","appreciably","appropriately","around","arrogantly","aside","assuredly","astonishingly","away","awfully","awkwardly","badly","barely","bashfully","beautifully","before","begrudgingly","believably","bewilderedly","bewilderingly","bitterly","bleakly","blindly","blissfully","boastfully","boldly","boyishly","bravely","briefly","brightly","brilliantly","briskly","brutally","busily","calmly","candidly","carefully","carelessly","casually","cautiously","certainly","charmingly","cheerfully","chiefly","childishly","cleanly","clearly","cleverly","closely","cloudily","clumsily","coaxingly","coincidentally","coldly","colorfully","comfortably","commonly","compactly","compassionately","completely","confusedly","consequently","considerably","considerately","consistently","constantly","continually","continuously","coolly","correctly","courageously","covertly","cowardly","crazily","crossly","cruelly","cunningly","curiously","currently","customarily","cutely","daily","daintily","dangerously","daringly","darkly","dastardly","dearly","decently","deeply","defiantly","deftly","deliberately","delicately","delightfully","densely","diagonally","differently","diligently","dimly","directly","disorderly","divisively","docilely","dopily","doubtfully","down","dramatically","dreamily","during","eagerly","early","earnestly","easily","efficiently","effortlessly","elaborately","elegantly","eloquently","elsewhere","emotionally","endlessly","energetically","enjoyably","enormously","enough","enthusiastically","entirely","equally","especially","essentially","eternally","ethically","even","evenly","eventually","evermore","every","everywhere","evidently","evocatively","exactly","exceedingly","exceptionally","excitedly","exclusively","explicitly","expressly","extensively","externally","extra","extraordinarily","extremely","fairly","faithfully","famously","far","fashionably","fast","fatally","favorably","ferociously","fervently","fiercely","fiery","finally","financially","finitely","fluently","fondly","foolishly","forever","formally","formerly","fortunately","forward","frankly","frantically","freely","frenetically","frequently","fully","furiously","furthermore","generally","generously","gently","genuinely","girlishly","gladly","gleefully","gracefully","graciously","gradually","gratefully","greatly","greedily","grimly","grudgingly","habitually","half-heartedly","handily","handsomely","haphazardly","happily","harmoniously","harshly","hastily","hatefully","hauntingly","healthily","heartily","heavily","helpfully","hence","highly","hitherto","honestly","hopelessly","horizontally","hourly","how","however","hugely","humorously","hungrily","hurriedly","hysterically","icily","identifiably","idiotically","imaginatively","immeasurably","immediately","immensely","impatiently","impressively","inappropriately","incessantly","incorrectly","indeed","independently","indoors","indubitably","inevitably","infinitely","informally","infrequently","innocently","inquisitively","instantly","intelligently","intensely","intently","interestingly","intermittently","internally","invariably","invisibly","inwardly","ironically","irrefutably","irritably","jaggedly","jauntily","jealously","jovially","joyfully","joylessly","joyously","jubilantly","judgmentally","just","justly","keenly","kiddingly","kindheartedly","kindly","knavishly","knottily","knowingly","knowledgeably","kookily","lastly","late","lately","later","lazily","less","lightly","likely","limply","lithely","lively","loftily","longingly","loosely","loudly","lovingly","loyally","luckily","luxuriously","madly","magically","mainly","majestically","markedly","materially","meaningfully","meanly","meantime","meanwhile","measurably","mechanically","medically","menacingly","merely","merrily","methodically","mightily","miserably","mockingly","monthly","morally","more","moreover","mortally","mostly","much","mysteriously","nastily","naturally","naughtily","nearby","nearly","neatly","needily","negatively","nervously","never","nevertheless","next","nicely","nightly","noisily","normally","nosily","not","now","nowadays","numbly","obediently","obligingly","obnoxiously","obviously","occasionally","oddly","offensively","officially","often","ominously","once","only","openly","optimistically","orderly","ordinarily","outdoors","outrageously","outwardly","outwards","overconfidently","overseas","painfully","painlessly","paradoxically","partially","particularly","passionately","patiently","perfectly","periodically","perpetually","persistently","personally","persuasively","physically","plainly","playfully","poetically","poignantly","politely","poorly","positively","possibly","potentially","powerfully","presently","presumably","prettily","previously","primly","principally","probably","promptly","properly","proudly","punctually","puzzlingly","quaintly","queasily","questionably","questioningly","quicker","quickly","quietly","quirkily","quite","quizzically","randomly","rapidly","rarely","readily","really","reasonably","reassuringly","recently","recklessly","regularly","reliably","reluctantly","remarkably","repeatedly","reproachfully","resentfully","respectably","respectfully","responsibly","restfully","richly","ridiculously","righteously","rightfully","rightly","rigidly","roughly","routinely","rudely","ruthlessly","sadly","safely","scarcely","scarily","scientifically","searchingly","secretively","securely","sedately","seemingly","seldom","selfishly","selflessly","separately","seriously","shakily","shamelessly","sharply","sheepishly","shoddily","shortly","shrilly","shyly","significantly","silently","simply","sincerely","singularly","skillfully","sleepily","slightly","slowly","slyly","smoothly","so","softly","solely","solemnly","solicitously","solidly","somehow","sometimes","somewhat","somewhere","soon","spasmodically","specially","specifically","spectacularly","speedily","spiritually","splendidly","sporadically","startlingly","steadily","stealthily","sternly","still","strenuously","stressfully","strictly","structurally","studiously","stupidly","stylishly","subsequently","substantially","subtly","successfully","suddenly","sufficiently","suitably","superficially","supremely","surely","surprisingly","suspiciously","sweetly","swiftly","sympathetically","systematically","temporarily","tenderly","tensely","tepidly","terribly","thankfully","then","there","thereby","thoroughly","thoughtfully","thus","tightly","today","together","tomorrow","too","totally","touchingly","tremendously","truly","truthfully","twice","ultimately","unabashedly","unanimously","unbearably","unbelievably","unemotionally","unethically","unexpectedly","unfailingly","unfavorably","unfortunately","uniformly","unilaterally","unimpressively","universally","unkindly","unnaturally","unnecessarily","unquestionably","unselfishly","unskillfully","unwillingly","up","upbeat","upliftingly","upright","upside-down","upward","upwardly","urgently","usefully","uselessly","usually","utterly","vacantly","vaguely","vainly","valiantly","vastly","verbally","vertically","very","viciously","victoriously","vigilantly","vigorously","violently","visibly","visually","vivaciously","voluntarily","warmly","weakly","wearily","weekly","well","wetly","when","where","while","whole-heartedly","wholly","why","wickedly","widely","wiggly","wildly","willfully","willingly","wisely","woefully","wonderfully","worriedly","worthily","wrongly","yearly","yearningly","yesterday","yet","youthfully","zanily","zealously","zestfully","zestily"],"alliterations":["back-biting","back breaker","put it on the back burner","back to basics","bad blood","bare bones","bated breath","beach bum","bear the brunt of","beat around the bush","a bee in your bonnet","belle of the ball","best and brightest","best buddies","bet your bottom dollar","big bang theory","big brother","big bucks","bigger and better","birthday boy","bite the bullet","blind as a bat","blood brother","boom to bust","bottom of the barrel","bounce back","bread and butter","bright-eyed and bushy-tailed","building blocks","busy as a bee","by the book","cash cow","cash crop","chit-chat","chump change","chunk of change","class clown","clear cut","close call","the coast is clear","code of conduct","common cold","common courtesy","cool as a cucumber","cookie cutter","course correction","country club","cream of the crop","crew cut","crystal clear","cut corners","dare-devil","dastardly deed","daydream","dead as a doornail","dead duck","do or die","double dare","down in the dumps","drip dry","dull as dishwater","dry as dust","fact finding","fancy footwork","fan the flames","fast and furious","father figure","fear factor","feast or famine","feeding frenzy","few and far between","fickle finger of fate","fight or flight","fleet of foot","flight of fancy","fond farewell","forgive and forget","French fries","frequent flier","from the frying pan to the fire","gas guzzler","gentle giant","get your goat","gift of gab","give up the ghost","All that glitters is not gold.","go for the gold","go-getter","as good as gold","What's good for the goose is good for the gander.","the grass is greener","hale and hearty","half-hearted","happy Halloween","happy holidays","hard headed","have a heart","fall head over heels","heave ho","heaven and hell","heavy hitter","hem and haw","high hopes","hit the hay","home sweet home","house and home","add insult to injury","Jack and Jill","jibber-jabber","jumbo jet","jump for joy","jumping jacks","King Kong","knock-kneed","a labor of love","the lap of luxury","larger than life","last laugh","laundry list","law of the land","leaping lizards","new lease on life","left in the lurch","lily-livered","like it or lump it","live and learn","live the life","long-lost love","look before you leap","love letter","no love lost","mad as a March hare","make a mountain out of a molehill","melt in your mouth","man in the moon","mere mortals","method to the madness","Mickey Mouse","mind over matter","the more the merrier","motor mouth","move mountains","naughty or nice","neck and neck","now or never","part and parcel","party pooper","pay the piper","pay to play","peas in a pod","peer pressure","pen pal","penny wise and pound foolish","persistence pays","Peter Pan","pet peeve","picture perfect","a pig in a poke","pinch pennies","ping pong","pitter patter","pleased as punch","pots and pans","practice makes perfect","pretty penny","prim and proper","primrose path","publish or perish","pull any punches","quality over quantity","rabble rouser","rags to riches","rant and rave","rave reviews","ride roughshod","right as rain","road rage","rock 'n roll","rough rider","round robin","where the rubber meets the road","Russian roulette","sad sack","safe and sound","better safe than sorry","secret sauce","shell-shocked","shape up or ship out","ship shape","Simon says...","silver screen","sing for your supper","sing-song","sink or swim","slippery slope","slowly but surely","smooth sailing","snow screen","sorry sight","spending spree","spoil sport","spoonful of sugar","star struck","stars and stripes","sticks and stones","stuck on stupid","sugar and spice","sunny side of the street","sunny side up","surgical strike","swan song","sweat shop","sweet sixteen","sweet smell of success","sweet spot","it takes two to tango","taste test","tea time","temper tantrum","tempest in a teapot","the test of time","thick as thieves","think tank","through thick and thin","tip toe","tip top","time and tide","tongue tied","tongue twisters","tools of the trade","tough times","treasure trove","trials and tribulations","trick or treat","tried and true","turn the tables","vice versa","vim and vigor","vis-a-vis","walking wounded","waste not, want not","a way with words","wear out your welcome","weasel words","weeping willow","wend your way","wet your whistle","Where there's a will there's a way.","whistle while you work","whole-hearted","wild west","will o' the wisp","wishy-washy","wit and wisdom","wonders of the world","words of wisdom","word to the wise","work wonders","worry wart","yin and yang","zig-zag"],"given-names":["Aaren","Abia","Abiah","Abijah","Abimbola","Abiodun","Adair","Addison","Ade","Adebola","Adebowale","Adedayo","Adetokunbo","Adi","Adina","Aeron","Afon","Agam","Agrippa","Ah","Ailbhe","Ainsley","Akachi","Akira","Akpofure","Akuchi","Aldus","Ale","Aleks","Alemayehu","Alex","Alexis","Alinafe","Alix","Aljoša","Allison","Allyn","Almas","Almog","Alpha","Amable","Amahle","Amal","Amandeep","Amani","Amardeep","Amari","Amarjeet","Amery","Amets","Ameyalli","Amit","Amor","Amore","Amour","An","Anah","Anan","Ananta","Anastasie","Anat","Andie","Andile","Andy","Ange","Angel","Anh","Ankhbayar","Aoi","Apoorva","Apurva","Aquila","Aran","Arden","Ariel","Arin","Arlie","Aroha","Artie","Aruna","Arya","Ash","Ashanti","Ashley","Ashton","Aştî","Aston","Asuka","Atalyah","Athaliah","Athol","Atiya","Aubrey","Austyn","Auðr","Averill","Avery","Avia","Aviv","'Aviyah","Awotwi","Ayanda","Ayo","Ayodele","Ayomide","Ayotunde","Aytaç","Azar","Azaria","Baako","Badr","Bai","Bailey","Bala","Balwinder","Bandile","Bảo","Bao","Baran","Beau","Bellamy","Beren","Berhane","Berlin","Bernie","Berny","Bertie","Beverly","Bích","Bilge","Billie","Bình","Blair","Blessing","Blythe","Bo","Bobbie","Boipelo","Boitumelo","Borna","Bounmy","Braidy","Briar","Brogan","Bronte","Brook","Brooklyn","Bryn","Buhle","Burçin","Businge","Caelan","Çağrı","Cahaya","Cahya","Cahyo","Cam","Cam","Cameron","Camille","Campbell","Camryn","Cande","Candide","Carey","Carlisle","Carmo","Carol","Caron","Carrol","Carson","Cary","Casey","Cass","Cassidy","Cat","Cedar","Céleste","Celeste","Celestine","Ceri","Cevahir","Chan","Chanda","Chandler","Chandra","Chang","Channing","Chao","Charley","Charlie","Châu","Chea","Chen","Chen","Cheng","Cherokee","Chesed","Chesley","Cheyenne","Chi","Chibueze","Chibuike","Chibuzo","Chidi","Chidiebere","Chidiebube","Chidiegwu","Chifundo","Chifuniro","Chihiro","Chijindum","Chike","Chikelu","Chikere","Chikondi","Chikumbutso","Chimwala","Chimwemwe","Chin","Chinasa","Chinedu","Chinonso","Chinwe","Chinweike","Chinwendu","Chinweuba","Chioma","Chisomo","Chiyembekezo","Chizoba","Chris","Christmas","Chun","Chus","Ciel","Cihan","Citlali","Citlalli","Claude","Cleo","Coby","Codie","Collyn","Columba","Connie","Cortney","Courtney","Cree","Cruz","Cyan","Cyrille","Da","Dakota","Dale","Daley","Dalitso","Dallas","Daly","Dana","Dana","Danni","Dannie","Dany","Dar","Dara","Darby","Darcy","Darian","Dawa","Dayo","Dechen","Dee","Dell","Delshad","Dene","Deniz","Derby","Derya","Desta","Devan","Devin","Devon","Devyn","Dian","Diede","Diệp","Diệu","Dikla","Diklah","Dilşad","Dilshad","Đình","Dîyar","Diyar","Dölgöön","Dominique","Dor","Dorji","Dubaku","Duda","Duha","Durga","Duri","Duru","Dusty","Duygu","Dwi","Ebrar","Eddie","Eden","Eef","Efe","Efemena","Ehsan","Eike","Eirian","Ejiro","Ejiroghene","Eka","Ekene","Ekenedilichukwu","Ekin","Eko","Ekundayo","Elian","Ellery","Ellington","Ellis","Elvan","Emem","Emerson","Emery","Emmerson","Emory","Enfys","Engel","Eniola","Enitan","Enu","Esen","Eseoghene","Eser","Esme","Esmé","Eun","Eu","Evelyn","Evren","Ezhil","Fang","Farah","Farai","Fatsani","Fedelmid","Fedlimid","Feidlimid","Fen","Ferdous","Fergie","Finley","Fiore","Flann","Flannán","Flannery","Flick","Floor","Florence","Folami","Fortune","Fran","Francis","Frankie","Franny","Freddie","Fu","Fumnanya","Fungai","Gabby","Gabi","Gal","Ganizani","Garnet","Garnett","Gayle","Gefen","Georgie","Gerry","Ghufran","Giang","Gili","Giò","Giusi","Glaucia","Glaw","Goda","Gohar","Göksu","Golshan","Golzar","Gomer","Gray","Greer","Grey","Guadalupe","Guanting","Guanyu","Guiomar","Guiying","Gul","Gulbahar","Gulzar","Günay","Guo","Gurdeep","Gurmeet","Gurpreet","Gwynedd","Gyeong","Hà","Hadar","Hadley","Hadyn","Hai","Hallel","Haneul","Hanne","Happy","Harinder","Haris","Harley","Harlow","Harper","Harpreet","Hartley","Haru","Haruka","Haven","Hayat","Hayden","Haze","He","Hed","Heike","Heng","Hennie","Henny","Hibiki","Hifumi","Hikari","Hikaru","Hikmat","Hilal","Hilary","Hildred","Hinata","Hira","Hla","Hollis","Hong","Honor","Hosni","Hozan","Hua","Huan","Huang","Hui","Hunter","Husni","Hwan","Hyacinthe","Hyeon","Hyeo","Hyeo","Hyun","Hyu","Hyu","Idowu","Ifiok","Ihab","Ihsan","Ikraam","Ikram","Ilham","İlkay","Iman","Imani","Ime","Ime","Inderjeet","Inderjit","Inderpal","Indiana","Indigo","Inge","Iniobong","Innes","Inyene","Iovita","Irénée","Iseul","Isha","Isi","Islay","'Ismat","Issy","Itai","I","Itoro","Itumeleng","Ivory","Izar","Izzy","Jaci","Jackie","Jade","Jaden","Jadyn","Jae","Jae","Jaffe","Jaiden","Jamey","Jamie","Jamyang","Jasvinder","Jaswinder","Jawdat","Jaya","Jayden","Jaye","Jaylen","Jaylin","Jayme","Jeong","Jeon","Jerry","Jess","Jewel","Jewell","Ji","Jia","Jian","Jiang","Jie","J","J","Jimmie","Jin","Jinan","Jindra","Jing","Jingyi","Jip","J","J","J","J","J","J","J","Jo","Jocelin","Jocelyn","Jody","Joey","Johnie","Johnnie","Jojo","Jong","Jools","Jo","Jordan","José","Joss","Jothi","Joyce","Ju","Jules","Jun","Jun","Jung","Jun","Justice","Justy","Juul","J","Jyothi","Jyoti","Jyrgal","Kadek","Kaede","Kagiso","Kahurangi","Kai","Kaimana","Kaipo","Kalani","Kalei","Kali","Kam","Kamala","Kamalani","Kameron","Kamon","Kamryn","Kanta","Kanti","Kaoru","Kapua","Karabo","Karam","Karma","Karsyn","Kasey","Katlego","Katleho","Kauʻi","Kaulana","Kawehi","Kayden","Kayin","Keahi","Keala","Kealoha","Keanu","Keelan","Kefilwe","Kehinde","Kei","Kelcey","Kelebogile","Kelley","Kelly","Kelsey","Kendal","Kendall","Kennedy","Kenzie","Keone","Kerry","Keshet","Ketut","Kevyn","Kham","Khamphet","Khayrat","Khorshid","Khurshid","Kim","Kirabo","Kiran","Kirby","Kisembo","Kit","Kohaku","Komang","Kōnane","Kondwani","Kris","Kulap","Kumbukani","Kun","Kunzang","Kusuma","Kyo","Kyō","Kyou","Kyrie","Kyung","Lacey","Lacy","Lake","Lakshmi","Lan","Lành","Lashawn","Lauren","Laurie","Lavern","Laverne","Laxmi","Lebogang","Lebohang","Lee","Lehua","Lei","Lei","Leigh","Leighton","Leilani","Leith","Lennie","Lennon","Lennox","Léonce","Léonide","Lesego","Lesley","Leslie","Lhamo","Li","Li","Lian","Lilian","Lim","Limbani","Limbikani","Lin","Lindsay","Lindsey","Lindy","Ling","Linh","Lior","Liraz","Liron","Lishan","Ljuba","Logan","London","Loren","Loreto","Lorin","Lorrin","Lou","Lucky","Lucrèce","Lungile","Lupe","Lux","Lynn","Lyric","Maacah","Maachah","M","Maayan","Machlah","Mackenzie","Madalitso","Made","Madhu","Madhur","Madison","Mahinder","Mahlah","Maitland","Makana","Makara","Makena","Makoto","Malak","Malone","Manaia","Mandeep","Maninder","Manjeet","Manpreet","Manu","Maram","María","Maria","Marie","Marijn","Marley","Marlowe","Marlyn","Martie","Masami","Masozi","Matija","Mattie","Māui","Mavuto","Mawunyo","Maxi","Mayamiko","Mayeso","McKenzie","McKinley","Meade","Mega","Mehr","Mel","Meredith","Merle","Merlyn","Metztli","Meztli","Micaiah","Micajah","Micha","Michaiah","Michi","Michi","Mickey","Mies","Mikhayahu","Mille","Min","Minato","Minenhle","Ming","Minh","Mi","Minke","Minoru","Mi","Miša","Mitra","Mo","Moana","Modeste","Moerani","Mohana","Mohinder","Monet","Monroe","Montana","Mor","Moran","Morgan","Motya","Mphatso","Mpho","Mtendere","Mu","Mudiwa","Mumtaz","Munashe","Murphy","Myeong","Myung","Nālani","Nana","Nao","Naomi","Narcisse","Narinder","Naseem","Nasim","Nassim","Nat","Navdeep","Navneet","Nazaret","Ndidi","Neelam","Neo","Nergüi","Nermin","Nesim","Neta","Nevada","Ngawang","Ngọc","Ngozi","Nhung","Nicky","Nika","Nikephoros","Nikora","Nil","Nilam","Nima","Nimat","Ning","Nishat","Nitya","Nitzan","Njinga","Nkemdilim","Nkruma","Noam","Noel","Noga","Nollaig","Noor","Nor","Nour","Noy","Nsia","Nsonowa","Nthanda","Nuka","Nur","Nurul","Nyoman","Nzinga","Oakley","Ocean","Odalis","Odell","Ofir","Ofra","Ofri","Oghenekaro","Oghenekevwe","Oghenero","Olamide","Olayinka","Ollie","Oluchi","Olufunke","Olufunmilayo","Olufunmilola","Oluwafunmilayo","Oluwakanyinsola","Oluwasegun","Oluwaseun","Oluwaseyi","Oluwatoyin","Oluwayemisi","Omega","Omer","Omid","Omobolanle","Onyekachi","Onyekachukwu","Opeyemi","Ophir","Or","Ora","Ori","Osher","Otgonbayar","Otobong","Oyibo","Özgür","Pacey","Paderau","Padma","Page","Paget","Palmer","Parker","Parminder","Parris","Parveen","Passang","Pat","Patsy","Payton","Paz","Pema","Pemphero","Penjani","Péťa","Peťa","Petia","Petya","Peyton","Phoenix","Phúc","Phuntso","Phuntsok","Pich","Pilirani","Ping","Pip","Placide","Pleun","Pomare","Praise","Presley","Prudence","Puck","Purdie","Purnama","Pushpa","Putu","Qamar","Qing","Qiu","Quin","Quinn","Quý","Quỳnh","Radha","Rahat","Rain","Raine","Rajani","Rajinder","Raleigh","Randy","Rashmi","Rathna","Ratna","Ratnam","Raven","Ravid","Ravinder","Rayan","Rayyan","Raz","Reagan","Reese","Refilwe","Regan","Reign","Reilly","Remington","Ren","Rene","Reyes","Ricki","Ricmod","Ridley","Riley","Rin","Rini","Riny","Rio","Ripley","River","Robbie","Robin","Romilda","Romilly","Rong","Ronnie","Rorie","Rory","Rosario","Roshan","Rotem","Rowan","Royal","Royale","Ru","Rudo","Rupinder","Ruşen","Rutendo","Rylee","Ryley","Sabah","Sacha","Safa","Safaa","Safa","Sage","Sal","Salama","Sam","Sammie","Sammy","Samnang","Şan","Sandy","Sang","Sanya","Saša","Sascha","Sasha","Sashi","Sawyer","Schuyler","Sefa","Selby","Sengphet","Senna","Şenol","Seong","Seon","Seon","September","Sequoia","Seung","Sevan","Shachar","Shae","Shafaqat","Shahar","Shahnaz","Shai","Shaked","Shakti","Shalev","Sháńdíín","Shani","Shannon","Shanon","Shashi","Shay","Shaye","Shea","Shelby","Shelley","Shelly","Sheridan","Shi","Shikoba","Shiloh","Shinobu","Shion","Shiori","Shirley","Shui","Shun","Shun","Shura","Shyama","Sibonakaliso","Sidney","Sigi","Silver","Simcha","Simran","Sinclair","Sithembile","Sky","Skylar","Skyler","Sláine","Slava","Sloan","Sonam","So","Sophea","Sopheap","Sora","Sothy","Sparrow","Sree","Sri","Stace","Stacey","Stacy","Stav","Steph","Stevie","Storm","Su","Suad","S","S","Sukhdeep","Sukhwinder","Sultan","Suman","Sunan","Sunday","Sung","Sun","Sun","Sunny","Surinder","Sushila","Swaran","Swarna","Syd","Sydney","Tabassum","Tadala","Taegan","Tafadzwa","Tai","Taiwo","Takara","Takondwa","Tal","Tam","Tamandani","Taonga","Tashi","Tasi","Tatenda","Tatum","Taurai","Tayler","Taylor","Teagan","Tebogo","Teddie","Temitope","Temple","Temüülen","Tendai","Tenzin","Tenzing","Teo","Terry","Terry","Thabang","Thando","Thanh","Thảo","Thato","Thoko","Thokozani","Tibby","Tierney","Tinashe","Tionge","Tiriaq","Tirta","Tivoli","Tiyamike","Toby","Tom","Tommie","Tomomi","Tory","Tovia","Tracey","Tracy","Tri","Trinidad","Tristen","Tristin","Trúc","Tsering","Tshepo","Tshering","Tsubasa","Tu","Tú","Tumelo","Tutku","Udo","Uduak","Uduakobong","Ufuoma","Uʻilani","Ujarak","Ulli","Ulloriaq","Umut","Unathi","Uria","Uttara","Uzoma","Val","Valya","Vân","Vanja","Vanna","Vaska","Veasna","Vic","Vieno","Vijaya","Vinh","Vinnie","Vivian","Vosgi","Voski","Wallis","Wanangwa","Wangchuk","Wattana","Wayan","Wei","Wen","Whitney","Wil","Willie","Willy","Wilmot","Windsor","Wisdom","Wobbe","Wu","Wynne","Xia","Xiang","Xinyi","Xquenda","Xuân","Xue","Xun","Yachin","Yafe","Yaffe","Yağmur","Yahui","Yamikani","Yan","Yancy","Yang","Yanick","Yannic","Yannick","Yannig","Yarden","Yasu","Yating","Yazhu","Yeong","Yi","Yijun","Yin","Yolotl","Yolotli","Yona","Yonah","Yong","Yoshi","Yoshie","Young","Yu","Yū","Yūki","Yuki","Yun","Yu","Yunuen","Yuu","Yuuki","Yuval","Zan","Zedong","Zhen","Zheng","Zhenya","Zhi","Zhihao","Zhong","Zhou","Zhyrgal","Ziv","Zohar","Zola"],"nouns-housing":["Tudor","abode","adobe house","anteroom","apartment","armory","assembly room","attic","backroom","ballroom","barracks","basement","bathroom","beach house","bedroom","boarding house","boardroom","boiler room","boudoir","breakfast nook","breakfast room","brownstone","building","bungalow","bunkhouse","cabin","caravan","castle","cell","cellar","chalet","chamber","changing room","chapel","chateau","classroom","clean room","cloakroom","co-op","cold room","common room","condo","condominium","conference room","conservatory","control room","cottage","country house","courtroom","crib","cubby","dacha","darkroom","den","detached house","dining room","domicile","dorm","dormitory","double-wide","drawing room","dressing room","dungeon","duplex","dwelling","earth-sheltered house","efficiency apartment","emergency room","engine room","entry","estate","family room","farmhouse","fitting room","flat","formal dining room","foyer","front room","gabled house","game room","garage","garret","great room","green room","grotto","guest house","guest room","gym","hacienda","hall","hallway","high-rise home","homeroom","hospital room","hotel","hotel room","house","house trailer","houseboat","household","housing project","hunting lodge","hut","igloo","inglenook","inn","jail cell","keep","kitchen","kitchenette","ladies' room","larder","laundry room","lean-to","library","living quarters","living room","lobby","locker room","lodge","lodging","loft","log cabin","longhouse","lounge","lunchroom","maid's room","mailroom","maisonette","manor","mansion","men's room","microapartment","mobile home","morning room","motel","motel room","mud room","newsroom","nursery","office","operating room","palace","panic room","pantry","parlor","penthouse","pied-á-terre","playroom","pool room","powder room","primary residence","prison cell","pup tent","quarters","ranch house","real estate","rec room","recovery room","residence","residential hall","restroom","rooming house","roundhouse","row house","rumpus room","salesroom","salon","saltbox","schoolroom","screen porch","scullery","shack","shelter","showroom","sick room","sitting room","skyscraper","solarium","split-level house","staff room","stateroom","stockroom","storeroom","studio","studio apartment","study","suite","summer house","sunroom","tack room","tenement","tent","tepee","terraced house","tipi","townhouse","tract house","trailer home","treehouse","triplex","unit","utility room","vacation house","vestibule","villa","visitors' room","waiting room","wardroom","washroom","water closet","weight room","wickiup","wigwam","wine cellar","women's room","workroom","yaodong","yurt"],"nouns-transportations":["Conestoga wagon","Davy Jones' locker","Humvee","PFD","PT boat","RV","SST","SUV","Segway","T-V","T-bar lift","U-boat","Zamboni","abeam","aerial tramway","aft","aground","aircraft","aircraft carrier","airplane","aloft","ambulance","amphibious vehicle","anchor","armored car","astern","auto","automobile","baby carriage","bail","ballast","balloon","barge","barque","barrow","bathyscaphe","battlecruiser","battleship","beam","bearing","bicycle","bike","bilge","biplane","blimp","boat","boat lift","boater","boating","boatswain","bobsled","bomber","boom","bow","bowsprit","boxcar","broomstick","buggy","bulkhead","bulldozer","bullet train","buoy","bus","cab","cabin cruiser","cable car","caboose","camper","canoe","capsize","car","caravan","caravel","cargo ship","carriage","carrier","cart","cast off","catamaran","chairlift","chariot","chopper","clipper","clipper ship","cloth-top","clunker","coach","cockpit","combine","compact","compact car","container ship","convertible","conveyance","conveyor belt","convoy","coupe","covered wagon","crane","crew","crop duster","crow's nest","cruise","cruise ship","cruiser","current","cutter","cycle","deck","deckhands","delivery truck","delivery van","destroyer","diesel truck","dinghy","dirigible","dirt bike","displacement","diving bell","dock","docking","dog cart","dogsled","donkey cart","dory","draft","dragster","dray","dreadnought","drift","driver","dry dock","dugout","dugout canoe","dump truck","earth mover","eighteen-wheeler","electric car","elevated railroad","elevator","engine","engine room","escalator","escort ship","express train","fathom","ferry","figurehead","fire engine","fireboat","fishing boat","flat-bottom boat","flatbed truck","flotilla","foremast","foresail","forklift","four-by-four","four-door","four-wheel drive","freight train","freighter","frigate","funicular railway","funnel","furl","galleon","galley","gangway","garbage truck","gas powered","gas-electric","glider","go-cart","golf cart","gondola","gondola lift","gridlock","gunboat","gunwale","halyard","handcar","hang glider","hansom cab","hard top","hardtop","harvester","hatchback","haul","hay wagon","headsail","hearse","helicopter","helm","helmsman","hoist","hook and ladder truck","hot rod","hot-air balloon","houseboat","hovercraft","hull","humvee","hybrid","hydrofoil","hydroplane","ice boat","ice breaker","inboard motor","jalopy","jeep","jet","jet boat","jet pack","jet ski","jetliner","jib","journey","jumbo jet","junk","kayak","keel","keelboat","ketch","knot","landing craft","lanyard","larboard","launch","league","leeward","life raft","lifeboat","lifeline","light rail","limey","limo","limousine","lines","listing","litter","locomotive","log","lorry","low-rider","luxury car","magic carpet","maglev","mainmast","marine","mariner","maritime","mast","minesweeper","minibus","minivan","mizzen","mizzenmast","model T","monorail","mooring","moped","motor","motor home","motor launch","motorboat","motorcar","motorcycle","mountain bike","narrowboat","nautical","nautical mile","naval","navigate","navy","nun buoy","oar","ocean going","ocean liner","off-road vehicle","offshore","oil tanker","onboard","outboard motor","outrigger canoe","overboard","oxcart","paddle","paddlewheeler","parachute","passage","passenger","patrol car","pedal boat","pennant","personal flotation device","pickup truck","pilot","pirate","plane","police boat","police car","port","porthole","power boat","powerboat","prairie schooner","propeller","pumper truck","punt","push cart","race car","racecar","racing car","raft","ragtop","railroad","railway","rapid transit","recreational vehicle","rickshaw","ride","rigging","riverboat","roadster","rocket","rocket boat","rope","rotary engine","rover","row","rowboat","rudder","runabout","sail","sailboat","sailor","satellite","school bus","schooner","scooter","scull","seafarer","seaplane","seasick","sedan","sedan chair","semi","ship","shrimp boat","shuttle","side wheeler","ski boat","ski lift","ski tow","skiff","skipjack","sled","sledge","sleigh","sloop","snow cat","snowmobile","snowplow","soft-top","solar powered","space shuttle","spaceship","speedboat","spinnaker","sport-utility vehicle/SUV","sports car","sports utility vehicle","squad car","stagecoach","starboard","station wagon","steamboat","steamship","stern","stock car","stow","stretch limo","stroller","subcompact","submarine","submersible","subway","surrey","swift boat","tack","tank","tanker","taxi","taxi cab","taxicab","tender","thresher","tide","tiller","tire","toboggan","topsail","tow truck","towboat","town car","tracks","tractor","tractor-trailer","trail bike","trailer","train","tram","tramway","transit","transom","trawler","tricycle","trolley","truck","tug","tugboat","two-door","ultralight craft","umiak","undocking","unicycle","van","vehicle","vespa","vessel","voyage","wagon","wake","warship","water taxi","water-borne","watercraft","waterline","whaler","wheel","wheelbarrow","wheelchair","wheelhouse","winch","windjammer","windshield","windward","wreck","yacht","yawl","zeppelin"],"number-greek":["Alpha","Gamma","Delta","Epsilon","Digamma","Zeta","Eta","Theta","Iota","Kappa","Lambda","Mu","Nu","Ksi","Omicron","Pi","Koppa","Rho","Sigma","Tau","Ypsilon","Phi","Chi","Psi","Omega"],"number-roman":["I","II","III","IV","V","VI","VII","VIII","IX","X","XI","XII","XIII","XIV","XV","XVI","XVII","XVIII","XIX","XX","XXI","XXII","XXIII","XXIV","XXV"],"palindrome-sentences":["Bird rib","Borrow or rob?","Don't nod","Drawn inward","Dump mud","Go dog","I did, did I?","I prefer pi","Lepers repel","Madam, I'm Adam","Ma has a ham","My gym","Never odd or even","No lemon, no melon","Now I won","Nurses run","Race car","Top spot","Tuna nut","Was it a cat I saw?"],"prepositions":["aboard","about","above","across","after","against","along","alongside","amid","among","amongst","around","as","aside","astride","at","atop","barring","before","behind","below","beneath","beside","besides","between","beyond","but","by","circa","concerning","considering","despite","down","during","except","excepting","excluding","failing","following","for","from","in","including","inside","into","like","minus","near","nearby","next","notwithstanding","of","off","on","onto","opposite","outside","over","past","per","plus","regarding","round","save","since","than","through","throughout","till","times","to","toward","towards","under","underneath","unlike","until","unto","up","upon","versus","via","with","within","without","worth"]} diff --git a/functions/random-names/generators.js b/functions/random-names/generators.js new file mode 100644 index 0000000..fff3aff --- /dev/null +++ b/functions/random-names/generators.js @@ -0,0 +1,123 @@ +function chance (fraction) { + return Math.random() < fraction +} + +function randInt (max) { + // simplified because it will always be min=0 + return Math.round(Math.random() * max) +} + +function randElement (list) { + const max = list.length - 1 + const index = randInt(max) + return list[index] +} + +module.exports = function RandomGenerators (dicts) { + const adjectives = dicts['adjectives'] + const adverbs = dicts['adverbs'] + const palindromes = dicts['palindrome-sentences'] + const housingNouns = dicts['nouns-housing'] + const transportNouns = dicts['nouns-transportations'] + const alliterations = dicts['alliterations'] + const people = dicts['given-names'] + const letters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.split('') + // TODO: prepositions? number words? + + function randomLetterCombination () { + let output = '' + for (let idx = 1 + randInt(3); idx; idx--) output += randElement(letters) + return output + } + + function randomSuffixedName (suffix) { + let person = randElement(people) + if (person.endsWith('s') || person.endsWith('x') || person.endsWith('z')) { + person += `' ${suffix}` + } else { + person += `'s ${suffix}` + } + return person + } + + // This version always returns a named star + function genNamedStar () { + return randomSuffixedName('Star') + } + + function genStar () { + if (chance(0.1)) { // 10% chance for a personalized name + return randomSuffixedName('Star') + } + + const rndN = randInt(99999) + const rndL = randomLetterCombination() + const lettersFirst = chance(0.5) + const output = lettersFirst ? `${rndL}-${rndN}` : `${rndN}-${rndL}` + + return output + } + + function genPlanet () { + if (chance(0.1)) { // 10% chance for Palindromes! + return randElement(palindromes) + } + + let output = '' + const includeAdjective = chance(0.8) + + if (includeAdjective) { + const includeAdverb = chance(0.2) + if (includeAdverb) output += randElement(adverbs) + ' ' + output += randElement(adjectives) + ' ' + } + output += randElement(housingNouns) + return output + } + + function genStation () { + if (chance(0.1)) { // 10% chance for an alliteration! + return randElement(alliterations) + } + + if (chance(0.5)) { // 50% chance for something like Amal's hut + const designation = randElement(housingNouns) + return randomSuffixedName(designation) + } + + let output = '' + const includeAdjective = chance(0.8) + + if (includeAdjective) { + const includeAdverb = chance(0.2) + if (includeAdverb) output += randElement(adverbs) + ' ' + output += randElement(adjectives) + ' ' + } + output += randElement(housingNouns) + return output + } + + function genStarship () { + if (chance(0.1)) { // 10% chance for an alliteration! + return randElement(alliterations) + } + + if (chance(0.5)) { // 50% chance for something like Mel's steamship + const designation = randElement(transportNouns) + return randomSuffixedName(designation) + } + + let output = '' + const includeAdjective = chance(0.8) + + if (includeAdjective) { + const includeAdverb = chance(0.2) + if (includeAdverb) output += randElement(adverbs) + ' ' + output += randElement(adjectives) + ' ' + } + output += randElement(transportNouns) + return output + } + + return { genStar, genNamedStar, genPlanet, genStation, genStarship } +} diff --git a/functions/random-names/random-names.js b/functions/random-names/random-names.js index 61aef7e..3a3ded4 100755 --- a/functions/random-names/random-names.js +++ b/functions/random-names/random-names.js @@ -1,13 +1,38 @@ +const dicts = require('./dicts.js') +const randomGenerators = require('./generators.js') + +const { + //genStar, + genNamedStar, + genPlanet, + genStation, + genStarship +} = randomGenerators(dicts) + +const generators = { + 'random-star-name': genNamedStar, + 'random-planet-name': genPlanet, + 'random-station-name': genStation, + 'random-starship-name': genStarship, +} + // Docs on event and context https://www.netlify.com/docs/functions/#the-handler-method const handler = async (event) => { try { - const subject = event.queryStringParameters.name || 'World' + // path looks like this: /.netlify/functions/random-names/foo + const generatorKey = event.path.slice(33) // cheapo path segmentation + const generator = generators[generatorKey] + + if (!generator) return { + statusCode: 404, + body: JSON.stringify({ statusCode: 404, body: `Unkown generator "${generatorKey}".` }), + } + + const name = generator() + return { statusCode: 200, - body: JSON.stringify({ message: `Hello ${subject}`, path: event.path }), - // // more keys you can return: - // headers: { "headerName": "headerValue", ... }, - // isBase64Encoded: true, + body: JSON.stringify({ name }), } } catch (error) { return { statusCode: 500, body: error.toString() } diff --git a/functions/random-names/random-names.test.js b/functions/random-names/random-names.test.js new file mode 100644 index 0000000..35b9083 --- /dev/null +++ b/functions/random-names/random-names.test.js @@ -0,0 +1,28 @@ +const { handler } = require('./random-names.js') + +function generateEvent (path) { + // see https://docs.netlify.com/functions/build-with-javascript/#format + return { + path: `/.netlify/functions/random-names/${path}`, + httpMethod: 'GET', + headers: {}, + queryStringParameters: {}, + body: null, + isBase64Encoded: false, + } +} + +(function test () { + const events = { + randomStarName: generateEvent('random-star-name'), + randomPlanetName: generateEvent('random-planet-name'), + randomStationName: generateEvent('random-station-name'), + randomStarshipName: generateEvent('random-starship-name'), + } + + Object.keys(events).map(async (key) => { + const event = events[key] + const result = await handler(event) + console.log(key, result.statusCode, result.body) + }) +}())