@function collectionResult

return collection result

@param {array} results

@returns {Promise}
977467
function collectionResult (results) {
    // get context by executing any pre methods on collection views
    return this.collectionResultPre()
    // apply views to each record
    .then(context => {
        // if there are no results then do nothing
        if (!Array.isArray(results) || !results.length) {
            return context
        }
        // check if full records were loaded
        return this.query.limit === 1 || this.query.all
            // apply views to results directly
            ? this.collectionResultList(context, results)
            // create result object to iterate over results
            : this.collectionResultIterator(context, results)
    })
    // apply any post methods to context and return result
    .then(context => {
        return this.collectionResultPost(context)
    })
}
738203
function getCollection(key, collectionName, database, options, callback) {
    getDatabaseCached(database, options, getOrCreateCollection)

    function getOrCreateCollection(err, db) {
        if (err) {
            return callback(err)
        }

        // get the collection
        db.collection(collectionName, extend({
            safe: true
        }, options.collectionOptions), createIfNotExist)

        function createIfNotExist(err, collection) {
            // if not exist create it
            if (err && err.message.indexOf(" does not exist") !== -1) {
                return db.createCollection(collectionName, extend({
                    safe: true
                }, options.createCollectionOptions), returnCollection)
            }

            if (err) {
                return callback(err)
            }

            callback(null, collection)
        }
    }

    function returnCollection(err, col) {
        if (err) {
            return callback(err)
        }

        callback(null, col)
    }
}
665115
function (filters, returnResult) {

		var image,
			newFilters;

		// Convert to array
		if (_.isString(filters)) {
			filters = [filters];
		} else if (!_.isArray(filters) && _.isObject(filters)) {
			filters = [filters];
		}

		// Format array as needed by the function
		newFilters = [];
		(filters || []).forEach(function (filter) {

			if (_.isString(filter)) {
				newFilters.push({key: filter, options: {}});

			} else if (_.isObject(filter)) {
				newFilters.push(filter);
			}
		});
		filters = newFilters;

		// Process filters
		image = this;
		(filters || []).forEach(function (filter) {

			var currentFilter = PNGImage.filters[filter.key];

			if (!currentFilter) {
				throw new Error('Unknown filter ' + filter.key);
			}

			filter.options = filter.options || {};
			filter.options.needsCopy = !!returnResult;

			image = currentFilter(this, filter.options);

		}.bind(this));

		// Overwrite current image, or just returning it
		if (!returnResult) {
			this._image = image.getImage();
		}

		return image;
	}
296873
function orderResults (results) {
    // get id column names
    var idColumn = this.model.defaultColumnsInverse.id
    // require id column for model
    if (!defined(idColumn)) {
        return results
    }
    // get id column name that was used for query
    var queryIdColumn = defined(this.args.where.id)
        ? 'id'
        : defined(this.args.where[idColumn])
            ? idColumn
            : undefined
    // if query was not on id column then do not reorder
    if (!defined(queryIdColumn)) {
        return results
    }
    // list of ids as querired
    var queryIds
    // if id property is array then get ids
    if (Array.isArray(this.args.where[queryIdColumn])) {
        queryIds = this.args.where[queryIdColumn]
    }
    // if id has an in query with array then get ids
    else if (typeof this.args.where[queryIdColumn] === 'object' && Array.isArray(this.args.where[queryIdColumn].in)) {
        queryIds = this.args.where[queryIdColumn].in
    }
    // if query is not by list of ids then do not reorder
    if (!defined(queryIds)) {
        return results
    }
    // group results by id - if current record was queried then must use
    // the id that column was selected by instead of record id
    var resultsById = _.keyBy(results, this.args.current ? idColumn+'Select' : idColumn)
    // ordered result set
    var orderedRes = []
    // iterate over queried ids and add to ordered result set
    _.each(queryIds, queryId => {
        if (defined(resultsById[queryId])) {
            orderedRes.push(resultsById[queryId])
        }
    })

    return orderedRes
}
138986
public void setResults(java.util.Collection<SearchRecord> results) {
        if (results == null) {
            this.results = null;
            return;
        }

        this.results = new java.util.ArrayList<SearchRecord>(results);
    }
211574
def process_result(result, model=None):
    
    if model is None:
        return result
    if isinstance(result, collections.Sequence):
        return [model(**item) for item in result]
    return model(**result)
482343
public function process($results)
    {
        // Normalize entries. Get entries returns false on failure.
        // We'll always want an array in this situation.
        $entries = $this->connection->getEntries($results) ?: [];

        if ($this->builder->isRaw()) {
            // If the builder is asking for a raw
            // LDAP result, we can return here.
            return $entries;
        }

        $models = [];

        if (Arr::has($entries, 'count')) {
            for ($i = 0; $i < $entries['count']; $i++) {
                // We'll go through each entry and construct a new
                // model instance with the raw LDAP attributes.
                $models[] = $this->newLdapEntry($entries[$i]);
            }
        }

        // If the query contains paginated results, we'll return them here.
        if ($this->builder->isPaginated()) {
            return $models;
        }

        // If the query is requested to be sorted, we'll perform
        // that here and return the resulting collection.
        if ($this->builder->isSorted()) {
            return $this->processSort($models);
        }

        // Otherwise, we'll return a regular unsorted collection.
        return $this->newCollection($models);
    }
180198
function() {
    var collection = [];
    for (let id of this.store._keys) {
      if (id.startsWith("unprocessed")) {
        collection.push(this.get(id));
      }
    }
    return Promise.resolve(collection);
  }
1316042
function updateCollected(err, result) {
            if (typeof result !== 'object') {
                collection.err = collection.err || new Error('Invalid acrhitect plugin format');
                return;
            }

            collection.err = collection.err || err;

            if (!collection.loaded) {
                collection.result = result;
                collection.loaded = true;
                return;
            }

            for (var i in result) {
                if (result.hasOwnProperty(i)) {
                    if (collection.result.hasOwnProperty(i)) {
                        collection.err = collection.err || new Error('Service overloading not supported: ' + i);
                        return;
                    }
                    collection.result[i] = result[i];
                }
            }
        }
566429
function sortResults(results) {
  var fileArray = {
    error: [],
    warning: [],
    clean: []
  };
  results.forEach(function (result) {
    if (result.errorCount > 0) {
      fileArray.error.push(result);
    } else if (result.warningCount > 0) {
      fileArray.warning.push(result);
    } else {
      fileArray.clean.push(result);
    }
  });
  return lodash.concat(fileArray.error, fileArray.warning, fileArray.clean);
}
603431
public function collect($result = null)
    {
        $result = $result ? $result : $this->getResult();

        if ($result->rowCount() > 0) {
            $collection = new Collection();
            foreach ($result->fetchAll(\PDO::FETCH_ASSOC) as $row) {
                $collection->add($row);
            }

            return $collection;
        }

        return null;
    }
1139321
public function getFailedResults(): ResultCollection
    {
        $failedResults = array_filter($this->results, function (Result $result) {
            return $result->isFailed();
        });

        return new self(...$failedResults);
    }
853074
function (ordered) {
    var self = this;
    if (ordered) {
      return self.fetch();
    } else {
      var results = new LocalCollection._IdMap;
      self.forEach(function (doc) {
        results.set(doc._id, doc);
      });
      return results;
    }
  }
717414
private function processResults($results)
    {
        $entries = $this->connection->getEntries($results);

        $objects = [];

        if (array_key_exists('count', $entries)) {
            for ($i = 0; $i < $entries['count']; $i++) {
                $entry = $this->newLdapEntry($entries[$i], $this->connection);

                $objects[] = $entry->getAttributes();
            }

            if (!empty($this->sortByField)) {
                return $this->processSortBy($objects);
            }
        }

        return $objects;
    }
292708
function getScrapersResults (SCRAPERS, urls, htmls) {
  return Promise.all(
    SCRAPERS.map(SCRAPER => {
      return getScraperResults(SCRAPER, urls, htmls).then(results => {
        return {
          name: SCRAPER.name,
          results: results
        }
      })
    })
  )
}
1158693
function writeCollections(drizzleData) {
  return Promise.all(walkCollections(drizzleData.patterns, drizzleData)).then(
    writePromises => drizzleData,
    error => DrizzleError.error(error, drizzleData.options.debug)
  );
}
55344
public function createResultCollection($data = [], $method = 'create')
    {
        $collection = new ResultCollection();

        if (null === $data) {
            return $collection;
        }

        if (array_key_exists('page', $data)) {
            $collection->setPage($data['page']);
        }

        if (array_key_exists('total_pages', $data)) {
            $collection->setTotalPages($data['total_pages']);
        }

        if (array_key_exists('total_results', $data)) {
            $collection->setTotalResults($data['total_results']);
        }

        if (array_key_exists('results', $data)) {
            $data = $data['results'];
        }

        foreach ($data as $item) {
            $collection->add(null, $this->$method($item));
        }

        return $collection;
    }