Skip to content

Commit

Permalink
buffer: remove TODOs in atob / btoa
Browse files Browse the repository at this point in the history
Refs: #38433 (comment)

PR-URL: #38548
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Zijian Liu <lxxyxzj@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
  • Loading branch information
XadillaX authored and targos committed May 17, 2021
1 parent 90b640e commit dcae032
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions lib/buffer.js
Original file line number Diff line number Diff line change
Expand Up @@ -1217,8 +1217,9 @@ const lazyInvalidCharError = hideStackFrames((message, name) => {
});

function btoa(input) {
// TODO(@jasnell): The implementation here has not been performance
// optimized in any way.
// The implementation here has not been performance optimized in any way and
// should not be.
// Refs: https://github.com/nodejs/node/pull/38433#issuecomment-828426932
input = `${input}`;
for (let n = 0; n < input.length; n++) {
if (input[n].charCodeAt(0) > 0xff)
Expand All @@ -1232,8 +1233,9 @@ const kBase64Digits =
'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';

function atob(input) {
// TODO(@jasnell): The implementation here has not been performance
// optimized in any way.
// The implementation here has not been performance optimized in any way and
// should not be.
// Refs: https://github.com/nodejs/node/pull/38433#issuecomment-828426932
input = `${input}`;
for (let n = 0; n < input.length; n++) {
if (!kBase64Digits.includes(input[n]))
Expand Down

0 comments on commit dcae032

Please sign in to comment.