summaryrefslogtreecommitdiff
path: root/strings/decode.ts
diff options
context:
space:
mode:
authorAxetroy <troy450409405@gmail.com>2019-05-27 07:58:31 +0800
committerRyan Dahl <ry@tinyclouds.org>2019-05-27 02:58:31 +0300
commitad3de86604f6bae352e06ef9154e371f4d5d1860 (patch)
treefa52c7502697f7e70a294921815bc60d9f59849a /strings/decode.ts
parent8d94f70bef6e44d0a0ddb6f8410a35d95a34139a (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/decode.ts')
-rw-r--r--strings/decode.ts7
1 files changed, 7 insertions, 0 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);
+}