summaryrefslogtreecommitdiff
path: root/std/examples/cat.ts
diff options
context:
space:
mode:
authorAndy Hayden <andyhayden1@gmail.com>2019-10-27 06:04:42 -0700
committerRy Dahl <ry@tinyclouds.org>2019-10-27 09:04:42 -0400
commitaec5a646c9218a0a0da62cbcd1f28bc23c242540 (patch)
treee052f0263eb2abc4915dc3710ec44ee34e9ad621 /std/examples/cat.ts
parent51dd91a3ccfd9554bcf69b539f2f748da81c5b12 (diff)
feat: top-level-for-await (#3212)
Diffstat (limited to 'std/examples/cat.ts')
-rw-r--r--std/examples/cat.ts13
1 files changed, 5 insertions, 8 deletions
diff --git a/std/examples/cat.ts b/std/examples/cat.ts
index 3626e3c29..9e713d862 100644
--- a/std/examples/cat.ts
+++ b/std/examples/cat.ts
@@ -1,10 +1,7 @@
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
-async function cat(filenames: string[]): Promise<void> {
- for (const filename of filenames) {
- const file = await Deno.open(filename);
- await Deno.copy(Deno.stdout, file);
- file.close();
- }
+const filenames = Deno.args.slice(1);
+for (const filename of filenames) {
+ const file = await Deno.open(filename);
+ await Deno.copy(Deno.stdout, file);
+ file.close();
}
-
-cat(Deno.args.slice(1));