filter duplicate field by condition
@param callable|string|null $distinct
@return \PerrysLambda\ArrayBase
969208
public function distinct($distinct=null)
    {
        $distinct = LambdaUtils::toSelectCallable($distinct);

        $keys = array();
        $collection = $this->newInstance();
        foreach($this as $record)
        {
            $value = call_user_func($distinct, $record);
            $hash = md5(json_encode($value));
            if(!isset($keys[$hash]))
            {
                $keys[$hash]=true;
                $collection->add($record);
            }
        }
        return $collection;
    }
1360733
public function fields($fields, $merge = false) {
        if (!is_array($fields)) {
            $fields = func_get_args();
            $merge = false;
        }

        if ($merge) {
            $fields = array_merge($this->_fields, $fields);
        }

        // When doing a select, unique the field list
        if ($this->getType() === self::SELECT) {
            $fields = array_values(array_unique($fields, SORT_REGULAR)); // SORT_REGULAR allows for objects
        }

        $this->_fields = $fields;

        return $this;
    }
66647
public function unique($criteria = null, array $values = array())
    {
        if (!$this->_properties['primary_key'] || (!$values && !$criteria))
            throw new Exception(sprintf(self::E_PrimaryKey, get_called_class()), 1);

        $that = clone $this;
        $values ? $that->find($criteria, $values) : $that->findByPK($criteria);

        return ($that->dry() || $this->pkCompare($that->pkValue()));
    }
1210404
public function duplicates($callback = null, $strict = false)
    {
        $items = $this->map($this->valueRetriever($callback));

        $uniqueItems = $items->unique(null, $strict);

        $compare = $this->duplicateComparator($strict);

        $duplicates = new static;

        foreach ($items as $key => $value) {
            if ($uniqueItems->isNotEmpty() && $compare($value, $uniqueItems->first())) {
                $uniqueItems->shift();
            } else {
                $duplicates[$key] = $value;
            }
        }

        return $duplicates;
    }
987394
public function distinct($options, $field)
    {
        $cmd = [
            'distinct' => $options['table'],
            'key' => $field,
        ];

        if (!empty($options['where'])) {
            $cmd['query'] = $this->parseWhere($options['where']);
        }

        if (isset($options['maxTimeMS'])) {
            $cmd['maxTimeMS'] = $options['maxTimeMS'];
        }
        $command = new Command($cmd);
        $this->log('cmd', 'distinct', $cmd);
        return $command;
    }
533592
public function selectDistinct($fields)
    {
        if ($this->overwriteEnabled === true) {
            $this->statements['distincts'] = $fields;
        } else {
            $this->addStatement('distincts', $fields);
        }

        return $this;
    }
406092
public function countFeatureTypeAvMetas(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
    {
        $partial = $this->collFeatureTypeAvMetasPartial && !$this->isNew();
        if (null === $this->collFeatureTypeAvMetas || null !== $criteria || $partial) {
            if ($this->isNew() && null === $this->collFeatureTypeAvMetas) {
                return 0;
            }

            if ($partial && !$criteria) {
                return count($this->getFeatureTypeAvMetas());
            }

            $query = ChildFeatureTypeAvMetaQuery::create(null, $criteria);
            if ($distinct) {
                $query->distinct();
            }

            return $query
                ->filterByFeatureFeatureType($this)
                ->count($con);
        }

        return count($this->collFeatureTypeAvMetas);
    }
1203458
public function select($target = null, $distinct = false)
    {
        $this->queryBuilder->select($target, $distinct);
        return $this;
    }
916280
public final function FetchByField($distinct, $field, $value, Sql\OrderList $orderBy = null, Sql\GroupList $groupBy = null, $offset = 0, $count = null)
    {
        $where = $this->FieldCondition($field, $value);        
        return $this->Fetch($distinct, $where, $orderBy, $groupBy, $offset, $count);
    }
943315
public function distinct($column = null)
    {
        if ($column) {
            $column = ['index' => $column];
        }

        $this->query = $this->query->distinct($column);

        return $this;
    }
1052838
function distinct(array){
  return Object.keys(array.reduce(function(current, value){
    current[value] = true;
    return current;
  }, {}));
}
1142125
public function countKstruktursRelatedBySkillId(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
    {
        $partial = $this->collKstruktursRelatedBySkillIdPartial && !$this->isNew();
        if (null === $this->collKstruktursRelatedBySkillId || null !== $criteria || $partial) {
            if ($this->isNew() && null === $this->collKstruktursRelatedBySkillId) {
                return 0;
            }

            if ($partial && !$criteria) {
                return count($this->getKstruktursRelatedBySkillId());
            }

            $query = ChildKstrukturQuery::create(null, $criteria);
            if ($distinct) {
                $query->distinct();
            }

            return $query
                ->filterBySkillRelatedBySkillId($this)
                ->count($con);
        }

        return count($this->collKstruktursRelatedBySkillId);
    }
1301831
public function countRecords(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
    {
        $partial = $this->collRecordsPartial && !$this->isNew();
        if (null === $this->collRecords || null !== $criteria || $partial) {
            if ($this->isNew() && null === $this->collRecords) {
                return 0;
            }

            if ($partial && !$criteria) {
                return count($this->getRecords());
            }

            $query = RecordQuery::create(null, $criteria);
            if ($distinct) {
                $query->distinct();
            }

            return $query
                ->filterByPlayer($this)
                ->count($con);
        }

        return count($this->collRecords);
    }
88019
public function countFeaturedSkills(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
    {
        $partial = $this->collFeaturedSkillsPartial && !$this->isNew();
        if (null === $this->collFeaturedSkills || null !== $criteria || $partial) {
            if ($this->isNew() && null === $this->collFeaturedSkills) {
                return 0;
            }

            if ($partial && !$criteria) {
                return count($this->getFeaturedSkills());
            }

            $query = ChildSkillQuery::create(null, $criteria);
            if ($distinct) {
                $query->distinct();
            }

            return $query
                ->filterByFeaturedPicture($this)
                ->count($con);
        }

        return count($this->collFeaturedSkills);
    }
189540
function distinct() {
        
        //Data for output
        var outData = [];

        //For each element on current instance
        for (var i = 0; i < this.items.length; i++) {

            //Flag for element found
            var wasFound = false;

            //Check if element is already on outData
            for (var n = 0; n < outData.length; n++) {

                //If current element on "i" matches the one on "n"
				if (equals(outData[n], this.items[i])){
                    wasFound = true;
                    break;
                }
            }

            //If element was not found, append to output
            if (!wasFound)
                outData.push(this.items[i]);
        }

        //Return for chaining
        return new jslinq(outData);
    }
682248
public function select($type = null, $distinct = false)
    {
        $type = $this->createSelectData($type);

        if ($distinct === true) {
            $this->append('SELECT DISTINCT ' . $type);
        } else {
            $this->append('SELECT ' . $type);
        }

        // Save selected data (to be used when guessing count query)
        $this->selected = $type;
        return $this;
    }
1280148
function Select($distinct, SelectList $selectList, Source $source, Condition $condition = null, OrderList $orderList = null, GroupList $groupList = null, $offset = 0, $count = 0)
    {
        return parent::CreateSelect($distinct, $selectList, $source, $condition, $orderList, $groupList, $offset, $count); 
    }