0
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-03-03 09:31:22 -05:00

rename strings/strings.ts to strings/mod.ts (denoland/deno_std#449)

Original: 2f003fa35c
This commit is contained in:
Axetroy 2019-05-27 07:58:31 +08:00 committed by Ryan Dahl
parent 8d94f70bef
commit ad3de86604
13 changed files with 28 additions and 24 deletions

View file

@ -1,7 +1,7 @@
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
type Reader = Deno.Reader;
type ReadResult = Deno.ReadResult;
import { encode } from "../strings/strings.ts";
import { encode } from "../strings/mod.ts";
/** Reader utility for strings */
export class StringReader implements Reader {

View file

@ -4,7 +4,7 @@ import { assertEquals } from "../testing/asserts.ts";
import { MultiReader, StringReader } from "./readers.ts";
import { StringWriter } from "./writers.ts";
import { copyN } from "./ioutil.ts";
import { decode } from "../strings/strings.ts";
import { decode } from "../strings/mod.ts";
test(async function ioStringReader(): Promise<void> {
const r = new StringReader("abcdef");

View file

@ -2,7 +2,7 @@
const { Buffer, mkdir, open } = Deno;
type File = Deno.File;
type Reader = Deno.Reader;
import { encode } from "../strings/strings.ts";
import { encode } from "../strings/mod.ts";
import * as path from "../fs/path.ts";
// `off` is the offset into `dst` where it will at which to begin writing values
// from `src`.

View file

@ -1,6 +1,6 @@
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
type Writer = Deno.Writer;
import { decode, encode } from "../strings/strings.ts";
import { decode, encode } from "../strings/mod.ts";
/** Writer utility for buffering string chunks */
export class StringWriter implements Writer {

View file

@ -12,7 +12,7 @@ import { MultiReader } from "../io/readers.ts";
import { tempFile } from "../io/util.ts";
import { BufReader, BufState, BufWriter } from "../io/bufio.ts";
import { TextProtoReader } from "../textproto/mod.ts";
import { encoder } from "../strings/strings.ts";
import { encoder } from "../strings/mod.ts";
import * as path from "../fs/path.ts";
function randomBoundary(): string {

7
strings/decode.ts Normal file
View file

@ -0,0 +1,7 @@
/** A default TextDecoder instance */
export const decoder = new TextDecoder();
/** Shorthand for new TextDecoder().decode() */
export function decode(input?: Uint8Array): string {
return decoder.decode(input);
}

7
strings/encode.ts Normal file
View file

@ -0,0 +1,7 @@
/** A default TextEncoder instance */
export const encoder = new TextEncoder();
/** Shorthand for new TextEncoder().encode() */
export function encode(input?: string): Uint8Array {
return encoder.encode(input);
}

5
strings/mod.ts Normal file
View file

@ -0,0 +1,5 @@
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
export * from "./encode.ts";
export * from "./decode.ts";
export * from "./pad.ts";

View file

@ -1,15 +0,0 @@
/** A default TextEncoder instance */
export const encoder = new TextEncoder();
/** Shorthand for new TextEncoder().encode() */
export function encode(input?: string): Uint8Array {
return encoder.encode(input);
}
/** A default TextDecoder instance */
export const decoder = new TextDecoder();
/** Shorthand for new TextDecoder().decode() */
export function decode(input?: Uint8Array): string {
return decoder.decode(input);
}

View file

@ -82,7 +82,7 @@ import {
isWebSocketPingEvent,
isWebSocketPongEvent
} from "https://deno.land/std/ws/mod.ts";
import { encode } from "https://deno.land/std/strings/strings.ts";
import { encode } from "https://deno.land/std/strings/mod.ts";
import { BufReader } from "https://deno.land/std/io/bufio.ts";
import { TextProtoReader } from "https://deno.land/std/textproto/mod.ts";
import { blue, green, red, yellow } from "https://deno.land/std/colors/mod.ts";

View file

@ -4,7 +4,7 @@ import {
isWebSocketPingEvent,
isWebSocketPongEvent
} from "../ws/mod.ts";
import { encode } from "../strings/strings.ts";
import { encode } from "../strings/mod.ts";
import { BufReader } from "../io/bufio.ts";
import { TextProtoReader } from "../textproto/mod.ts";
import { blue, green, red, yellow } from "../colors/mod.ts";

View file

@ -1,6 +1,6 @@
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
import { decode, encode } from "../strings/strings.ts";
import { decode, encode } from "../strings/mod.ts";
type Conn = Deno.Conn;
type Writer = Deno.Writer;

View file

@ -11,7 +11,7 @@ import {
unmask,
writeFrame
} from "./mod.ts";
import { encode } from "../strings/strings.ts";
import { encode } from "../strings/mod.ts";
const { Buffer } = Deno;