mirror of
https://github.com/coding-horror/basic-computer-games.git
synced 2025-12-27 13:14:15 -08:00
show terminal header with link to sources
This commit is contained in:
21
00_Common/javascript/common.mjs
Normal file
21
00_Common/javascript/common.mjs
Normal file
@@ -0,0 +1,21 @@
|
||||
|
||||
export function print(...messages) {
|
||||
process.stdout.write(messages.join(""));
|
||||
}
|
||||
|
||||
export function println(...messages) {
|
||||
process.stdout.write(messages.join("") + "\n");
|
||||
}
|
||||
|
||||
export function tab(count) {
|
||||
return " ".repeat(count);
|
||||
}
|
||||
|
||||
export async function input(message = "") {
|
||||
process.stdout.write(message + ' ');
|
||||
return new Promise(resolve => {
|
||||
process.stdin.on('data', (input) => {
|
||||
resolve(input.toString().replace('\n', ''));
|
||||
});
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user