From 536e23f90a01d5b94ec02617448bad7b5508da6d Mon Sep 17 00:00:00 2001 From: XadillaX Date: Wed, 5 May 2021 15:26:53 +0800 Subject: [PATCH] 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 Reviewed-By: Rich Trott Reviewed-By: James M Snell Reviewed-By: Zijian Liu Reviewed-By: Trivikram Kamat --- lib/buffer.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/buffer.js b/lib/buffer.js index bb4710d3682d34..b16d696b023fe1 100644 --- a/lib/buffer.js +++ b/lib/buffer.js @@ -1212,8 +1212,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) @@ -1227,8 +1228,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]))