Code coverage report for string/startsWith.js

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

All files » string/ » startsWith.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 181                   1 6 6 6   1    
define(function () {
    /**
    * Checks if string starts with specified prefix.
    * @example startsWith('lorem ipsum', 'ipsum') -> false
    * @example startsWith('lorem ipsum', 'lorem') -> true
    * @param {string} str
    * @param {string} prefix
    * @return {bool}
    * @version 0.1.0 (2012/03/01)
    */
    function startsWith(str, prefix) {
        str = (str || '');
        prefix = (prefix || '');
        return str.indexOf(prefix) === 0;
    }
    return startsWith;
});