summaryrefslogtreecommitdiff
path: root/std/encoding
diff options
context:
space:
mode:
Diffstat (limited to 'std/encoding')
-rw-r--r--std/encoding/_yaml/example/sample_document.ts4
-rw-r--r--std/encoding/_yaml/type/binary.ts7
-rw-r--r--std/encoding/base64_test.ts10
-rw-r--r--std/encoding/base64url_test.ts8
4 files changed, 10 insertions, 19 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;
diff --git a/std/encoding/base64_test.ts b/std/encoding/base64_test.ts
index bd559140a..9e549c698 100644
--- a/std/encoding/base64_test.ts
+++ b/std/encoding/base64_test.ts
@@ -1,6 +1,4 @@
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
-
-const { test } = Deno;
import { assertEquals } from "../testing/asserts.ts";
import { encode, decode, decodeString } from "./base64.ts";
@@ -21,25 +19,25 @@ const testsetBinary = [
[new TextEncoder().encode("\x00\x00\x00\x00"), "AAAAAA=="],
];
-test("[encoding/base64] testBase64EncodeString", () => {
+Deno.test("[encoding/base64] testBase64EncodeString", () => {
for (const [input, output] of testsetString) {
assertEquals(encode(input), output);
}
});
-test("[encoding/base64] testBase64DecodeString", () => {
+Deno.test("[encoding/base64] testBase64DecodeString", () => {
for (const [input, output] of testsetString) {
assertEquals(decodeString(output), input);
}
});
-test("[encoding/base64] testBase64EncodeBinary", () => {
+Deno.test("[encoding/base64] testBase64EncodeBinary", () => {
for (const [input, output] of testsetBinary) {
assertEquals(encode(input), output);
}
});
-test("[encoding/base64] testBase64DecodeBinary", () => {
+Deno.test("[encoding/base64] testBase64DecodeBinary", () => {
for (const [input, output] of testsetBinary) {
const outputBinary = new Uint8Array(decode(output as string));
assertEquals(outputBinary, input as Uint8Array);
diff --git a/std/encoding/base64url_test.ts b/std/encoding/base64url_test.ts
index 2af9096a4..9a864a87c 100644
--- a/std/encoding/base64url_test.ts
+++ b/std/encoding/base64url_test.ts
@@ -1,6 +1,4 @@
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
-
-const { test } = Deno;
import { assertEquals } from "../testing/asserts.ts";
import { encode, decode } from "./base64url.ts";
@@ -22,19 +20,19 @@ const testsetBinary = [
[new TextEncoder().encode("\x00\x00\x00\x00"), "AAAAAA"],
];
-test("[encoding/base64url] testBase64urlEncodeString", () => {
+Deno.test("[encoding/base64url] testBase64urlEncodeString", () => {
for (const [input, output] of testsetString) {
assertEquals(encode(input), output);
}
});
-test("[encoding/base64url] testBase64urlEncodeBinary", () => {
+Deno.test("[encoding/base64url] testBase64urlEncodeBinary", () => {
for (const [input, output] of testsetBinary) {
assertEquals(encode(input), output);
}
});
-test("[encoding/base64ur] testBase64urDecodeBinary", () => {
+Deno.test("[encoding/base64ur] testBase64urDecodeBinary", () => {
for (const [input, output] of testsetBinary) {
const outputBinary = new Uint8Array(decode(output as string));
assertEquals(outputBinary, input as Uint8Array);