Merge pull request #10279 from jamesgeorge007/tweaks

chore(NormalModule): refactor code adhering to ES6 semantics
This commit is contained in:
Tobias Koppers 2020-01-20 13:08:26 +01:00 committed by GitHub
commit b57fdd74f0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -78,7 +78,7 @@ const contextifySourceUrl = (context, source, associatedObjectForCache) => {
*/
const contextifySourceMap = (context, sourceMap, associatedObjectForCache) => {
if (!Array.isArray(sourceMap.sources)) return sourceMap;
const sourceRoot = sourceMap.sourceRoot;
const { sourceRoot } = sourceMap;
/** @type {function(string): string} */
const mapper = !sourceRoot
? source => source
@ -178,7 +178,7 @@ class NormalModule extends Module {
* @param {string} options.rawRequest request without resolving
* @param {LoaderItem[]} options.loaders list of loaders
* @param {string} options.resource path + query of the real resource
* @param {string | undefined} options.matchResource path + query of the matched resource (virtuel
* @param {string | undefined} options.matchResource path + query of the matched resource (virtual)
* @param {Parser} options.parser the parser used
* @param {Generator} options.generator the generator used
* @param {Object} options.resolveOptions options used for resolving requests from this module
@ -663,7 +663,7 @@ class NormalModule extends Module {
applyNoParseRule(rule, content) {
// must start with "rule" if rule is a string
if (typeof rule === "string") {
return content.indexOf(rule) === 0;
return content.startsWith(rule);
}
if (typeof rule === "function") {