diff options
| author | Axetroy <troy450409405@gmail.com> | 2019-05-27 07:58:31 +0800 |
|---|---|---|
| committer | Ryan Dahl <ry@tinyclouds.org> | 2019-05-27 02:58:31 +0300 |
| commit | ad3de86604f6bae352e06ef9154e371f4d5d1860 (patch) | |
| tree | fa52c7502697f7e70a294921815bc60d9f59849a /strings | |
| parent | 8d94f70bef6e44d0a0ddb6f8410a35d95a34139a (diff) | |
rename strings/strings.ts to strings/mod.ts (denoland/deno_std#449)
Original: https://github.com/denoland/deno_std/commit/2f003fa35cb354b1b1cc43af196a0d356b334ed3
Diffstat (limited to 'strings')
| -rw-r--r-- | strings/decode.ts | 7 | ||||
| -rw-r--r-- | strings/encode.ts | 7 | ||||
| -rw-r--r-- | strings/mod.ts | 5 | ||||
| -rw-r--r-- | strings/strings.ts | 15 |
4 files changed, 19 insertions, 15 deletions
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); -} |
