UNPKG

onix-core

Version:
20 lines 792 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.justify = void 0; const tslib_1 = require("tslib"); const padEnd_1 = tslib_1.__importDefault(require("lodash/padEnd")); const padStart_1 = tslib_1.__importDefault(require("lodash/padStart")); const justify = (value, prefix, leftJustify, minWidth, zeroPad) => { var diff = minWidth - value.length; if (diff > 0) { if (leftJustify || !zeroPad) { value = leftJustify ? padStart_1.default(value, minWidth) : padEnd_1.default(value, minWidth); } else { value = value.slice(0, prefix.length) + padStart_1.default('', diff, '0') + value.slice(prefix.length); } } return value; }; exports.justify = justify; //# sourceMappingURL=Justify.js.map