63641d3f552e5ad8a50b2b476bd8826a89bc1a2a
[platform/framework/web/crosswalk-tizen.git] /
1 var toString = require('../lang/toString');
2 var repeat = require('./repeat');
3
4     /**
5      * Pad string with `char` if its' length is smaller than `minLen`
6      */
7     function lpad(str, minLen, ch) {
8         str = toString(str);
9         ch = ch || ' ';
10
11         return (str.length < minLen) ?
12             repeat(ch, minLen - str.length) + str : str;
13     }
14
15     module.exports = lpad;
16
17