Skip to content

Commit

Permalink
Handle replacing $eye variables when the eyes are not adjacent (#43)
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonkhanlar authored and piuccio committed Nov 5, 2018
1 parent 79b1aed commit df5cdf6
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/replacer.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
module.exports = function (cow, variables) {
var eyes = escapeRe(variables.eyes);
var eyeL = eyes.charAt(0);
var eyeR = eyes.charAt(1);
var tongue = escapeRe(variables.tongue);

if (cow.indexOf("$the_cow") !== -1) {
Expand All @@ -11,6 +13,8 @@ module.exports = function (cow, variables) {
.replace(/\$eyes/g, eyes)
.replace(/\$tongue/g, tongue)
.replace(/\$\{eyes\}/g, eyes)
.replace(/\$eye/, eyeL)
.replace(/\$eye/, eyeR)
.replace(/\$\{tongue\}/g, tongue)
;
};
Expand Down

0 comments on commit df5cdf6

Please sign in to comment.