diff options
author | Nayeem Rahman <nayeemrmn99@gmail.com> | 2020-06-12 20:23:38 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-12 15:23:38 -0400 |
commit | 1fff6f55c3ba98a10018c6d374795e612061e9b6 (patch) | |
tree | 12074b6d44736b11513d857e437f9e30a6bf65a4 /std/encoding/_yaml | |
parent | 26bf56afdaf16634ffbaa23684faf3a44cc10f62 (diff) |
refactor: Don't destructure the Deno namespace (#6268)
Diffstat (limited to 'std/encoding/_yaml')
-rw-r--r-- | std/encoding/_yaml/example/sample_document.ts | 4 | ||||
-rw-r--r-- | std/encoding/_yaml/type/binary.ts | 7 |
2 files changed, 3 insertions, 8 deletions
diff --git a/std/encoding/_yaml/example/sample_document.ts b/std/encoding/_yaml/example/sample_document.ts index da969d679..f66b3c417 100644 --- a/std/encoding/_yaml/example/sample_document.ts +++ b/std/encoding/_yaml/example/sample_document.ts @@ -3,10 +3,8 @@ import { parse } from "../../yaml.ts"; -const { readFileSync, cwd } = Deno; - (() => { - const yml = readFileSync(`${cwd()}/example/sample_document.yml`); + const yml = Deno.readFileSync(`${Deno.cwd()}/example/sample_document.yml`); const document = new TextDecoder().decode(yml); const obj = parse(document) as object; diff --git a/std/encoding/_yaml/type/binary.ts b/std/encoding/_yaml/type/binary.ts index f4823b3f7..1a321afe8 100644 --- a/std/encoding/_yaml/type/binary.ts +++ b/std/encoding/_yaml/type/binary.ts @@ -2,12 +2,9 @@ // Copyright 2011-2015 by Vitaly Puzrin. All rights reserved. MIT license. // https://github.com/nodeca/js-yaml/commit/665aadda42349dcae869f12040d9b10ef18d12da // Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. - import { Type } from "../type.ts"; import { Any } from "../utils.ts"; -const { Buffer } = Deno; - // [ 64, 65, 66 ] -> [ padding, CR, LF ] const BASE64_MAP = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r"; @@ -72,7 +69,7 @@ function constructYamlBinary(data: string): Deno.Buffer { result.push((bits >> 4) & 0xff); } - return new Buffer(new Uint8Array(result)); + return new Deno.Buffer(new Uint8Array(result)); } function representYamlBinary(object: Uint8Array): string { @@ -119,7 +116,7 @@ function representYamlBinary(object: Uint8Array): string { } function isBinary(obj: Any): obj is Deno.Buffer { - const buf = new Buffer(); + const buf = new Deno.Buffer(); try { if (0 > buf.readFromSync(obj as Deno.Buffer)) return true; return false; |