Browse files

adding regalitys magical ascii animals reverse. closes #1

  • Loading branch information...
1 parent 681a44d commit 44ec42ce0d4aa8dda3588ba2dacae6f79854ac28 @ivolo committed Sep 2, 2012
Showing with 5 additions and 9 deletions.
  1. +4 −9 lib/animals.js
  2. +1 −0 package.json
View
13 lib/animals.js
@@ -5,6 +5,7 @@ var path = require('path');
var _ = require('underscore');
var winston = require('winston');
+var reverse = require('ascii-art-reverse');
var animals = ['almost there!'];
var ANIMALS_PATH = path.join(__dirname, '../public/assets/animals.saved');
@@ -57,15 +58,9 @@ var offsetAnimal = function (animal, offset) {
};
var reverseAnimal = function (animal) {
-
- var lines = animal.replace(/\r/g, '').split('\n');
-
- lines = _.map(lines, function (line) {
- var str = line.split('').reverse().join('');
- return str;
- });
-
- return lines.join('\n');
+ // Thanks to github.com/regality
+ // https://github.com/regality/ascii-art-reverse
+ return reverse(animal);
};
exports.getAll = function () {
View
1 package.json
@@ -9,6 +9,7 @@
"winston": "*"
, "underscore": "*"
, "express": "3.X"
+ , "ascii-art-reverse": "*"
}
, "engines":{
"node": ">0.6.x"

0 comments on commit 44ec42c

Please sign in to comment.