mirror of
https://github.com/coding-horror/basic-computer-games.git
synced 2025-12-22 07:10:42 -08:00
22 lines
488 B
JavaScript
22 lines
488 B
JavaScript
|
|
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', ''));
|
|
});
|
|
});
|
|
}
|