just-animate
Version:
_Making Animation Simple_
17 lines (16 loc) • 478 B
JavaScript
import { isString } from './inspect';
const camelCaseRegex = /([a-z])[- ]([a-z])/gi;
function camelCaseReplacer(_, p1, p2) {
return p1 + p2.toUpperCase();
}
export function toCamelCase(value) {
return isString(value)
? value.replace(camelCaseRegex, camelCaseReplacer)
: '';
}
export function hyphenate(value) {
return value.replace(/([A-Z])/g, match => `-` + match[0].toLowerCase());
}
export function csvToList(data) {
return data.split(',');
}