Code coverage report for string/properCase.js

Statements: 100% (5 / 5)      Branches: 100% (0 / 0)      Functions: 100% (3 / 3)      Lines: 100% (4 / 4)     

All files » string/ » properCase.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 151                 1 1   1    
define(['./lowerCase', './upperCase'], function(lowerCase, upperCase){
    /**
     * UPPERCASE first char of each word.
     * - ported from Miller Medeiros Eclipse Monkey Scripts
     * @example properCase('loRem iPSum') -> 'Lorem Ipsum'
     * @param {string} str
     * @return {string}
     * @version 0.1.0 (2011/07/20)
     */
    function properCase(str){
        return lowerCase(str).replace(/^\w|\s\w/g, upperCase); //replace first char of each word to UPPERCASE
    }
    return properCase;
});