"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.pad = exports.Alignment = void 0;
var Alignment;
(function (Alignment) {
    Alignment["LEFT"] = "left";
    Alignment["RIGHT"] = "right";
})(Alignment || (exports.Alignment = Alignment = {}));
// Utility for fixed-length field formatting
var pad = function (val, len, align, fill) {
    if (align === void 0) { align = Alignment.LEFT; }
    if (fill === void 0) { fill = ' '; }
    if (val === undefined || val === null)
        throw new Error('pad: valeur indéfinie ou nulle');
    var strVal = String(val);
    var res = align === Alignment.RIGHT ? strVal.padStart(len, fill) : strVal.padEnd(len, fill);
    if (res.length !== len) {
        throw new Error("Padding error: ".concat(res, " is not of length ").concat(len));
    }
    return res;
};
exports.pad = pad;
