Welcome to mirror list, hosted at ThFree Co, Russian Federation.

rainbow.js « maps « lib « colors « @colors « node_modules - github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 2b00ac0ac998e68958f9d7fdde0b7b4a3335a9c1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
module['exports'] = function(colors) {
  // RoY G BiV
  var rainbowColors = ['red', 'yellow', 'green', 'blue', 'magenta'];
  return function(letter, i, exploded) {
    if (letter === ' ') {
      return letter;
    } else {
      return colors[rainbowColors[i++ % rainbowColors.length]](letter);
    }
  };
};