Javascript String leftpad(len, pad)
String.prototype.leftpad = function(len, pad) { pad = (pad || ' ').repeat(len); return pad + this.split(/\n/).join('\n' + pad); }