00001 var createPadding = require('./_createPadding'), 00002 stringSize = require('./_stringSize'), 00003 toInteger = require('./toInteger'), 00004 toString = require('./toString'); 00005 00029 function padStart(string, length, chars) { 00030 string = toString(string); 00031 length = toInteger(length); 00032 00033 var strLength = length ? stringSize(string) : 0; 00034 return (length && strLength < length) 00035 ? (createPadding(length - strLength, chars) + string) 00036 : string; 00037 } 00038 00039 module.exports = padStart;