Get rid of typeof for checking undefined

This commit is contained in:
Mihail Bodrov 2018-08-17 00:49:30 +03:00
parent a02bf9960d
commit efa69cd628
1 changed files with 6 additions and 6 deletions

View File

@ -60,13 +60,13 @@ class ContextReplacementPlugin {
cmf.hooks.beforeResolve.tap("ContextReplacementPlugin", result => {
if (!result) return;
if (resourceRegExp.test(result.request)) {
if (typeof newContentResource !== "undefined") {
if (newContentResource !== undefined) {
result.request = newContentResource;
}
if (typeof newContentRecursive !== "undefined") {
if (newContentRecursive !== undefined) {
result.recursive = newContentRecursive;
}
if (typeof newContentRegExp !== "undefined") {
if (newContentRegExp !== undefined) {
result.regExp = newContentRegExp;
}
if (typeof newContentCallback === "function") {
@ -82,13 +82,13 @@ class ContextReplacementPlugin {
cmf.hooks.afterResolve.tap("ContextReplacementPlugin", result => {
if (!result) return;
if (resourceRegExp.test(result.resource)) {
if (typeof newContentResource !== "undefined") {
if (newContentResource !== undefined) {
result.resource = path.resolve(result.resource, newContentResource);
}
if (typeof newContentRecursive !== "undefined") {
if (newContentRecursive !== undefined) {
result.recursive = newContentRecursive;
}
if (typeof newContentRegExp !== "undefined") {
if (newContentRegExp !== undefined) {
result.regExp = newContentRegExp;
}
if (typeof newContentCreateContextMap === "function") {