code: function sortBy(array, attr) {
    assert(Array.isArray(array));
    return array.sort(function(a,b) {
      a = a[attr];
      b = b[attr];
      return (a < b) ? -1 : ((a > b) ? 1 : 0);
    });
  }
docs: /*
  Sort array by value of specified attribute
  @param array {array} - array to sort
  @param attr {attr} - attribute to sort by
  @returns {array} - sorted array