mirror of
https://github.com/denoland/std.git
synced 2024-11-21 20:50:22 +00:00
chore: Add a root module (mod.ts
) to @std/encoding
(#4820)
* Add mod.ts entrypoint for encoding * Add todo * Add module docs * Remove encoding readme * Add mod.ts to exports * Fix example
This commit is contained in:
parent
e3f63dc2ef
commit
e0886f7ce1
@ -1,9 +0,0 @@
|
||||
Utilities for encoding and decoding common formats like hex, base64, and varint.
|
||||
|
||||
This module is browser compatible.
|
||||
|
||||
```ts
|
||||
import { encodeBase64 } from "@std/encoding/base64";
|
||||
|
||||
encodeBase64("foobar"); // "Zm9vYmFy"
|
||||
```
|
@ -2,6 +2,7 @@
|
||||
"name": "@std/encoding",
|
||||
"version": "0.224.1",
|
||||
"exports": {
|
||||
".": "./mod.ts",
|
||||
"./ascii85": "./ascii85.ts",
|
||||
"./base32": "./base32.ts",
|
||||
"./base58": "./base58.ts",
|
||||
|
34
encoding/mod.ts
Normal file
34
encoding/mod.ts
Normal file
@ -0,0 +1,34 @@
|
||||
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
||||
|
||||
/**
|
||||
* Utilities for encoding and decoding common formats like hex, base64, and varint.
|
||||
*
|
||||
* This module is browser compatible.
|
||||
*
|
||||
* ```ts
|
||||
* import { encodeBase64, decodeBase64 } from "@std/encoding";
|
||||
* import { assertEquals } from "@std/assert/assert-equals";
|
||||
*
|
||||
* const foobar = new TextEncoder().encode("foobar");
|
||||
* assertEquals(encodeBase64(foobar), "Zm9vYmFy");
|
||||
* assertEquals(decodeBase64("Zm9vYmFy"), foobar);
|
||||
* ```
|
||||
*
|
||||
* @module
|
||||
*/
|
||||
|
||||
export * from "./ascii85.ts";
|
||||
export * from "./base32.ts";
|
||||
export * from "./base58.ts";
|
||||
export * from "./base64.ts";
|
||||
export * from "./base64url.ts";
|
||||
export * from "./hex.ts";
|
||||
// TODO: change to * after varint decode/encode functions are removed
|
||||
export {
|
||||
decodeVarint,
|
||||
decodeVarint32,
|
||||
encodeVarint,
|
||||
MaxUInt64,
|
||||
MaxVarIntLen32,
|
||||
MaxVarIntLen64,
|
||||
} from "./varint.ts";
|
Loading…
Reference in New Issue
Block a user