How to use the max function from underscore

Find comprehensive JavaScript underscore.max code examples handpicked from public code repositorys.

2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
};

// Zip together multiple lists into a single array -- elements that share
// an index go together.
_.zip = function() {
  var length = _.max(_.pluck(arguments, "length").concat(0));
  var results = new Array(length);
  for (var i = 0; i < length; i++) {
    results[i] = _.pluck(arguments, '' + i);
  }
fork icon0
star icon2
watch icon0

850
851
852
853
854
855
856
857
858
859

// Zip together multiple lists into a single array -- elements that share
// an index go together.
_.zip = function() {
  var args = slice.call(arguments);
  var length = _.max(_.pluck(args, 'length'));
  var results = new Array(length);
  for (var i = 0; i < length; i++) results[i] = _.pluck(args, "" + i);
  return results;
};
fork icon0
star icon0
watch icon1

+ 6 other calls in file

139
140
141
142
143
144
145
146
147
148
        (op.d != null ? op.d.length : undefined)
    )
  }
  return result
})()
const size = _.max(opSizes)
if (size > REJECT_LARGE_OP_SIZE) {
  error = new Error(
    `dropped op exceeding maximum allowed size of ${REJECT_LARGE_OP_SIZE}`
  )
fork icon0
star icon0
watch icon202

+ 5 other calls in file

54
55
56
57
58
59
60
61
62
63
        m = line.length;
    });
    maxInFile.push(m);
  });

  return _.max(maxInFile);
},

// Figure out which vars need to be specifically put in the module
// scope.
fork icon0
star icon0
watch icon2

+ 11 other calls in file

206
207
208
209
210
211
212
213
214
215
var leastSpecificDescription = function (programs) {
  if (programs.length === 0)
    return '';

  // Find the longest string
  var longest = _.max(programs, function (p) { return p.length; });

  // If everything else in the list is compatible with the longest,
  // then it must be the most specific, and if everything is
  // compatible with the most specific then it must be the least
fork icon0
star icon0
watch icon2