artdaq_node_server  v1_00_07
 All Classes Namespaces Files Variables Pages
padStart.js
1 var createPadding = require('./_createPadding'),
2  stringSize = require('./_stringSize'),
3  toInteger = require('./toInteger'),
4  toString = require('./toString');
5 
29 function padStart(string, length, chars) {
30  string = toString(string);
31  length = toInteger(length);
32 
33  var strLength = length ? stringSize(string) : 0;
34  return (length && strLength < length)
35  ? (createPadding(length - strLength, chars) + string)
36  : string;
37 }
38 
39 module.exports = padStart;