32 lines
790 B
JavaScript
32 lines
790 B
JavaScript
|
"use strict";
|
||
|
|
||
|
Object.defineProperty(exports, "__esModule", {
|
||
|
value: true
|
||
|
});
|
||
|
exports.default = void 0;
|
||
|
|
||
|
var padStart = function padStart(string, targetLength, padString) {
|
||
|
targetLength = targetLength >> 0;
|
||
|
string = String(string);
|
||
|
padString = String(padString);
|
||
|
|
||
|
if (string.length > targetLength) {
|
||
|
return String(string);
|
||
|
}
|
||
|
|
||
|
targetLength = targetLength - string.length;
|
||
|
|
||
|
if (targetLength > padString.length) {
|
||
|
padString += padString.repeat(targetLength / padString.length);
|
||
|
}
|
||
|
|
||
|
return padString.slice(0, targetLength) + String(string);
|
||
|
};
|
||
|
|
||
|
var _default = function _default(n) {
|
||
|
var length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
|
||
|
return padStart(n, length, '0');
|
||
|
};
|
||
|
|
||
|
exports.default = _default;
|
||
|
//# sourceMappingURL=pad.js.map
|