Comparing version 1.1.1 to 1.1.2
module.exports = function (cow, variables) { | ||
var eyes = escapeRe(variables.eyes); | ||
var tongue = escapeRe(variables.tongue); | ||
if (cow.indexOf("$the_cow") !== -1) { | ||
@@ -8,7 +11,23 @@ cow = extractTheCow(cow); | ||
.replace(/\$thoughts/g, variables.thoughts) | ||
.replace(/\$eyes/g, variables.eyes) | ||
.replace(/\$tongue/g, variables.tongue) | ||
.replace(/\$\{eyes\}/g, variables.eyes) | ||
.replace(/\$\{tongue\}/g, variables.tongue) | ||
.replace(/\$eyes/g, eyes) | ||
.replace(/\$tongue/g, tongue) | ||
.replace(/\$\{eyes\}/g, eyes) | ||
.replace(/\$\{tongue\}/g, tongue) | ||
; | ||
}; | ||
/* | ||
* "$" dollar signs must be doubled before being used in a regex replace | ||
* This can occur in eyes or tongue. | ||
* For example: | ||
* | ||
* cowsay -g Moo! | ||
* | ||
* cowsay -e "\$\$" Moo! | ||
*/ | ||
function escapeRe (s) { | ||
if (s && s.replace) { | ||
return s.replace(/\$/g, "$$$$"); | ||
} | ||
return s; | ||
} | ||
@@ -15,0 +34,0 @@ |
{ | ||
"name": "cowsay", | ||
"version": "1.1.1", | ||
"version": "1.1.2", | ||
"description": "cowsay is a configurable talking cow", | ||
@@ -32,9 +32,8 @@ "keywords": [ | ||
"dependencies": { | ||
"get-stdin": "^4.0.1", | ||
"optimist": "~0.3.5" | ||
"optimist": "~0.6.1" | ||
}, | ||
"devDependencies": { | ||
"nodeunit": "~0.7.4" | ||
"nodeunit": "~0.9.1" | ||
}, | ||
"preferGlobal": true | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
34996
1
62
408
+ Addedminimist@0.0.10(transitive)
+ Addedoptimist@0.6.1(transitive)
- Removedget-stdin@^4.0.1
- Removedget-stdin@4.0.1(transitive)
- Removedoptimist@0.3.7(transitive)
Updatedoptimist@~0.6.1