/javascript/etl/etl.js

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
var transform = function(scores_to_letters) {
  // Transform mapping of scores to letters, to a mapping of letters to scores
  var letters_to_scores = {};
  var score, letter, i;
  for (score in scores_to_letters) {
    if (scores_to_letters.hasOwnProperty(score)) {
      letters = scores_to_letters[score];
      for (i=0; (letter=letters[i]); i++) {
        letters_to_scores[letter.toLowerCase()] = parseInt(score, 10);
      }
    }
  }

  return letters_to_scores;
};

module.exports = transform;

Comments


You're not logged in right now. Please login via GitHub to comment