pad.js 283 Bytes Raw Blame History Permalink 1 2 3 4 5 6 7 8 9 10 11 12 13 define(['../string/lpad', '../lang/toNumber'], function(lpad, toNumber){ /** * Add padding zeros if n.length < minLength. */ function pad(n, minLength, char){ n = toNumber(n); return lpad(''+ n, minLength, char || '0'); } return pad; });