Skip to content

Commit

Permalink
Merge branch 'master' into markm-byte-array-2
Browse files Browse the repository at this point in the history
  • Loading branch information
erights committed Jun 13, 2024
2 parents c5e9200 + 8355aba commit e0ebd6e
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 e0ebd6e

Please sign in to comment.