forked from AssemblyScript/assemblyscript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtext.ts
More file actions
20 lines (18 loc) · 405 Bytes
/
text.ts
File metadata and controls
20 lines (18 loc) · 405 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/** @module util *//***/
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);
}
}