UNPKG

368 BJavaScriptView Raw
1var DASH = /-([a-z])/g;
2var MS = /^Ms/g;
3var cache = {};
4
5function toUpper(match) {
6 return match[1].toUpperCase();
7}
8
9export default function camelCaseProperty(property) {
10 if (cache.hasOwnProperty(property)) {
11 return cache[property];
12 }
13
14 var camelProp = property.replace(DASH, toUpper).replace(MS, 'ms');
15 cache[property] = camelProp;
16 return camelProp;
17}
\No newline at end of file