@k8ts/instruments
Version:
A collection of utilities and core components for k8ts.
27 lines • 769 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.pretty = pretty;
const displayers_1 = require("../displayers");
function pretty(templateArgs, ...args) {
args = args.map(arg => {
const [format, target] = Array.isArray(arg) ? arg : [undefined, arg];
const x = displayers_1.Displayers.tryGet(target);
if (x) {
return x.pretty(format);
}
return target;
});
const splat = templateArgs
.map((x, i) => {
const arg = args[i];
if (arg) {
return [x, arg];
}
return x;
})
.flat()
.filter(x => x !== undefined);
const result = splat.join("");
return result;
}
//# sourceMappingURL=pretty-print.js.map