Skip to main content

generateEmoticonPermutations

Callable


  • This function will generate multiple permutations of a base emoticon character. The following permutations will occur:

    • ) mouth will be replaced with ] and }. The same applies to sad/frowning mouths.
    • / mouth will be replaced with \.
    • : eyes will be replaced with =.
    • Supports a - nose, by injecting between the eyes and mouth.
    • Supports both uppercase and lowercase variants.
    import { generateEmoticonPermutations } from 'emojibase';
    generateEmoticonPermutations(':)'); // =-), =-}, :-], =-], :-}, :-), =}, =], =), :}, :], :)

    The base emoticon must follow a set of naming guidelines to work properly.

    Furthermore, this function accepts an options object as the 2nd argument, as a means to customize the output.

    • isFace (bool) - Toggles face permutations (mouth and eye variants). Defaults to true.
    • withNose (bool) - Toggles nose inclusion. Defaults to true.
    generateEmoticonPermutations(':)', { withNose: false }); // =}, =], =), :}, :], :)generateEmoticonPermutations('\\m/', { isFace: false }); // \m/, \M/