index.js 536 B

123456789101112131415161718192021222324252627282930
  1. "use strict";
  2. const pattern = /-(\w|$)/g;
  3. const callback = (dashChar, char) => char.toUpperCase();
  4. const camelCaseCSS = property =>
  5. {
  6. property = property.toLowerCase();
  7. // NOTE :: IE8's "styleFloat" is intentionally not supported
  8. if (property === "float")
  9. {
  10. return "cssFloat";
  11. }
  12. // Microsoft vendor-prefixes are uniquely cased
  13. else if (property.startsWith("-ms-"))
  14. {
  15. return property.substr(1).replace(pattern, callback);
  16. }
  17. else
  18. {
  19. return property.replace(pattern, callback);
  20. }
  21. };
  22. module.exports = camelCaseCSS;