summaryrefslogtreecommitdiff
path: root/std/encoding
diff options
context:
space:
mode:
authorAnh Hong <hong4rc@gmail.com>2020-12-11 02:45:45 +0700
committerGitHub <noreply@github.com>2020-12-11 06:45:45 +1100
commitb8bc24d167f2e19482d9dc6d367876c361abf4ea (patch)
tree5e46858514914eed698d1c941fe8593547e93ed4 /std/encoding
parentfd9b0202c1bb0e83183fd0a53d8b1303612a5e31 (diff)
chore: fixed various misspellings and other typos (#8691)
Diffstat (limited to 'std/encoding')
-rw-r--r--std/encoding/README.md18
-rw-r--r--std/encoding/_yaml/example/inout.ts2
-rw-r--r--std/encoding/_yaml/loader/loader.ts2
-rw-r--r--std/encoding/_yaml/type/float.ts2
-rw-r--r--std/encoding/ascii85.ts6
-rw-r--r--std/encoding/ascii85_test.ts12
-rw-r--r--std/encoding/binary.ts4
-rw-r--r--std/encoding/csv_stringify.ts2
-rw-r--r--std/encoding/hex.ts6
-rw-r--r--std/encoding/toml.ts2
10 files changed, 28 insertions, 28 deletions
diff --git a/std/encoding/README.md b/std/encoding/README.md
index edfbeacc5..3c60c6fcd 100644
--- a/std/encoding/README.md
+++ b/std/encoding/README.md
@@ -187,7 +187,7 @@ function is as follows:
| :--: | :--------: | :--------: |
| Deno | rust | typescript |
-- **`options`** are options for the delimiter-seprated output.
+- **`options`** are options for the delimiter-separated output.
- **`headers?: boolean`**: Whether or not to include the row of headers.
Default: `true`
@@ -538,18 +538,18 @@ console.log(encode(binaryData));
// => LpTqp
```
-### Specifying a standard and delimeter
+### Specifying a standard and delimiter
By default all functions are using the most popular Adobe version of ascii85 and
-not adding any delimeter. However, there are three more standards supported -
-btoa (different delimeter and additional compression of 4 bytes equal to 32),
+not adding any delimiter. However, there are three more standards supported -
+btoa (different delimiter and additional compression of 4 bytes equal to 32),
[Z85](https://rfc.zeromq.org/spec/32/) and
[RFC 1924](https://tools.ietf.org/html/rfc1924). It's possible to use a
different encoding by specifying it in `options` object as a second parameter.
-Similarly, it's possible to make `encode` add a delimeter (`<~` and `~>` for
-Adobe, `xbtoa Begin` and `xbtoa End` with newlines between the delimeters and
-encoded data for btoa. Checksums for btoa are not supported. Delimeters are not
+Similarly, it's possible to make `encode` add a delimiter (`<~` and `~>` for
+Adobe, `xbtoa Begin` and `xbtoa End` with newlines between the delimiters and
+encoded data for btoa. Checksums for btoa are not supported. Delimiters are not
supported by other encodings.)
encoding examples:
@@ -562,9 +562,9 @@ import {
const binaryData = new Uint8Array([136, 180, 79, 24]);
console.log(encode(binaryData));
// => LpTqp
-console.log(encode(binaryData, { standard: "Adobe", delimeter: true }));
+console.log(encode(binaryData, { standard: "Adobe", delimiter: true }));
// => <~LpTqp~>
-console.log(encode(binaryData, { standard: "btoa", delimeter: true }));
+console.log(encode(binaryData, { standard: "btoa", delimiter: true }));
/* => xbtoa Begin
LpTqp
xbtoa End */
diff --git a/std/encoding/_yaml/example/inout.ts b/std/encoding/_yaml/example/inout.ts
index b0b47e3fe..2f7ca6d6b 100644
--- a/std/encoding/_yaml/example/inout.ts
+++ b/std/encoding/_yaml/example/inout.ts
@@ -23,5 +23,5 @@ const string = stringify(test);
if (Deno.inspect(test) === Deno.inspect(parse(string))) {
console.log("In-Out as expected.");
} else {
- console.log("Someting went wrong.");
+ console.log("Something went wrong.");
}
diff --git a/std/encoding/_yaml/loader/loader.ts b/std/encoding/_yaml/loader/loader.ts
index 16da3ba4a..b4657c745 100644
--- a/std/encoding/_yaml/loader/loader.ts
+++ b/std/encoding/_yaml/loader/loader.ts
@@ -942,7 +942,7 @@ function readBlockScalar(state: LoaderState, nodeIndent: number): boolean {
}
}
- // Break this `while` cycle and go to the funciton's epilogue.
+ // Break this `while` cycle and go to the function's epilogue.
break;
}
diff --git a/std/encoding/_yaml/type/float.ts b/std/encoding/_yaml/type/float.ts
index 93635ba25..832934fe2 100644
--- a/std/encoding/_yaml/type/float.ts
+++ b/std/encoding/_yaml/type/float.ts
@@ -103,7 +103,7 @@ function representYamlFloat(object: Any, style?: StyleVariant): Any {
const res = object.toString(10);
// JS stringifier can build scientific format without dots: 5e-100,
- // while YAML requres dot: 5.e-100. Fix it with simple hack
+ // while YAML requires dot: 5.e-100. Fix it with simple hack
return SCIENTIFIC_WITHOUT_DOT.test(res) ? res.replace("e", ".e") : res;
}
diff --git a/std/encoding/ascii85.ts b/std/encoding/ascii85.ts
index 6a303ebda..cb2a3ec76 100644
--- a/std/encoding/ascii85.ts
+++ b/std/encoding/ascii85.ts
@@ -4,8 +4,8 @@
export type Ascii85Standard = "Adobe" | "btoa" | "RFC 1924" | "Z85";
/**
* encoding/decoding options
- * @property standard - characterset and delimeter (if supported and used). Defaults to Adobe
- * @property delimeter - whether to use a delimeter (if supported) - "<~" and "~>" by default
+ * @property standard - characterset and delimiter (if supported and used). Defaults to Adobe
+ * @property delimiter - whether to use a delimiter (if supported) - "<~" and "~>" by default
*/
export interface Ascii85Options {
standard?: Ascii85Standard;
@@ -20,7 +20,7 @@ const Z85 =
* @param uint8 input to encode
* @param [options] encoding options
* @param [options.standard=Adobe] encoding standard (Adobe, btoa, RFC 1924 or Z85)
- * @param [options.delimeter] whether to use a delimeter, if supported by encoding standard
+ * @param [options.delimiter] whether to use a delimiter, if supported by encoding standard
*/
export function encode(uint8: Uint8Array, options?: Ascii85Options): string {
const standard = options?.standard ?? "Adobe";
diff --git a/std/encoding/ascii85_test.ts b/std/encoding/ascii85_test.ts
index cea939faf..b6d77a8ff 100644
--- a/std/encoding/ascii85_test.ts
+++ b/std/encoding/ascii85_test.ts
@@ -3,7 +3,7 @@ import { assertEquals } from "../testing/asserts.ts";
import { Ascii85Standard, decode, encode } from "./ascii85.ts";
type TestCases = Partial<{ [index in Ascii85Standard]: string[][] }>;
const utf8encoder = new TextEncoder();
-const testCasesNoDelimeter: TestCases = {
+const testCasesNoDelimiter: TestCases = {
Adobe: [
["test", "FCfN8"],
["ascii85", "@<5pmBfIs"],
@@ -76,7 +76,7 @@ const testCasesNoDelimeter: TestCases = {
[" ", "arR^H"],
],
};
-const testCasesDelimeter: TestCases = {
+const testCasesDelimiter: TestCases = {
Adobe: [
["test", "<~FCfN8~>"],
["ascii85", "<~@<5pmBfIs~>"],
@@ -116,7 +116,7 @@ const testCasesDelimeter: TestCases = {
],
};
-for (const [standard, tests] of Object.entries(testCasesNoDelimeter)) {
+for (const [standard, tests] of Object.entries(testCasesNoDelimiter)) {
if (tests === undefined) continue;
Deno.test({
name: `[encoding/ascii85] encode ${standard}`,
@@ -144,10 +144,10 @@ for (const [standard, tests] of Object.entries(testCasesNoDelimeter)) {
},
});
}
-for (const [standard, tests] of Object.entries(testCasesDelimeter)) {
+for (const [standard, tests] of Object.entries(testCasesDelimiter)) {
if (tests === undefined) continue;
Deno.test({
- name: `[encoding/ascii85] encode ${standard} with delimeter`,
+ name: `[encoding/ascii85] encode ${standard} with delimiter`,
fn(): void {
for (const [bin, b85] of tests) {
assertEquals(
@@ -162,7 +162,7 @@ for (const [standard, tests] of Object.entries(testCasesDelimeter)) {
});
Deno.test({
- name: `[encoding/ascii85] decode ${standard} with delimeter`,
+ name: `[encoding/ascii85] decode ${standard} with delimiter`,
fn(): void {
for (const [bin, b85] of tests) {
assertEquals(
diff --git a/std/encoding/binary.ts b/std/encoding/binary.ts
index f4918e750..f66fb61aa 100644
--- a/std/encoding/binary.ts
+++ b/std/encoding/binary.ts
@@ -193,7 +193,7 @@ export function putVarbig(
return sizeof(o.dataType);
}
-/** Decodes a number from `r`, comsuming `sizeof(o.dataType)` bytes. If less than `sizeof(o.dataType)` bytes were read, throws `Deno.errors.unexpectedEof`.
+/** Decodes a number from `r`, consuming `sizeof(o.dataType)` bytes. If less than `sizeof(o.dataType)` bytes were read, throws `Deno.errors.unexpectedEof`.
*
* `o.dataType` defaults to `"int32"`. */
export async function readVarnum(
@@ -205,7 +205,7 @@ export async function readVarnum(
return varnum(scratch, o) as number;
}
-/** Decodes a bigint from `r`, comsuming `sizeof(o.dataType)` bytes. If less than `sizeof(o.dataType)` bytes were read, throws `Deno.errors.unexpectedEof`.
+/** Decodes a bigint from `r`, consuming `sizeof(o.dataType)` bytes. If less than `sizeof(o.dataType)` bytes were read, throws `Deno.errors.unexpectedEof`.
*
* `o.dataType` defaults to `"int64"`. */
export async function readVarbig(
diff --git a/std/encoding/csv_stringify.ts b/std/encoding/csv_stringify.ts
index 4c5f8c816..c968820dd 100644
--- a/std/encoding/csv_stringify.ts
+++ b/std/encoding/csv_stringify.ts
@@ -17,7 +17,7 @@ function getEscapedString(value: unknown, sep: string): string {
if (typeof value === "object") str = JSON.stringify(value);
else str = String(value);
- // Is regex.test more performant here? If so, how to dynamically create?
+ // Is regex.test more performance here? If so, how to dynamically create?
// https://stackoverflow.com/questions/3561493/
if (str.includes(sep) || str.includes(NEWLINE) || str.includes(QUOTE)) {
return `${QUOTE}${str.replaceAll(QUOTE, `${QUOTE}${QUOTE}`)}${QUOTE}`;
diff --git a/std/encoding/hex.ts b/std/encoding/hex.ts
index 20d42f657..4ff3f0724 100644
--- a/std/encoding/hex.ts
+++ b/std/encoding/hex.ts
@@ -5,7 +5,7 @@
// license that can be found in the LICENSE file.
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
-const hextable = new TextEncoder().encode("0123456789abcdef");
+const hexTable = new TextEncoder().encode("0123456789abcdef");
/**
* ErrInvalidByte takes an invalid byte and returns an Error.
@@ -52,8 +52,8 @@ export function encode(src: Uint8Array): Uint8Array {
const dst = new Uint8Array(encodedLen(src.length));
for (let i = 0; i < dst.length; i++) {
const v = src[i];
- dst[i * 2] = hextable[v >> 4];
- dst[i * 2 + 1] = hextable[v & 0x0f];
+ dst[i * 2] = hexTable[v >> 4];
+ dst[i * 2 + 1] = hexTable[v & 0x0f];
}
return dst;
}
diff --git a/std/encoding/toml.ts b/std/encoding/toml.ts
index a397a7bd9..34a428b90 100644
--- a/std/encoding/toml.ts
+++ b/std/encoding/toml.ts
@@ -679,7 +679,7 @@ class Dumper {
const min = dtPad(value.getUTCMinutes().toString());
const s = dtPad(value.getUTCSeconds().toString());
const ms = dtPad(value.getUTCMilliseconds().toString(), 3);
- // formated date
+ // formatted date
const fData = `${value.getUTCFullYear()}-${m}-${d}T${h}:${min}:${s}.${ms}`;
return `${this._declaration(keys)}${fData}`;
}