// 数字转成字符串,同时在前面填充 function fill(num, length, fillers = " ", atLast = false) { var result = `${num}`; if (result.length < length) { let fillString = new Array(length - result.length + 1).join(fillers) result = atLast ? `${result}${fillString}` : `${fillString}${result}`; } return result; } module.exports = { fill, }