Skip to content

Commit

Permalink
Make "prepend" behaviour add the template at byte zero instead of bef…
Browse files Browse the repository at this point in the history
…ore the node
  • Loading branch information
IvanSanchez committed Mar 21, 2018
1 parent 9c3b7bb commit 1583270
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 1583270

Please sign in to comment.