diff options
| author | Yusuke Sakurai <kerokerokerop@gmail.com> | 2019-02-11 08:49:48 +0900 |
|---|---|---|
| committer | Ryan Dahl <ry@tinyclouds.org> | 2019-02-10 18:49:48 -0500 |
| commit | 33f62789cde407059abba0a7ac18b2145c648ea7 (patch) | |
| tree | 454d487f232a61f6c57e2ebdad66e49bf939e4d6 /strings/strings.ts | |
| parent | ed20bda6ec324b8143c6210024647d2692232c26 (diff) | |
feat: multipart, etc.. (denoland/deno_std#180)
Original: https://github.com/denoland/deno_std/commit/fda9c98d055091fa886fa444ebd1adcd2ecd21bc
Diffstat (limited to 'strings/strings.ts')
| -rw-r--r-- | strings/strings.ts | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/strings/strings.ts b/strings/strings.ts new file mode 100644 index 000000000..266c61165 --- /dev/null +++ b/strings/strings.ts @@ -0,0 +1,15 @@ +/** 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); +} |
