Last active
March 14, 2024 08:10
-
-
Save FlameWolf/805e6c4b9bbbce92ec4c42aad43cedc6 to your computer and use it in GitHub Desktop.
Mallu name generator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function generateMalluNames(randomise = false) { | |
const alphabet = new Array(26); | |
const vowels = ["a", "e", "i", "o", "u"]; | |
const softConsonants = ["b", "c", "d", "g", "j", "k", "p", "r", "s", "t", "z"]; | |
for (let i = 0; i < 26; i++) { | |
alphabet[i] = String.fromCharCode(i + 97); | |
if (i === 16) { | |
alphabet[i] += "u"; | |
} | |
} | |
const girls = ["ajeesha", "ajisha", "ancy", "aneesha", "anisha", "anjana", "anjisha", "anjita", "anjusha", "anya", "aruna", "avya", "azha", "azhita", "eena", "eeta", "eetu", "eeva", "ejina", "ejisha", "hanya", "haranya", "havya", "heeba", "herly", "hiba", "hibi", "hita", "ibi", "ibina", "ida", "idya", "iji", "ijina", "ijisha", "ijosha", "imila", "imina", "imisha", "ina", "incy", "ineesha", "inisha", "inita", "inosha", "inya", "isha", "iss", "issy", "ita", "itu", "ivina", "ivya", "iya", "iza", "jina", "jisha", "josha", "neesha", "nisha", "nita", "njana", "njisha", "njita", "njusha", "nosha", "nu", "ojina", "ojisha", "onisha", "onita", "osha", "sha"]; | |
const boys = ["aiju", "ajeesh", "ajesh", "aji", "ajish", "aneesh", "anesh", "anish", "aran", "ari", "arun", "bi", "bu", "eet", "eevan", "eji", "ejin", "elson", "haran", "hari", "harun", "hibin", "hibu", "hijo", "ibin", "ibu", "ijeesh", "ijesh", "ijin", "ijo", "ijosh", "ijoy", "iju", "imesh", "ineesh", "inesh", "ini", "inish", "inosh", "into", "inu", "iran", "ish", "ivin", "ji", "jin", "jo", "neesh", "nesh", "ni", "nish", "nosh", "obi", "obu", "oji", "ojin", "ojo", "oni", "onish", "onu", "osh"]; | |
const generateNames = source => { | |
const output = []; | |
for (const firstChar of alphabet) { | |
for (const remainder of source) { | |
const remainderFirstChar = remainder[0]; | |
const skip = ((vowels.includes(firstChar) && vowels.includes(remainderFirstChar)) || (!vowels.includes(firstChar) && !vowels.includes(remainderFirstChar))) && !(softConsonants.includes(firstChar) && remainderFirstChar == "h"); | |
if (!skip) { | |
output.push(`${firstChar}${remainder}`); | |
} | |
} | |
} | |
if (randomise) { | |
for (let i = output.length - 1; i > 0; i--) { | |
const j = Math.floor(Math.random() * (i + 1)); | |
[output[i], output[j]] = [output[j], output[i]]; | |
} | |
} | |
return output; | |
}; | |
return { | |
girls: generateNames(girls), | |
boys: generateNames(boys) | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment