lib/vendor/sugar.js
function getMinOrMax(obj, map, which, all) {
    var edge,
        result = [],
        max = which === 'max',
        min = which === 'min',
        isArray = Array.isArray(obj);
    iterateOverObject(obj, function(key) {
      var el   = obj[key],
          test = transformArgument(el, map, obj, isArray ? [el, parseInt(key), obj] : []);
      if(isUndefined(test)) {
        throw new TypeError('Cannot compare with undefined');
      }
      if(test === edge) {
        result.push(el);
      } else if(isUndefined(edge) || (max && test > edge) || (min && test < edge)) {
        result = [el];
        edge = test;
      }
    });
    if(!isArray) result = arrayFlatten(result, 1);
    return all ? result : result[0];
  }
function getMinOrMax(obj, map, which, all) {
    var edge,
        result = [],
        max = which === 'max',
        min = which === 'min',
        isArray = Array.isArray(obj);
    iterateOverObject(obj, function(key) {
      var el   = obj[key],
          test = transformArgument(el, map, obj, isArray ? [el, parseInt(key), obj] : []);
      if(isUndefined(test)) {
        throw new TypeError('Cannot compare with undefined');
      }
      if(test === edge) {
        result.push(el);
      } else if(isUndefined(edge) || (max && test > edge) || (min && test < edge)) {
        result = [el];
        edge = test;
      }
    });
    if(!isArray) result = arrayFlatten(result, 1);
    return all ? result : result[0];
  }
Support methods