Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lib: refactor source_map to avoid unsafe array iteration #36734

Merged
merged 1 commit into from Jan 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/internal/source_map/source_map.js
Expand Up @@ -334,8 +334,8 @@ function cloneSourceMapV3(payload) {
* @return {number}
*/
function compareSourceMapEntry(entry1, entry2) {
const [lineNumber1, columnNumber1] = entry1;
const [lineNumber2, columnNumber2] = entry2;
const { 0: lineNumber1, 1: columnNumber1 } = entry1;
const { 0: lineNumber2, 1: columnNumber2 } = entry2;
if (lineNumber1 !== lineNumber2) {
return lineNumber1 - lineNumber2;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/internal/source_map/source_map_cache.js
Expand Up @@ -138,7 +138,7 @@ function sourceMapFromFile(mapURL) {
// data:[<mediatype>][;base64],<data> see:
// https://tools.ietf.org/html/rfc2397#section-2
function sourceMapFromDataUrl(sourceURL, url) {
const [format, data] = StringPrototypeSplit(url, ',');
const { 0: format, 1: data } = StringPrototypeSplit(url, ',');
const splitFormat = StringPrototypeSplit(format, ';');
const contentType = splitFormat[0];
const base64 = splitFormat[splitFormat.length - 1] === 'base64';
Expand Down