Skip to content

Function: getCamelAndMaybeKebabPropKeysFor() ​

ts
function getCamelAndMaybeKebabPropKeysFor(key: string): {
  camel: string;
  kebab: string;
};

Converts an event name to both camelCase and kebab-case handler prop names. Handles events with colons by treating the first part specially (prepending 'on').

Parameters ​

ParameterTypeDescription
keystringThe event name (e.g., 'update:modelValue')

Returns ​

ts
{
  camel: string;
  kebab: string;
}

Object with both camelCase and kebab-case versions of the handler prop

NameType
camelstring
kebabstring

Example ​

typescript
getCamelAndMaybeKebabPropKeysFor("update:modelValue");
// Returns: { camel: 'onUpdateModelValue', kebab: 'onUpdate:modelValue' }