format: prettify entire project
This commit is contained in:
66
node_modules/source-map/lib/util.js
generated
vendored
66
node_modules/source-map/lib/util.js
generated
vendored
@ -26,7 +26,8 @@ function getArg(aArgs, aName, aDefaultValue) {
|
||||
}
|
||||
exports.getArg = getArg;
|
||||
|
||||
var urlRegexp = /^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/;
|
||||
var urlRegexp =
|
||||
/^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/;
|
||||
var dataUrlRegexp = /^data:.+\,.+$/;
|
||||
|
||||
function urlParse(aUrl) {
|
||||
@ -39,7 +40,7 @@ function urlParse(aUrl) {
|
||||
auth: match[2],
|
||||
host: match[3],
|
||||
port: match[4],
|
||||
path: match[5]
|
||||
path: match[5],
|
||||
};
|
||||
}
|
||||
exports.urlParse = urlParse;
|
||||
@ -57,7 +58,7 @@ function urlGenerate(aParsedUrl) {
|
||||
url += aParsedUrl.host;
|
||||
}
|
||||
if (aParsedUrl.port) {
|
||||
url += ":" + aParsedUrl.port
|
||||
url += ':' + aParsedUrl.port;
|
||||
}
|
||||
if (aParsedUrl.path) {
|
||||
url += aParsedUrl.path;
|
||||
@ -139,11 +140,11 @@ exports.normalize = normalize;
|
||||
* - Joining for example 'http://' and 'www.example.com' is also supported.
|
||||
*/
|
||||
function join(aRoot, aPath) {
|
||||
if (aRoot === "") {
|
||||
aRoot = ".";
|
||||
if (aRoot === '') {
|
||||
aRoot = '.';
|
||||
}
|
||||
if (aPath === "") {
|
||||
aPath = ".";
|
||||
if (aPath === '') {
|
||||
aPath = '.';
|
||||
}
|
||||
var aPathUrl = urlParse(aPath);
|
||||
var aRootUrl = urlParse(aRoot);
|
||||
@ -169,8 +170,9 @@ function join(aRoot, aPath) {
|
||||
return urlGenerate(aRootUrl);
|
||||
}
|
||||
|
||||
var joined = aPath.charAt(0) === '/'
|
||||
? aPath
|
||||
var joined =
|
||||
aPath.charAt(0) === '/' ?
|
||||
aPath
|
||||
: normalize(aRoot.replace(/\/+$/, '') + '/' + aPath);
|
||||
|
||||
if (aRootUrl) {
|
||||
@ -192,8 +194,8 @@ exports.isAbsolute = function (aPath) {
|
||||
* @param aPath The path or URL to be made relative to aRoot.
|
||||
*/
|
||||
function relative(aRoot, aPath) {
|
||||
if (aRoot === "") {
|
||||
aRoot = ".";
|
||||
if (aRoot === '') {
|
||||
aRoot = '.';
|
||||
}
|
||||
|
||||
aRoot = aRoot.replace(/\/$/, '');
|
||||
@ -204,7 +206,7 @@ function relative(aRoot, aPath) {
|
||||
// a prefix that fits, or we run out of components to remove.
|
||||
var level = 0;
|
||||
while (aPath.indexOf(aRoot + '/') !== 0) {
|
||||
var index = aRoot.lastIndexOf("/");
|
||||
var index = aRoot.lastIndexOf('/');
|
||||
if (index < 0) {
|
||||
return aPath;
|
||||
}
|
||||
@ -221,16 +223,16 @@ function relative(aRoot, aPath) {
|
||||
}
|
||||
|
||||
// Make sure we add a "../" for each component we removed from the root.
|
||||
return Array(level + 1).join("../") + aPath.substr(aRoot.length + 1);
|
||||
return Array(level + 1).join('../') + aPath.substr(aRoot.length + 1);
|
||||
}
|
||||
exports.relative = relative;
|
||||
|
||||
var supportsNullProto = (function () {
|
||||
var obj = Object.create(null);
|
||||
return !('__proto__' in obj);
|
||||
}());
|
||||
})();
|
||||
|
||||
function identity (s) {
|
||||
function identity(s) {
|
||||
return s;
|
||||
}
|
||||
|
||||
@ -272,15 +274,17 @@ function isProtoString(s) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (s.charCodeAt(length - 1) !== 95 /* '_' */ ||
|
||||
s.charCodeAt(length - 2) !== 95 /* '_' */ ||
|
||||
s.charCodeAt(length - 3) !== 111 /* 'o' */ ||
|
||||
s.charCodeAt(length - 4) !== 116 /* 't' */ ||
|
||||
s.charCodeAt(length - 5) !== 111 /* 'o' */ ||
|
||||
s.charCodeAt(length - 6) !== 114 /* 'r' */ ||
|
||||
s.charCodeAt(length - 7) !== 112 /* 'p' */ ||
|
||||
s.charCodeAt(length - 8) !== 95 /* '_' */ ||
|
||||
s.charCodeAt(length - 9) !== 95 /* '_' */) {
|
||||
if (
|
||||
s.charCodeAt(length - 1) !== 95 /* '_' */ ||
|
||||
s.charCodeAt(length - 2) !== 95 /* '_' */ ||
|
||||
s.charCodeAt(length - 3) !== 111 /* 'o' */ ||
|
||||
s.charCodeAt(length - 4) !== 116 /* 't' */ ||
|
||||
s.charCodeAt(length - 5) !== 111 /* 'o' */ ||
|
||||
s.charCodeAt(length - 6) !== 114 /* 'r' */ ||
|
||||
s.charCodeAt(length - 7) !== 112 /* 'p' */ ||
|
||||
s.charCodeAt(length - 8) !== 95 /* '_' */ ||
|
||||
s.charCodeAt(length - 9) !== 95 /* '_' */
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -340,7 +344,11 @@ exports.compareByOriginalPositions = compareByOriginalPositions;
|
||||
* source/name/original line and column the same. Useful when searching for a
|
||||
* mapping with a stubbed out mapping.
|
||||
*/
|
||||
function compareByGeneratedPositionsDeflated(mappingA, mappingB, onlyCompareGenerated) {
|
||||
function compareByGeneratedPositionsDeflated(
|
||||
mappingA,
|
||||
mappingB,
|
||||
onlyCompareGenerated
|
||||
) {
|
||||
var cmp = mappingA.generatedLine - mappingB.generatedLine;
|
||||
if (cmp !== 0) {
|
||||
return cmp;
|
||||
@ -368,7 +376,8 @@ function compareByGeneratedPositionsDeflated(mappingA, mappingB, onlyCompareGene
|
||||
|
||||
return strcmp(mappingA.name, mappingB.name);
|
||||
}
|
||||
exports.compareByGeneratedPositionsDeflated = compareByGeneratedPositionsDeflated;
|
||||
exports.compareByGeneratedPositionsDeflated =
|
||||
compareByGeneratedPositionsDeflated;
|
||||
|
||||
function strcmp(aStr1, aStr2) {
|
||||
if (aStr1 === aStr2) {
|
||||
@ -422,7 +431,8 @@ function compareByGeneratedPositionsInflated(mappingA, mappingB) {
|
||||
|
||||
return strcmp(mappingA.name, mappingB.name);
|
||||
}
|
||||
exports.compareByGeneratedPositionsInflated = compareByGeneratedPositionsInflated;
|
||||
exports.compareByGeneratedPositionsInflated =
|
||||
compareByGeneratedPositionsInflated;
|
||||
|
||||
/**
|
||||
* Strip any JSON XSSI avoidance prefix from the string (as documented
|
||||
@ -471,7 +481,7 @@ function computeSourceURL(sourceRoot, sourceURL, sourceMapURL) {
|
||||
if (sourceMapURL) {
|
||||
var parsed = urlParse(sourceMapURL);
|
||||
if (!parsed) {
|
||||
throw new Error("sourceMapURL could not be parsed");
|
||||
throw new Error('sourceMapURL could not be parsed');
|
||||
}
|
||||
if (parsed.path) {
|
||||
// Strip the last path component, but keep the "/".
|
||||
|
Reference in New Issue
Block a user