all files / scour/utilities/ collections.js

100% Statements 5/5
100% Branches 0/0
100% Functions 2/2
100% Lines 4/4
1 2 3 4 5 6 7 8 9 10 11 12 13 14                   
/*
 * Collection helpers.
 *
 * For each of these functions, call it in the context of an object that responds to `forEach`.
 */
 
module.exports = {
  map (fn) {
    const result = []
    this.forEach(function () { result.push(fn.apply(this, arguments)) })
    return result
  }
}