21 lines
405 B
TypeScript
Raw Normal View History

2018-03-19 01:12:18 +01:00
/** @module util *//***/
2018-03-17 23:41:48 +01:00
const indentX1 = " ";
const indentX2 = " ";
const indentX4 = " ";
/** Creates an indentation matching the number of specified levels. */
export function indent(sb: string[], level: i32): void {
while (level >= 4) {
sb.push(indentX4);
level -= 4;
}
if (level >= 2) {
sb.push(indentX2);
level -= 2;
}
if (level) {
sb.push(indentX1);
}
}