JsMe!

less than 1 minute read

Basic function to format css-attribute to js style.camelCase

function jsMe(css) {
  var pos = css.indexOf("-");
  css = css.slice(0,pos)
       + css.charAt(pos+1).toUpperCase()
       + css.slice(pos+2,css.length);
  return css;
}
console.log(jsMe("font-weight"));  // fontWeight

Add to Object.prototype and use in global scope

Object.prototype.jsMe