Code coverage report for string/lpad.js

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

All files » string/ » lpad.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 171         1 26 26   26       1      
define(['../lang/toString', './repeat'], function(toString, repeat) {
 
    /**
     * Pad string with `char` if its' length is smaller than `minLen`
     */
    function lpad(str, minLen, ch) {
        str = toString(str);
        ch = ch || ' ';
 
        return ((str.length < minLen)
            ? repeat(ch, minLen - str.length) + str : str);
    }
 
    return lpad;
 
});