Skip to content

Commit f962eee

Browse files
sendilkumarnsokra
authored andcommitted
fixing comments
1 parent dbf4c03 commit f962eee

2 files changed

Lines changed: 12 additions & 12 deletions

File tree

‎lib/JsonpMainTemplatePlugin.js‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,13 @@ class JsonpMainTemplatePlugin {
4040
this.indent(`script.setAttribute("nonce", ${this.requireFn}.nc);`),
4141
"}",
4242
`script.src = ${this.requireFn}.p + ${this.applyPluginsWaterfall("asset-path", JSON.stringify(chunkFilename), {
43-
hash: "\" + " + this.renderCurrentHashCode(hash) + " + \"",
44-
hashWithLength: length => "\" + " + this.renderCurrentHashCode(hash, length) + " + \"",
43+
hash: `" + ${this.renderCurrentHashCode(hash)} + "`,
44+
hashWithLength: length => `" + ${this.renderCurrentHashCode(hash, length)} + "`,
4545
chunk: {
4646
id: "\" + chunkId + \"",
47-
hash: "\" + " + JSON.stringify(chunkMaps.hash) + "[chunkId] + \"",
47+
hash: `" + ${JSON.stringify(chunkMaps.hash)}[chunkId] + "`,
4848
hashWithLength(length) {
49-
const shortChunkHashMap = {};
49+
const shortChunkHashMap = Object.create(null);
5050
Object.keys(chunkMaps.hash).forEach(chunkId => {
5151
if(typeof chunkMaps.hash[chunkId] === "string")
5252
shortChunkHashMap[chunkId] = chunkMaps.hash[chunkId].substr(0, length);
@@ -56,7 +56,7 @@ class JsonpMainTemplatePlugin {
5656
name: "\" + (" + JSON.stringify(chunkMaps.name) + "[chunkId]||chunkId) + \""
5757
}
5858
})};`,
59-
"var timeout = setTimeout(onScriptComplete, " + chunkLoadTimeout + ");",
59+
`var timeout = setTimeout(onScriptComplete, ${chunkLoadTimeout});`,
6060
"script.onerror = script.onload = onScriptComplete;",
6161
"function onScriptComplete() {",
6262
this.indent([
@@ -111,7 +111,7 @@ class JsonpMainTemplatePlugin {
111111
source,
112112
"",
113113
"// on error function for async loading",
114-
this.requireFn + ".oe = function(err) { console.error(err); throw err; };"
114+
`${this.requireFn}.oe = function(err) { console.error(err); throw err; };`
115115
]);
116116
});
117117
mainTemplate.plugin("bootstrap", function(source, chunk, hash) {
@@ -121,8 +121,8 @@ class JsonpMainTemplatePlugin {
121121
source,
122122
"",
123123
"// install a JSONP callback for chunk loading",
124-
"var parentJsonpFunction = window[" + JSON.stringify(jsonpFunction) + "];",
125-
"window[" + JSON.stringify(jsonpFunction) + "] = function webpackJsonpCallback(chunkIds, moreModules, executeModules) {",
124+
`var parentJsonpFunction = window[${JSON.stringify(jsonpFunction)}];`,
125+
`window[${JSON.stringify(jsonpFunction)}] = function webpackJsonpCallback(chunkIds, moreModules, executeModules) {`,
126126
this.indent([
127127
"// add \"moreModules\" to the modules object,",
128128
"// then flag all \"chunkIds\" as loaded and fire callback",
@@ -149,7 +149,7 @@ class JsonpMainTemplatePlugin {
149149
"if(executeModules) {",
150150
this.indent([
151151
"for(i=0; i < executeModules.length; i++) {",
152-
this.indent("result = " + this.requireFn + "(" + this.requireFn + ".s = executeModules[i]);"),
152+
this.indent(`result = ${this.requireFn}(${this.requireFn}.s = executeModules[i]);`),
153153
"}"
154154
]),
155155
"}",

‎lib/ModuleFilenameHelpers.js‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ ModuleFilenameHelpers.createFilename = function createFilename(module, moduleFil
5454
let identifier;
5555
let moduleId;
5656
let shortIdentifier;
57-
if(!module) module = "";
57+
if(module === undefined) module = "";
5858
if(typeof module === "string") {
5959
shortIdentifier = requestShortener.shorten(module);
6060
identifier = shortIdentifier;
@@ -118,8 +118,8 @@ ModuleFilenameHelpers.createFooter = function createFooter(module, requestShorte
118118
};
119119

120120
ModuleFilenameHelpers.replaceDuplicates = function replaceDuplicates(array, fn, comparator) {
121-
const countMap = {};
122-
const posMap = {};
121+
const countMap = Object.create(null);
122+
const posMap = Object.create(null);
123123
array.forEach((item, idx) => {
124124
countMap[item] = (countMap[item] || []);
125125
countMap[item].push(idx);

0 commit comments

Comments
 (0)