Code coverage report for template/lib/camelize.js

Statements: 100% (8 / 8)      Branches: 100% (4 / 4)      Functions: 100% (2 / 2)      Lines: 100% (8 / 8)      Ignored: none     

All files » template/lib/ » camelize.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15    1 3344 1   3344 1   3343 3343 2      
'use strict';
 
module.exports = function camelize(str) {
  if (/\./.test(str)) {
    str = str.split('.')[0];
  }
  if (str.length === 1) {
    return str;
  }
  str = str.replace(/^[-_.\s]+/, '').toLowerCase();
  return str.replace(/[-_.]+(\w|$)/g, function (_, ch) {
    return ch.toUpperCase();
  });
};