Skip to content

Commit

Permalink
docs: export spec for encodeBase64
Browse files Browse the repository at this point in the history
The bit about rfc4648 is on a function that isn't exported from the package, so it doesn't show up in the generated reference docs.
  • Loading branch information
dckc authored Jun 12, 2024
1 parent f845665 commit 21f1eab
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions packages/base64/src/encode.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@
import { alphabet64, padding } from './common.js';

/**
* Encodes bytes into a Base64 string, as specified in
* https://tools.ietf.org/html/rfc4648#section-4
*
* XSnap is a JavaScript engine based on Moddable/XS.
* The algorithm below is orders of magnitude too slow on this VM, but it
* arranges a native binding on the global object.
Expand Down Expand Up @@ -65,6 +62,11 @@ export const jsEncodeBase64 = data => {
return string;
};

/** @type {typeof jsEncodeBase64} */
/**
* Encodes bytes into a Base64 string, as specified in
* https://tools.ietf.org/html/rfc4648#section-4
*
* @type {typeof jsEncodeBase64}
*/
export const encodeBase64 =
globalThis.Base64 !== undefined ? globalThis.Base64.encode : jsEncodeBase64;

0 comments on commit 21f1eab

Please sign in to comment.