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 rpad(str, minLen, ch) {
|
8 | str = toString(str);
|
9 | ch = ch || ' ';
|
10 | return (str.length < minLen)? str + repeat(ch, minLen - str.length) : str;
|
11 | }
|
12 |
|
13 | module.exports = rpad;
|
14 |
|
15 |
|