diff options
Diffstat (limited to 'runtime/js/41_prompt.js')
-rw-r--r-- | runtime/js/41_prompt.js | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/runtime/js/41_prompt.js b/runtime/js/41_prompt.js index cb088dafa..e941461de 100644 --- a/runtime/js/41_prompt.js +++ b/runtime/js/41_prompt.js @@ -2,9 +2,11 @@ "use strict"; ((window) => { const { stdin } = window.__bootstrap.files; + const { ArrayPrototypePush, StringPrototypeCharCodeAt, Uint8Array } = + window.__bootstrap.primordials; const { isatty } = window.__bootstrap.tty; - const LF = "\n".charCodeAt(0); - const CR = "\r".charCodeAt(0); + const LF = StringPrototypeCharCodeAt("\n", 0); + const CR = StringPrototypeCharCodeAt("\r", 0); const core = window.Deno.core; function alert(message = "Alert") { @@ -59,7 +61,7 @@ if (c[0] === LF) { break; } - buf.push(CR); + ArrayPrototypePush(buf, CR); if (n === null || n === 0) { break; } @@ -67,7 +69,7 @@ if (c[0] === LF) { break; } - buf.push(c[0]); + ArrayPrototypePush(buf, c[0]); } return core.decode(new Uint8Array(buf)); } |