function uniqueArray(src, key, sort) {
  var results = [];
  var values = [];
  var i = 0;

  while (i < src.length) {
    var val = key ? src[i][key] : src[i];
    if (inArray(values, val) < 0) {
      results.push(src[i]);
    }
    values[i] = val;
    i++;
  }

  if (sort) {
    if (!key) {
      results = results.sort();
    } else {
      results = results.sort(function (a, b) {
        return a[key] > b[key];
      });
    }
  }

  return results;
}
@private
unique array with objects based on a key (like 'id') or just by the array's value
@param {Array} src [{id:1},{id:2},{id:1}]
@param {String} [key]
@param {Boolean} [sort=False]
@returns {Array} [{id:1},{id:2}]