/**
* Returns the CVNX notation of a domain name.
*
* @param {string} name The name of the domain (without the TLD).
* @return The CVNX notation of the domain name.
* @customfunction
*/
function DOMAIN_PATTERN(name) {
const vowels = ["a", "e", "i", "o", "u"];
const consonents = ["b", "c", "d", "f", "g", "h", "j", "k", "l", "m", "n", "p", "q", "r", "s", "t", "v", "w", "x", "y", "z"];
const letters = name.toLowerCase().split("");
let pattern = [];
letters.map(letter => vowels.includes(letter) ? pattern.push("V") : (consonents.includes(letter) ? pattern.push("C") : (!isNaN(letter) ? pattern.push("N") : pattern.push("X"))));
return pattern.join("");
}
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter