@airgap/coinlib-core
Version:
The @airgap/coinlib-core is a protocol agnostic library to prepare, sign and broadcast cryptocurrency transactions.
20 lines • 747 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.padStart = void 0;
function padStart(targetString, targetLength, padString) {
// truncate if number, or convert non-number to 0
targetLength = targetLength >> 0;
if (targetString.length >= targetLength) {
return targetString;
}
else {
targetLength = targetLength - targetString.length;
if (targetLength > padString.length) {
// append to original to ensure we are longer than needed
padString += padString.repeat(targetLength / padString.length);
}
return padString.slice(0, targetLength) + targetString;
}
}
exports.padStart = padStart;
//# sourceMappingURL=padStart.js.map