Skip to content

Commit

Permalink
replace a regex with conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
zloirock committed Aug 1, 2024
1 parent 8fbd1eb commit 269890f
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions packages/core-js/internals/uint8-from-base64.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,13 @@ var base64UrlAlphabet = base64Map.c2iUrl;

var SyntaxError = globalThis.SyntaxError;
var TypeError = globalThis.TypeError;
var ASCII_WHITESPACE = /[\t\n\f\r ]/;
var exec = uncurryThis(ASCII_WHITESPACE.exec);
var at = uncurryThis(''.charAt);

var skipAsciiWhitespace = function (string, index) {
var length = string.length;
for (;index < length; index++) {
if (!exec(ASCII_WHITESPACE, at(string, index))) break;
var chr = at(string, index);
if (chr !== ' ' && chr !== '\t' && chr !== '\n' && chr !== '\f' && chr !== '\r') break;
} return index;
};

Expand Down

0 comments on commit 269890f

Please sign in to comment.