You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

16 lines
412 B

var isNum = require('./isNum');
var isUndef = require('./isUndef');
var repeat = require('./repeat');
var regLineBegin = /^(?!\s*$)/gm;
exports = function(str, char, len) {
if (isNum(char)) {
len = char;
char = ' ';
}
if (isUndef(len)) len = 4;
if (isUndef(char)) char = ' ';
char = repeat(char, len);
return str.replace(regLineBegin, char);
};
module.exports = exports;