diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2021-07-04 00:17:52 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-04 00:17:52 +0200 |
commit | 5addba2abc2e384e751e8884b4ac3219688c2473 (patch) | |
tree | a5249a82092909f32a852a910e5e144ddeffa497 /runtime/js/41_prompt.js | |
parent | ffa75be48044255ed49a822a7a61a2a130123a4a (diff) |
refactor: use primordials in runtime/, part2 (#11248)
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)); } |