Skip to content

Commit

Permalink
Merge pull request #7 from IvanSanchez/master
Browse files Browse the repository at this point in the history
Make "prepend" behaviour add the template at byte zero instead of before the node
  • Loading branch information
nickdeis authored Mar 21, 2018
2 parents 9c3b7bb + 1583270 commit a3db51d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ module.exports = {
//If there is no template, then there can be no fix.
if (!resolvedTemplate) {
fix = undefined;
//If it has no header comment or onNonMatchingHeader is set to prepend, prepend to the topNode
//If it has no header comment or onNonMatchingHeader is set to prepend, insert at byte 0
} else if (!hasHeaderComment || (hasHeaderComment && onNonMatchingHeader === "prepend")) {
fix = fixer => fixer.insertTextBefore(topNode, resolvedTemplate);
fix = fixer => fixer.insertTextBeforeRange([0, 0], resolvedTemplate);
//replace header comment
} else if (hasHeaderComment && onNonMatchingHeader === "replace") {
fix = fixer => fixer.replaceText(topNode, resolvedTemplate);
Expand Down

0 comments on commit a3db51d

Please sign in to comment.