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:
parent
8d94f70bef
commit
ad3de86604
13 changed files with 28 additions and 24 deletions
|
@ -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 {
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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`.
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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
7
strings/decode.ts
Normal 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
7
strings/encode.ts
Normal 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
5
strings/mod.ts
Normal 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";
|
|
@ -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);
|
||||
}
|
|
@ -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";
|
||||
|
|
|
@ -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";
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue