rainbow.js (344B)
1 var colors = require('../colors'); 2 3 module['exports'] = (function () { 4 var rainbowColors = ['red', 'yellow', 'green', 'blue', 'magenta']; //RoY G BiV 5 return function (letter, i, exploded) { 6 if (letter === " ") { 7 return letter; 8 } else { 9 return colors[rainbowColors[i++ % rainbowColors.length]](letter); 10 } 11 }; 12 })(); 13