mirror of
https://github.com/zebrajr/node.git
synced 2026-01-15 12:15:26 +00:00
lib: refactor source_map to avoid unsafe array iteration
PR-URL: https://github.com/nodejs/node/pull/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>
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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';
|
||||
|
||||
Reference in New Issue
Block a user