Code coverage report for string/camelCase.js

Statements: 100% (7 / 7)      Branches: 100% (0 / 0)      Functions: 100% (3 / 3)      Lines: 100% (6 / 6)     

All files » string/ » camelCase.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 211                 1 10 10         10   1    
define(['./replaceAccents', './removeNonWord', './upperCase', './lowerCase'], function(replaceAccents, removeNonWord, upperCase, lowerCase){
    /**
    * Convert string to camelCase text.
    * - ported from Miller Medeiros Eclipse Monkey Scripts
    * @example camelCase('my --  awesome-text') -> 'myAwesomeText';
    * @param {string} str
    * @return {string}
    * @version 0.2.0 (2011/08/09)
    */
    function camelCase(str){
        str = replaceAccents(str);
        str = removeNonWord(str)
                .replace(/\-/g, ' ') //convert all hyphens to spaces
                .replace(/\s[a-z]/g, upperCase) //convert first char of each word to UPPERCASE
                .replace(/\s+/g, '') //remove spaces
                .replace(/^[A-Z]/g, lowerCase); //convert first char to lowercase
        return str;
    }
    return camelCase;
});