summaryrefslogtreecommitdiff
path: root/std/encoding
diff options
context:
space:
mode:
Diffstat (limited to 'std/encoding')
-rw-r--r--std/encoding/mod.ts15
-rw-r--r--std/encoding/utf8.ts15
2 files changed, 15 insertions, 15 deletions
diff --git a/std/encoding/mod.ts b/std/encoding/mod.ts
deleted file mode 100644
index eaa28ae27..000000000
--- a/std/encoding/mod.ts
+++ /dev/null
@@ -1,15 +0,0 @@
-export {
- HeaderOptions as CsvHeaderOptions,
- ParseError as CsvParseError,
- ParseOptions as ParseCsvOptions,
- parse as parseCsv,
-} from "./csv.ts";
-export {
- decode as decodeHex,
- decodeString as decodeHexString,
- encode as encodeToHex,
- encodeToString as encodeToHexString,
-} from "./hex.ts";
-export { parse as parseToml, stringify as tomlStringify } from "./toml.ts";
-export { parse as parseYaml, stringify as yamlStringify } from "./yaml.ts";
-export * from "./binary.ts";
diff --git a/std/encoding/utf8.ts b/std/encoding/utf8.ts
new file mode 100644
index 000000000..266c61165
--- /dev/null
+++ b/std/encoding/utf8.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);
+}