lib/utils.js
function hasDuplicates(arr, fn) {
  var obj = {};
  var i, l, elem;
  for (i = 0, l = arr.length; i < l; i++) {
    elem = arr[i];
    if (fn) {
      elem = fn(elem);
    }
    if (obj[elem]) {
      return true;
    }
    obj[elem] = true;
  }
  return false;
}
function hasDuplicates(arr, fn) {
  var obj = {};
  var i, l, elem;
  for (i = 0, l = arr.length; i < l; i++) {
    elem = arr[i];
    if (fn) {
      elem = fn(elem);
    }
    if (obj[elem]) {
      return true;
    }
    obj[elem] = true;
  }
  return false;
}
function hasDuplicates ( arr , fn ) { var obj = { } ; var i , l , elem ; for ( i = 0 , l = arr . length ; i < l ; i ++ ) { elem = arr [ i ] ; if ( fn ) { elem = fn ( elem ) ; } if ( obj [ elem ] ) { return true ; } obj [ elem ] = true ; } return false ; }
Check whether an array has duplicates.

@param arr {Array} The array.
@param fn {Function} Optional function to apply to each element.
Check whether an array has duplicates .