From 33f62789cde407059abba0a7ac18b2145c648ea7 Mon Sep 17 00:00:00 2001 From: Yusuke Sakurai Date: Mon, 11 Feb 2019 08:49:48 +0900 Subject: feat: multipart, etc.. (denoland/deno_std#180) Original: https://github.com/denoland/deno_std/commit/fda9c98d055091fa886fa444ebd1adcd2ecd21bc --- strings/strings.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 strings/strings.ts (limited to 'strings/strings.ts') 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); +} -- cgit v1.2.3