@awesome-fe/translate
Version:
Translation utils
21 lines • 620 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.pad = void 0;
const lineFeed = '\n';
const space = ' ';
const tabSize = 4;
// Pad `value` with `level * tabSize` spaces. Respects lines. Ignores empty
// lines.
function pad(value, level) {
const values = value.split(lineFeed);
let index = values.length;
const padding = space.repeat(level * tabSize);
while (index--) {
if (values[index].length !== 0) {
values[index] = padding + values[index];
}
}
return values.join(lineFeed);
}
exports.pad = pad;
//# sourceMappingURL=pad.js.map