Skip to content

Commit

Permalink
rename strings/strings.ts to strings/mod.ts (#449)
Browse files Browse the repository at this point in the history
  • Loading branch information
axetroy authored and ry committed May 26, 2019
1 parent 4381785 commit 2f003fa
Show file tree
Hide file tree
Showing 13 changed files with 28 additions and 24 deletions.
2 changes: 1 addition & 1 deletion io/readers.ts
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion io/readers_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
2 changes: 1 addition & 1 deletion io/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand Down
2 changes: 1 addition & 1 deletion io/writers.ts
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion mime/multipart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
7 changes: 7 additions & 0 deletions strings/decode.ts
Original file line number Diff line number Diff line change
@@ -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 changes: 7 additions & 0 deletions strings/encode.ts
Original file line number Diff line number Diff line change
@@ -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 changes: 5 additions & 0 deletions strings/mod.ts
Original file line number Diff line number Diff line change
@@ -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";
15 changes: 0 additions & 15 deletions strings/strings.ts

This file was deleted.

2 changes: 1 addition & 1 deletion ws/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
2 changes: 1 addition & 1 deletion ws/example_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
2 changes: 1 addition & 1 deletion ws/mod.ts
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
2 changes: 1 addition & 1 deletion ws/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 2f003fa

Please sign in to comment.