Skip to content
This repository has been archived by the owner on Jan 4, 2019. It is now read-only.

Commit

Permalink
Reverse conditionals
Browse files Browse the repository at this point in the history
In order to avoid the usage of the negation on the conditionals wich
helps to:

- Makes simpler to understand the logic on that block of the code
- Easier to read
- Avoid usage of a negation
  • Loading branch information
mitogh committed Jun 19, 2016
1 parent 32d2375 commit 65a1c60
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions lib/vulcan.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,15 +96,15 @@ var Vulcan = function Vulcan(opts) {
this.inputUrl = String(opts.inputUrl) === opts.inputUrl ? opts.inputUrl : '';
this.fsResolver = opts.fsResolver;
this.redirects = Array.isArray(opts.redirects) ? opts.redirects : [];
if (!opts.loader) {
if (opts.loader) {
this.loader = opts.loader;
} else {
this.loader = buildLoader({
abspath: this.abspath,
fsResolver: this.fsResolver,
excludes: this.excludes,
redirects: this.redirects
});
} else {
this.loader = opts.loader;
}
};

Expand Down Expand Up @@ -209,13 +209,13 @@ Vulcan.prototype = {
this.fixFakeExternalScripts(doc);
this.pathResolver.acid(doc, tree.href);
var moveTarget;
if (!isMainDoc) {
moveTarget = dom5.constructors.fragment();
} else {
if (isMainDoc) {
// hide bodies of imports from rendering in main document
moveTarget = dom5.constructors.element('div');
dom5.setAttribute(moveTarget, 'hidden', '');
dom5.setAttribute(moveTarget, 'by-vulcanize', '');
} else {
moveTarget = dom5.constructors.fragment();
}
head.childNodes.filter(this.moveToBodyMatcher).forEach(function(n) {
this.removeElementAndNewline(n);
Expand Down

0 comments on commit 65a1c60

Please sign in to comment.