jsdoc-oblivion
Version:
A gray and blue theme for JSDoc.
3,802 lines (1,155 loc) • 53.2 kB
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=yes, width=device-width">
<title>Oblivion — Module: ink/collector</title>
<link rel="shortcut icon" href="/favicon.ico">
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/sunlight.dark.css">
<link type="text/css" rel="stylesheet" href="styles/site.oblivion.css">
</head>
<body>
<div class="container-fluid">
<div class="navbar navbar-fixed-top navbar-inverse">
<div class="navbar-inner">
<a class="brand" href="index.html">Oblivion</a>
<ul class="nav">
<li class="dropdown">
<a href="modules.list.html" class="dropdown-toggle" data-toggle="dropdown">Modules<b
class="caret"></b></a>
<ul class="dropdown-menu ">
<li>
<a href="module-base.html">base</a>
</li>
<li>
<a href="chains_.html">base/chains</a>
</li>
<li>
<a href="binder.html">documents/binder</a>
</li>
<li>
<a href="model_.html">documents/model</a>
</li>
<li>
<a href="probe.html">documents/probe</a>
</li>
<li>
<a href="schema_.html">documents/schema</a>
</li>
<li>
<a href="collector.html">ink/collector</a>
</li>
<li>
<a href="bussable_.html">mixins/bussable</a>
</li>
<li>
<a href="signalable_.html">mixins/signalable</a>
</li>
<li>
<a href="format.html">strings/format</a>
</li>
<li>
<a href="logger.html">utils/logger</a>
</li>
</ul>
</li>
<li class="dropdown">
<a href="classes.list.html" class="dropdown-toggle" data-toggle="dropdown">Classes<b
class="caret"></b></a>
<ul class="dropdown-menu ">
<li>
<a href="base.html">base</a>
</li>
<li>
<a href="chains.html">base/chains</a>
</li>
<li>
<a href="model.html">documents/model</a>
</li>
<li>
<a href="probe.queryOperators.html">documents/probe.queryOperators</a>
</li>
<li>
<a href="probe.updateOperators.html">documents/probe.updateOperators</a>
</li>
<li>
<a href="collector-ACollector.html">ink/collector~ACollector</a>
</li>
<li>
<a href="collector-CollectorBase_.html">ink/collector~CollectorBase</a>
</li>
<li>
<a href="collector-OCollector.html">ink/collector~OCollector</a>
</li>
<li>
<a href="signalable-Signal.html">mixins/signalable~Signal</a>
</li>
<li>
<a href="logger.Logger.html">utils/logger.Logger</a>
</li>
</ul>
</li>
<li class="dropdown">
<a href="mixins.list.html" class="dropdown-toggle" data-toggle="dropdown">Mixins<b
class="caret"></b></a>
<ul class="dropdown-menu ">
<li>
<a href="schema.html">documents/schema</a>
</li>
<li>
<a href="bussable.html">mixins/bussable</a>
</li>
<li>
<a href="signalable.html">mixins/signalable</a>
</li>
</ul>
</li>
</ul>
</div>
</div>
<div class="row-fluid">
<div class="span3">
<div id="toc"></div>
</div>
<div class="span9">
<div id="main">
<h1 class="page-title">Module: ink/collector</h1>
<section>
<header>
<h2>
ink/collector
</h2>
</header>
<article>
<div class="container-overview">
<div class="description">An object and array collector</div>
<dl class="details">
</dl>
</div>
<h3 class="subsection-title">Classes</h3>
<dl>
<dt><a href="collector-ACollector.html">ACollector</a></dt>
<dd></dd>
<dt><a href="collector-CollectorBase_.html">CollectorBase</a></dt>
<dd></dd>
<dt><a href="collector-OCollector.html">OCollector</a></dt>
<dd></dd>
</dl>
<h3 class="subsection-title">Members</h3>
<dl>
<dt class="name" id="difference">
<h4><span class="type-signature"></span>difference<span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
Creates an array of array elements not present in the other arrays using strict equality for comparisons, i.e. ===.
</div>
<dl class="details">
</dl>
</dd>
<dt class="name" id="head">
<h4><span class="type-signature"></span>head<span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
Gets the first n values of the array
</div>
<dl class="details">
</dl>
</dd>
<dt class="name" id="heap">
<h4><span class="type-signature"></span>heap<span class="type-signature"> :object|array</span></h4>
</dt>
<dd>
<div class="description">
The collection that being managed
</div>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">object</span>
|
<span class="param-type">array</span>
</li>
</ul>
<dl class="details">
</dl>
</dd>
<dt class="name" id="tail">
<h4><span class="type-signature"></span>tail<span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
This method gets all but the first values of array
</div>
<dl class="details">
</dl>
</dd>
</dl>
<h3 class="subsection-title">Methods</h3>
<dl>
<dt>
<h4 class="name" id="collect"><span class="type-signature"><static> </span>collect<span class="signature">(obj)</span><span class="type-signature"> → {ACollector|OCollector}</span></h4>
</dt>
<dd>
<div class="description">
Collect an object
</div>
<h5>Parameters:</h5>
<div class="params-table-container">
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>obj</code></td>
<td class="type">
<span class="param-type">array</span>
|
<span class="param-type">object</span>
</td>
<td class="description last">What to collect</td>
</tr>
</tbody>
</table>
</div>
<dl class="details">
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">ACollector</span>
|
<span class="param-type">OCollector</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="add"><span class="type-signature"><inner> </span>add<span class="signature">(key, item)</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
Adds an item to the collection
</div>
<h5>Parameters:</h5>
<div class="params-table-container">
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>key</code></td>
<td class="type">
<span class="param-type">*</span>
</td>
<td class="description last">The key to use for the item being added.</td>
</tr>
<tr>
<td class="name"><code>item</code></td>
<td class="type">
<span class="param-type">*</span>
</td>
<td class="description last">The item to add to the collection. The item is not iterated so that you could add bundled items to the collection</td>
</tr>
</tbody>
</table>
</div>
<dl class="details">
</dl>
</dd>
<dt>
<h4 class="name" id="add"><span class="type-signature"><inner> </span>add<span class="signature">(item)</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
Adds to the top of the collection
</div>
<h5>Parameters:</h5>
<div class="params-table-container">
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>item</code></td>
<td class="type">
<span class="param-type">*</span>
</td>
<td class="description last">The item to add to the collection. Only one item at a time can be added</td>
</tr>
</tbody>
</table>
</div>
<dl class="details">
</dl>
</dd>
<dt>
<h4 class="name" id="append"><span class="type-signature"><inner> </span>append<span class="signature">(item)</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
Add to the bottom of the list
</div>
<h5>Parameters:</h5>
<div class="params-table-container">
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>item</code></td>
<td class="type">
<span class="param-type">*</span>
</td>
<td class="description last">The item to add to the collection. Only one item at a time can be added</td>
</tr>
</tbody>
</table>
</div>
<dl class="details">
</dl>
</dd>
<dt>
<h4 class="name" id="at"><span class="type-signature"><inner> </span>at<span class="signature">(args)</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
Creates an array of elements from the specified indexes, or keys, of the collection. Indexes may be specified as
individual arguments or as arrays of indexes
</div>
<h5>Parameters:</h5>
<div class="params-table-container">
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>args</code></td>
<td class="type">
<span class="param-type">indexes</span>
</td>
<td class="description last">The indexes to use</td>
</tr>
</tbody>
</table>
</div>
<dl class="details">
</dl>
</dd>
<dt>
<h4 class="name" id="compact"><span class="type-signature"><inner> </span>compact<span class="signature">()</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
Modifies the collection with all falsey values of array removed. The values false, null, 0, "", undefined and NaN are all falsey.
</div>
<dl class="details">
</dl>
</dd>
<dt>
<h4 class="name" id="countBy"><span class="type-signature"><inner> </span>countBy<span class="signature">(<span class="optional">query</span>, iterator, <span class="optional">thisobj</span>)</span><span class="type-signature"> → {object}</span></h4>
</dt>
<dd>
<div class="description">
Creates an object composed of keys returned from running each element
of the collection through the given callback. The corresponding value of each key
is the number of times the key was returned by the callback.
</div>
<h5>Parameters:</h5>
<div class="params-table-container">
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Argument</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>query</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="description last">A query to evaluate. If you pass in a query, only the items that match the query
are iterated over.</td>
</tr>
<tr>
<td class="name"><code>iterator</code></td>
<td class="type">
<span class="param-type">function</span>
</td>
<td class="attributes">
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>thisobj</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="description last">The value of `this`</td>
</tr>
</tbody>
</table>
</div>
<dl class="details">
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">object</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="destroy"><span class="type-signature"><inner> </span>destroy<span class="signature">()</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
Destructor called when the object is destroyed.
</div>
<dl class="details">
</dl>
</dd>
<dt>
<h4 class="name" id="each"><span class="type-signature"><inner> </span>each<span class="signature">(<span class="optional">query</span>, iterator, <span class="optional">thisobj</span>)</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
Iterate over each item in the collection, or a subset that matches a query. This supports two signatures:
`.each(query, function)` and `.each(function)`. If you pass in a query, only the items that match the query
are iterated over.
</div>
<h5>Parameters:</h5>
<div class="params-table-container">
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Argument</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>query</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="description last">A query to evaluate</td>
</tr>
<tr>
<td class="name"><code>iterator</code></td>
<td class="type">
<span class="param-type">function</span>
</td>
<td class="attributes">
</td>
<td class="description last">Function to execute against each item in the collection</td>
</tr>
<tr>
<td class="name"><code>thisobj</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="description last">The value of `this`</td>
</tr>
</tbody>
</table>
</div>
<dl class="details">
</dl>
</dd>
<dt>
<h4 class="name" id="flatten"><span class="type-signature"><inner> </span>flatten<span class="signature">(<span class="optional">query</span>, iterator,, <span class="optional">thisobj</span>)</span><span class="type-signature"> → {number}</span></h4>
</dt>
<dd>
<div class="description">
Flattens a nested array (the nesting can be to any depth). If isShallow is truthy, array will only be flattened a single level.
If callback is passed, each element of array is passed through a callback before flattening.
</div>
<h5>Parameters:</h5>
<div class="params-table-container">
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Argument</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>query</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="description last">A query to evaluate . If you pass in a query, only the items that match the query
are iterated over.</td>
</tr>
<tr>
<td class="name"><code>iterator,</code></td>
<td class="type">
<span class="param-type">function</span>
</td>
<td class="attributes">
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>thisobj</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="description last">The value of `this`</td>
</tr>
</tbody>
</table>
</div>
<dl class="details">
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">number</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="groupBy"><span class="type-signature"><inner> </span>groupBy<span class="signature">(<span class="optional">query</span>, iterator, <span class="optional">thisobj</span>)</span><span class="type-signature"> → {object}</span></h4>
</dt>
<dd>
<div class="description">
Creates an object composed of keys returned from running each element of the collection through the callback.
The corresponding value of each key is an array of elements passed to callback that returned the key.
The callback is invoked with three arguments: (value, index|key, collection).
</div>
<h5>Parameters:</h5>
<div class="params-table-container">
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Argument</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>query</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="description last">A query to evaluate . If you pass in a query, only the items that match the query
are iterated over.</td>
</tr>
<tr>
<td class="name"><code>iterator</code></td>
<td class="type">
<span class="param-type">function</span>
</td>
<td class="attributes">
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>thisobj</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="description last">The value of `this`</td>
</tr>
</tbody>
</table>
</div>
<dl class="details">
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">object</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="index"><span class="type-signature"><inner> </span>index<span class="signature">(key)</span><span class="type-signature"> → {*}</span></h4>
</dt>
<dd>
<div class="description">
Gets an items by its index
</div>
<h5>Parameters:</h5>
<div class="params-table-container">
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>key</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last">The index to get</td>
</tr>
</tbody>
</table>
</div>
<dl class="details">
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">*</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="key"><span class="type-signature"><inner> </span>key<span class="signature">(key)</span><span class="type-signature"> → {*}</span></h4>
</dt>
<dd>
<div class="description">
Get a record by key
</div>
<h5>Parameters:</h5>
<div class="params-table-container">
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>key</code></td>
<td class="type">
<span class="param-type">*</span>
</td>
<td class="description last">The key of the record to get</td>
</tr>
</tbody>
</table>
</div>
<dl class="details">
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">*</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="map"><span class="type-signature"><inner> </span>map<span class="signature">(<span class="optional">query</span>, iterator, <span class="optional">thisobj</span>)</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
Maps the contents to an array by iterating over it and transforming it. You supply the iterator. Supports two signatures:
`.map(query, function)` and `.map(function)`. If you pass in a query, only the items that match the query
are iterated over.
</div>
<h5>Parameters:</h5>
<div class="params-table-container">
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Argument</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>query</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="description last">A query to evaluate</td>
</tr>
<tr>
<td class="name"><code>iterator</code></td>
<td class="type">
<span class="param-type">function</span>
</td>
<td class="attributes">
</td>
<td class="description last">Function to execute against each item in the collection</td>
</tr>
<tr>
<td class="name"><code>thisobj</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="description last">The value of `this`</td>
</tr>
</tbody>
</table>
</div>
<dl class="details">
</dl>
</dd>
<dt>
<h4 class="name" id="max"><span class="type-signature"><inner> </span>max<span class="signature">(<span class="optional">query</span>, iterator, <span class="optional">thisobj</span>)</span><span class="type-signature"> → {number}</span></h4>
</dt>
<dd>
<div class="description">
Retrieves the maximum value of an array. If callback is passed,
it will be executed for each value in the array to generate the criterion by which the value is ranked.
</div>
<h5>Parameters:</h5>
<div class="params-table-container">
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Argument</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>query</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="description last">A query to evaluate . If you pass in a query, only the items that match the query
are iterated over.</td>
</tr>
<tr>
<td class="name"><code>iterator</code></td>
<td class="type">
<span class="param-type">function</span>
</td>
<td class="attributes">
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>thisobj</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="description last">The value of `this`</td>
</tr>
</tbody>
</table>
</div>
<dl class="details">
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">number</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="min"><span class="type-signature"><inner> </span>min<span class="signature">(<span class="optional">query</span>, iterator, <span class="optional">thisobj</span>)</span><span class="type-signature"> → {number}</span></h4>
</dt>
<dd>
<div class="description">
Retrieves the minimum value of an array. If callback is passed,
it will be executed for each value in the array to generate the criterion by which the value is ranked.
</div>
<h5>Parameters:</h5>
<div class="params-table-container">
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Argument</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>query</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="description last">A query to evaluate . If you pass in a query, only the items that match the query
are iterated over.</td>
</tr>
<tr>
<td class="name"><code>iterator</code></td>
<td class="type">
<span class="param-type">function</span>
</td>
<td class="attributes">
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>thisobj</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="description last">The value of `this`</td>
</tr>
</tbody>
</table>
</div>
<dl class="details">
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">number</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="pluck"><span class="type-signature"><inner> </span>pluck<span class="signature">(<span class="optional">query</span>, property)</span><span class="type-signature"> → {*}</span></h4>
</dt>
<dd>
<div class="description">
Reduce the collection to a single value. Supports two signatures:
`.pluck(query, function)` and `.pluck(function)`
</div>
<h5>Parameters:</h5>
<div class="params-table-container">
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Argument</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>query</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="description last">The query to evaluate. If you pass in a query, only the items that match the query
are iterated over.</td>
</tr>
<tr>
<td class="name"><code>property</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="attributes">
</td>
<td class="description last">The property that will be 'plucked' from the contents of the collection</td>
</tr>
</tbody>
</table>
</div>
<dl class="details">
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">*</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="push"><span class="type-signature"><inner> </span>push<span class="signature">(item)</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
Add an item to the top of the list. This is identical to `add`, but is provided for stack semantics
</div>
<h5>Parameters:</h5>
<div class="params-table-container">
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>item</code></td>
<td class="type">
<span class="param-type">*</span>
</td>
<td class="description last">The item to add to the collection. Only one item at a time can be added</td>
</tr>
</tbody>
</table>
</div>
<dl class="details">
</dl>
</dd>
<dt>
<h4 class="name" id="reduce"><span class="type-signature"><inner> </span>reduce<span class="signature">(<span class="optional">query</span>, iterator, <span class="optional">accumulator</span>, <span class="optional">thisobj</span>)</span><span class="type-signature"> → {*}</span></h4>
</dt>
<dd>
<div class="description">
Reduces a collection to a value which is the accumulated result of running each element in the collection through the
callback, where each successive callback execution consumes the return value of the previous execution. If accumulator
is not passed, the first element of the collection will be used as the initial accumulator value.
are iterated over.
</div>
<h5>Parameters:</h5>
<div class="params-table-container">
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Argument</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>query</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="description last">A query to evaluate</td>
</tr>
<tr>
<td class="name"><code>iterator</code></td>
<td class="type">
<span class="param-type">function</span>
</td>
<td class="attributes">
</td>
<td class="description last">The function that will be executed in each item in the collection</td>
</tr>
<tr>
<td class="name"><code>accumulator</code></td>
<td class="type">
<span class="param-type">*</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="description last">Initial value of the accumulator.</td>
</tr>
<tr>
<td class="name"><code>thisobj</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="description last">The value of `this`</td>
</tr>
</tbody>
</table>
</div>
<dl class="details">
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">*</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="sortBy"><span class="type-signature"><inner> </span>sortBy<span class="signature">(<span class="optional">query</span>, iterator, <span class="optional">thisobj</span>)</span><span class="type-signature"> → {array}</span></h4>
</dt>
<dd>
<div class="description">
Returns a sorted copy of the collection.
</div>
<h5>Parameters:</h5>
<div class="params-table-container">
<table class="params table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Argument</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>query</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="description last">The query to evaluate. If you pass in a query, only the items that match the query
are iterated over.</td>
</tr>
<tr>
<td class="name"><code>iterator</code></td>
<td class="type">
<span class="param-type">function</span>
</td>
<td class="attributes">
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>thisobj</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="description last">The value of `this`</td>
</tr>
</tbody>
</table>
</div>
<dl class="details">
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">array</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="toArray"><span class="type-signature"><inner> </span>toArray<span class="signature">()</span><span class="type-signature"> → {array}</span></h4>
</dt>
<dd>
<div class="description">
Returns the collection as an array. If it is already an array, it just returns that.
</div>
<dl class="details">
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">array</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id