random-greek-gods
Version:
Generate one or more names from a list of Greek gods
44 lines (37 loc) • 3.78 kB
JavaScript
var wordList = [
// Borrowed from http://www.scriboly.com/Ref/Export/CSV/Greek_Mythological_Gods_Deities_and_Titans
"Hyperion","Iapetus","Coeus","Crius","Cronus","Mnemosyne","Oceanus","Phoebe","Rhea","Tethys","Theia","Themis","Asteria","Astraeus","Atlas","Aura","Dione","Eos","Epimetheus","Eurybia","Eurynome","Helios","Clymene","Lelantos","Leto","Menoetius","Metis","Ophion","Pallas","Perses","Prometheus","Selene","Styx","Hyperion","Iapetus","Coeus","Crius","Cronus","Mnemosyne","Oceanus","Phoebe","Rhea","Tethys","Theia","Themis","Thetis","Arethusa","Galene","Psamathe","Karkinos","Ladon","Leucothea","Bythos","Aphros","Aegaeon","Achelous","Amphitrite","Benthesikyme","Brizo","Ceto","Charybdis","Cymopoleia","Delphin","Eidothea","Glaucus","Stheno","Euryale","Medusa","Deino","Enyo","Pemphredo","Aello","Ocypete","Podarge","Celaeno","Nicothoe","Hippocampi","Hydros","Nereus","Nerites","Oceanus","Palaemon","Poseidon","Phorcys","Pontos","Proteus","Scylla","Aglaope","Himerope","Leucosia","Ligeia","Molpe","Parthenope","Peisinoe","Raidne","Teles","Thelchtereia","Thelxiope","Actaeus","Argyron","Atabyrius","Chalcon","Chryson","Damon","Damnameneus","Dexithea","Lycos","Lysagora","Makelo","Megalesius","Mylas","Nikon","Ormenos","Simon","Skelmis","Tethys","Thalassa","Thaumas","Thoosa","Triteia","Triton","Tritones","Hades","Zeus","Poseidon","Apollo","Ares","Dionysus","Hephaestus","Hestia","Demeter","Hera","Artemis","Athena","Aphrodite","Hermes","Aether","Ananke","Chaos","Chronos","Erebos","Eros","Gaia","Hemera","Hypnos","Nyx","Uranus","Phanes","Pontus","Tartarus","Thalassa","Thanatos","Briareus","Cottus","Gyges","Agrius","Alcyoneus","Otos","Ephialtes","Antaeus","Argus Panoptes","Arges","Brontes","Steropes","Polyphemus","Enceladus","Geryon","Orion","Porphyrion","Talos","Tityos","Typhon","Alke","Amechania","Anaideia","Angelia","Apate","Apheleia","Aporia","Arete","Atë","Bia","Caerus","Corus","Deimos","Dikaiosyne","Dike","Dolos","Dysnomia","Dyssebeia","Eirene","Ekecheiria","Achos","Ania","Lupe","Achlys","Adephagia","Adikia","Aergia","Agon","Aidos","Aisa","Alala","Alastor","Aletheia","Eleos","Elpis","Epiphron","Eris","Anteros","Eros","Hedylogos","Himeros","Pothos","Eucleia","Eulabeia","Eunomia","Eupheme","Eupraxia","Eusebeia","Euthenia","Gelos","Geras","Harmonia","Hebe","Hedone","Heimarmene","Homados","Homonoia","Horkos","Horme","Hybris","Hypnos","Ioke","Kakia","Kalokagathia","Koalemos","Kratos","Kydoimos","Lethe","Limos","Lyssa","Mania","Clotho","Lachesis","Atropos","Momus","Moros","Nemesis","Nike","Nomos","Oizys","Epiales","Morpheus","Phantasos","Phobetor","Palioxis","Peitharchia","Peitho","Penia","Penthus","Pepromene","Pheme","Philophrosyne","Philotes","Phobos","The","Phrike","Phthonus","Pistis","Poine","Polemos","Ponos","Poros","Praxidike","Proioxis","Prophasis","Ptocheia","Soter","Soteria","Sophrosyne","Techne","Thanatos","Thrasos","Tyche","Zelos"
];
function words(options) {
function word() {
return wordList[randInt(wordList.length)];
}
function randInt(lessThan) {
return Math.floor(Math.random() * lessThan);
}
// No arguments = generate one word
if (typeof(options) === 'undefined') {
return word();
}
// Just a number = return that many words
if (typeof(options) === 'number') {
options = { exactly: options };
}
// options supported: exactly, min, max, join
if (options.exactly) {
options.min = options.exactly;
options.max = options.exactly;
}
var total = options.min + randInt(options.max + 1 - options.min);
var results = [];
for (var i = 0; (i < total); i++) {
results.push(word());
}
if (options.join) {
results = results.join(options.join);
}
return results;
}
module.exports = words;
// Export the word list as it is often useful
words.wordList = wordList;