From ad3de86604f6bae352e06ef9154e371f4d5d1860 Mon Sep 17 00:00:00 2001 From: Axetroy Date: Mon, 27 May 2019 07:58:31 +0800 Subject: rename strings/strings.ts to strings/mod.ts (denoland/deno_std#449) Original: https://github.com/denoland/deno_std/commit/2f003fa35cb354b1b1cc43af196a0d356b334ed3 --- strings/decode.ts | 7 +++++++ strings/encode.ts | 7 +++++++ strings/mod.ts | 5 +++++ strings/strings.ts | 15 --------------- 4 files changed, 19 insertions(+), 15 deletions(-) create mode 100644 strings/decode.ts create mode 100644 strings/encode.ts create mode 100644 strings/mod.ts delete mode 100644 strings/strings.ts (limited to 'strings') diff --git a/strings/decode.ts b/strings/decode.ts new file mode 100644 index 000000000..2e161d7af --- /dev/null +++ b/strings/decode.ts @@ -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); +} diff --git a/strings/encode.ts b/strings/encode.ts new file mode 100644 index 000000000..285305613 --- /dev/null +++ b/strings/encode.ts @@ -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); +} diff --git a/strings/mod.ts b/strings/mod.ts new file mode 100644 index 000000000..2acc32600 --- /dev/null +++ b/strings/mod.ts @@ -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"; diff --git a/strings/strings.ts b/strings/strings.ts deleted file mode 100644 index 266c61165..000000000 --- a/strings/strings.ts +++ /dev/null @@ -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); -} -- cgit v1.2.3