Code coverage report for nodash/lib/coll/zipWith.js

Statements: 100% (18 / 18)      Branches: 100% (0 / 0)      Functions: 100% (4 / 4)      Lines: 100% (18 / 18)      Ignored: none     

All files » nodash/lib/coll/ » zipWith.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39      1   5   5     6 6 6 19   6       4 4 4 12   4       15 15 15 45   15          
/* vim: set et sw=2 ts=2: */
'use strict';
 
module.exports = function () {
 
  var Nodash = this;
 
  return {
 
    zipWith: function (f, as, bs) {
      var length = Math.min(as.length, bs.length);
      var zs = [];
      for (var i = 0; i < length; i++) {
        zs[i] = f(as[i], bs[i]);
      }
      return zs;
    },
 
    zipWith3: function (f, as, bs, cs) {
      var length = Nodash.minimum([as.length, bs.length, cs.length]);
      var zs = [];
      for (var i = 0; i < length; i++) {
        zs[i] = f(as[i], bs[i], cs[i]);
      }
      return zs;
    },
 
    zipWith4: function (f, as, bs, cs, ds) {
      var length = Nodash.minimum([as.length, bs.length, cs.length, ds.length]);
      var zs = [];
      for (var i = 0; i < length; i++) {
        zs[i] = f(as[i], bs[i], cs[i], ds[i]);
      }
      return zs;
    }
    
  };
};