@threlte/theatre
Version:
Threlte Components for Theatre, an animation library with a professional motion design toolset
8 lines (7 loc) • 414 B
JavaScript
export const makeAlphanumeric = (label) => {
// make the label alphanumeric by first removing dots (fundamental feature for pierced props) and make the following characters uppercase
label = label.replace(/\./g, '-').replace(/-([a-z])/g, (g) => g[1].toUpperCase());
// finally, convert to safe alphanumeric characters without dashes
label = label.replace(/[^a-zA-Z0-9]/g, '');
return label;
};