Skip to content

Commit cf9556d

Browse files
aduh95targos
authored andcommitted
lib: refactor source_map to avoid unsafe array iteration
PR-URL: #36734 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Pooja D P <Pooja.D.P@ibm.com>
1 parent 3aee77d commit cf9556d

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

lib/internal/source_map/source_map.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -334,8 +334,8 @@ function cloneSourceMapV3(payload) {
334334
* @return {number}
335335
*/
336336
function compareSourceMapEntry(entry1, entry2) {
337-
const [lineNumber1, columnNumber1] = entry1;
338-
const [lineNumber2, columnNumber2] = entry2;
337+
const { 0: lineNumber1, 1: columnNumber1 } = entry1;
338+
const { 0: lineNumber2, 1: columnNumber2 } = entry2;
339339
if (lineNumber1 !== lineNumber2) {
340340
return lineNumber1 - lineNumber2;
341341
}

lib/internal/source_map/source_map_cache.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ function sourceMapFromFile(mapURL) {
138138
// data:[<mediatype>][;base64],<data> see:
139139
// https://tools.ietf.org/html/rfc2397#section-2
140140
function sourceMapFromDataUrl(sourceURL, url) {
141-
const [format, data] = StringPrototypeSplit(url, ',');
141+
const { 0: format, 1: data } = StringPrototypeSplit(url, ',');
142142
const splitFormat = StringPrototypeSplit(format, ';');
143143
const contentType = splitFormat[0];
144144
const base64 = splitFormat[splitFormat.length - 1] === 'base64';

0 commit comments

Comments
 (0)