mirror of
https://github.com/nodejs/node.git
synced 2025-08-15 13:48:44 +02:00
buffer: remove TODOs in atob
/ btoa
Refs: https://github.com/nodejs/node/pull/38433#issuecomment-828426932 PR-URL: https://github.com/nodejs/node/pull/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>
This commit is contained in:
parent
52e4fb5b23
commit
0b6f0a0ec2
1 changed files with 6 additions and 4 deletions
|
@ -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)
|
||||
|
@ -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]))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue