From 158ae0bfe900d2bac3076390c4fe3d2b54d94fe5 Mon Sep 17 00:00:00 2001 From: Stanislav <62983943+stanislavstrelnikov@users.noreply.github.com> Date: Tue, 7 Jul 2020 04:45:39 +0300 Subject: clean up code in cli/js (#6611) --- cli/js/write_text_file.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'cli/js/write_text_file.ts') diff --git a/cli/js/write_text_file.ts b/cli/js/write_text_file.ts index 4f111edb4..615813460 100644 --- a/cli/js/write_text_file.ts +++ b/cli/js/write_text_file.ts @@ -1,10 +1,12 @@ +// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. + import { open, openSync } from "./files.ts"; import { writeAll, writeAllSync } from "./buffer.ts"; export function writeTextFileSync(path: string | URL, data: string): void { const file = openSync(path, { write: true, create: true, truncate: true }); - const enc = new TextEncoder(); - const contents = enc.encode(data); + const encoder = new TextEncoder(); + const contents = encoder.encode(data); writeAllSync(file, contents); file.close(); } @@ -14,8 +16,8 @@ export async function writeTextFile( data: string ): Promise { const file = await open(path, { write: true, create: true, truncate: true }); - const enc = new TextEncoder(); - const contents = enc.encode(data); + const encoder = new TextEncoder(); + const contents = encoder.encode(data); await writeAll(file, contents); file.close(); } -- cgit v1.2.3