Function to check if array is unique (i.e. all unique elements, i.e. no duplicate elements)
353952
function isUnique(array) {
 var u = {}, a = [];
 var isUnique = 1;
 for(var i = 0, l = array.length; i < l; ++i){
    if(u.hasOwnProperty(array[i])) {
      isUnique = 0;
      break;
    }
    u[array[i]] = 1;
 }
 return isUnique;
}
507495
function _same_array(one, two){
	var retval = true;
	if( one.length != two.length ){
	    retval = false;
	}else{
	    for( var i = 0; i < one.length; i++ ){
		if( one[i] != two[i] ){
		    retval = false;
		    break;
		}
	    }
	}
	return retval;
    }
1015860
public static int[] unique(int[] x) {
        HashSet<Integer> hash = new HashSet<>();
        for (int i = 0; i < x.length; i++) {
            hash.add(x[i]);
        }

        int[] y = new int[hash.size()];

        Iterator<Integer> keys = hash.iterator();
        for (int i = 0; i < y.length; i++) {
            y[i] = keys.next();
        }

        return y;
    }
336435
def distinct():
    
    def validate(value):
        for i, item in enumerate(value):
            if item in value[i+1:]:
                return e("{} is not a distinct set of values", value)
    return validate
1172034
function checkForDuplicateIds( page ) {
      const idCount = {};
      forEachArea( page, items => {
         items.forEach( ({ id }) => {
            idCount[ id ] = idCount[ id ] ? idCount[ id ] + 1 : 1;
         } );
      } );

      const duplicates = Object.keys( idCount ).filter( id => idCount[ id ] > 1 );
      if( duplicates.length ) {
         throw formatError( page, `Duplicate widget/composition/layout ID(s): ${duplicates.join( ', ' )}` );
      }
   }
265424
function unique(oldArray) {
    var nIndex,
      nLen = oldArray.length,
      aArr = [];
    for (nIndex = 0; nIndex < nLen; nIndex++) {
      if (!contains(aArr, oldArray[nIndex][1])) {
        aArr.push(oldArray[nIndex]);
      }
    }
    return aArr;
  }
1144815
function makeUnique (boxes = []) {
  // boxes converted to string, for easier comparison
  const ref = [];
  const result = [];

  boxes.forEach((item) => {
    const item_string = item.toString();
    if (ref.indexOf(item_string) === -1) {
      ref.push(item_string);
      result.push(item);
    }
  });

  return result;
}
1259126
function unique(arr) {
  var ret = [];

  for (var i = 0; i < arr.length; i++) {
    if (~ret.indexOf(arr[i])) continue;
    ret.push(arr[i]);
  }

  return ret;
}
631581
function unique( arr, sort, uniqueFn ){
	var rtn = [];

	if ( arr.length ){
		if ( sort ){
			// more efficient because I can presort
			if ( bmoor.isFunction(sort) ){
				arr = arr.slice(0).sort(sort);
			}

			let last;
			
			for( let i = 0, c = arr.length; i < c; i++ ){
				let d = arr[i],
					v = uniqueFn ? uniqueFn(d) : d;

				if ( v !== last ){
					last = v;
					rtn.push( d );
				}
			}
		}else if ( uniqueFn ){
			let hash = {};

			for( let i = 0, c = arr.length; i < c; i++ ){
				let d = arr[i],
					v = uniqueFn(d);

				if ( !hash[v] ){
					hash[v] = true;
					rtn.push( d );
				}
			}
		}else{
			// greedy and inefficient
			for( let i = 0, c = arr.length; i < c; i++ ){
			 	let d = arr[i];

			 	if ( rtn.indexOf(d) === -1 ){
			 		rtn.push( d );
			 	}
			}
		}
	}

	return rtn;
}
367882
def _check_for_duplicates(xs, attr, check_fn=None):
    
    dups = []
    for key, vals in itertools.groupby(x[attr] for x in xs):
        if len(list(vals)) > 1:
            dups.append(key)
    if len(dups) > 0:
        psamples = []
        for x in xs:
            if x[attr] in dups:
                psamples.append(x)
        # option to skip problem based on custom input function.
        if check_fn and check_fn(psamples):
            return
        descrs = [x["description"] for x in psamples]
        raise ValueError("Duplicate '%s' found in input sample configuration.\n"
                         "Required to be unique for a project: %s\n"
                         "Problem found in these samples: %s" % (attr, dups, descrs))
370891
def unique_array(arr):
    
    if not len(arr):
        return np.asarray(arr)
    elif pd:
        if isinstance(arr, np.ndarray) and arr.dtype.kind not in 'MO':
            # Avoid expensive unpacking if not potentially datetime
            return pd.unique(arr)

        values = []
        for v in arr:
            if (isinstance(v, datetime_types) and
                not isinstance(v, cftime_types)):
                v = pd.Timestamp(v).to_datetime64()
            values.append(v)
        return pd.unique(values)
    else:
        arr = np.asarray(arr)
        _, uniq_inds = np.unique(arr, return_index=True)
        return arr[np.sort(uniq_inds)]
195324
public static function unique($array)
    {
        $unique = array();
        foreach ($array as $item) {
            if (!in_array($item, $unique, true)) {
                $unique[] = $item;
            }
        }

        return $unique;
    }
1218106
def unique(self, values):
        """"""
        _, count = self.count()
        if not np.array_equiv(count, 1):
            raise ValueError("Not every entry in the table is assigned a unique value")
        return self.sum(values)
803429
function unique (elements) {
  for (var i = 0; i < elements.length - 1; i++) {
    for (var j = i + 1; j < elements.length; j++) {
      if (elements[i] === elements[j]) return false
    }
  }

  return true
}
281880
function it_should_be_unique(){
        $ids = [];
        $iterations = 100;

        for($i=0; $i < $iterations; $i++){
            $ids[] = $this->getWrappedObject()->generate();
        }

        return (count(array_values($ids)) === $iterations);
    }
732468
def _check_array_parms(is_array, array_size, value, element_kind,
                       element_name):
    # pylint: disable=unused-argument
    # The array_size argument is unused.
    

    # The following case has been disabled because it cannot happen given
    # how this check function is used:
    # if array_size and is_array is False:
    #     raise ValueError(
    #         _format("The array_size parameter of {0} {1!A} is {2!A} but the "
    #                 "is_array parameter is False.",
    #                 element_kind, element_name, array_size))

    if value is not None:
        value_is_array = isinstance(value, (list, tuple))
        if not is_array and value_is_array:
            raise ValueError(
                _format("The is_array parameter of {0} {1!A} is False but "
                        "value {2!A} is an array.",
                        element_kind, element_name, value))
        if is_array and not value_is_array:
            raise ValueError(
                _format("The is_array parameter of {0} {1!A} is True but "
                        "value {2!A} is not an array.",
                        element_kind, element_name, value))
868597
function unique(ar) {
  var a = []
    , i = -1
    , j
    , has;
  while (++i < ar.length) {
    j = -1;
    has = false;
    while (++j < a.length) {
      if (a[j] === ar[i]) {
        has = true;
        break;
      }
    }
    if (!has) { a.push(ar[i]); }
  }
  return a;
}