How to cast Plasmic names to code names?

Hello there, I’ve been trying to write down a method for casting the plasmic variant names with a regex, I think I might be still missing something as codegen is stripping out spaces and changing the capitalization on those, is there an official helper inside the plasmic lib I can use? I’ll share my code here, feel free to improve it :slightly_smiling_face:

export function toPlasmicVariantName(str) 
{
    if (!str) return;
    return str.replace(/[A-Z]([a-z]){1,}|[A-Z]{1,}/g, function(word, char, index) {
        return index === 0 ? word.toLowerCase() : word.split('')[0].toUpperCase() + word.toLowerCase().substring(1);
    }).replace(/\s|\_+/g, '');
}

Hey @theoretical_pig. We export some of the types that are used in the variants.
For example

Plasmic{ComponentName}__VariantMembers["variantName"]

will return all the available values for the variantName .
Does this help your use case?

Nope, already saw that one. I would like to use the same name that was given inside plasmic studio to activate the variant.

We use lodash/camelCase for the variant name, and we filter characters not from the alphabet. Also remember to decapitalize the first letter