MCPcopy Index your code
hub / github.com/jashkenas/underscore / min

Function min

underscore.js:1527–1549  ·  view source on GitHub ↗
(obj, iteratee, context)

Source from the content-addressed store, hash-verified

1525
1526 // Return the minimum element (or element-based computation).
1527 function min(obj, iteratee, context) {
1528 var result = Infinity, lastComputed = Infinity,
1529 value, computed;
1530 if (iteratee == null || (typeof iteratee == 'number' && typeof obj[0] != 'object' && obj != null)) {
1531 obj = isArrayLike(obj) ? obj : values(obj);
1532 for (var i = 0, length = obj.length; i < length; i++) {
1533 value = obj[i];
1534 if (value != null && value < result) {
1535 result = value;
1536 }
1537 }
1538 } else {
1539 iteratee = cb(iteratee, context);
1540 each(obj, function(v, index, list) {
1541 computed = iteratee(v, index, list);
1542 if (computed < lastComputed || (computed === Infinity && result === Infinity)) {
1543 result = v;
1544 lastComputed = computed;
1545 }
1546 });
1547 }
1548 return result;
1549 }
1550
1551 // Safely create a real, live array from anything iterable.
1552 var reStrSymbol = /[^\ud800-\udfff]|[\ud800-\udbff][\udc00-\udfff]|[\ud800-\udfff]/g;

Callers

nothing calls this directly

Calls 4

valuesFunction · 0.70
cbFunction · 0.70
eachFunction · 0.70
iterateeFunction · 0.70

Tested by

no test coverage detected