1 | <!doctype html>
|
2 | <html>
|
3 |
|
4 | <head>
|
5 | <meta name="generator" content="JSDoc 3.6.2">
|
6 | <meta charset="utf-8">
|
7 | <title>keyu 2.0.0 » Module: collections</title>
|
8 | <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
|
9 | <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
|
10 | <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
|
11 | <link href="css/baseline.css" rel="stylesheet">
|
12 | </head>
|
13 |
|
14 | <body onload="prettyPrint()">
|
15 | <nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
|
16 | <div id="jsdoc-navbar-container">
|
17 | <div id="jsdoc-navbar-content">
|
18 | <a href="index.html" class="jsdoc-navbar-package-name">keyu 2.<wbr>0.<wbr>0</a>
|
19 | </div>
|
20 | </div>
|
21 | </nav>
|
22 | <div id="jsdoc-body-container">
|
23 | <div id="jsdoc-content">
|
24 | <div id="jsdoc-content-container">
|
25 | <div id="jsdoc-main" role="main">
|
26 | <header class="page-header">
|
27 | <div class="symbol-detail-labels"><span class="label label-kind">module</span></div>
|
28 | <h1><small></small><span class="symbol-name">collections</span></h1>
|
29 | <p class="source-link">Source: <a href="collections_index.js.html">collections/<wbr>index.<wbr>js</a></p>
|
30 | <div class="symbol-description">
|
31 | </div>
|
32 | <dl class="dl-compact">
|
33 | </dl>
|
34 | </header>
|
35 | <section id="summary">
|
36 | <div class="summary-callout">
|
37 | <h2 class="summary-callout-heading">Methods</h2>
|
38 | <div class="summary-content">
|
39 | <div class="summary-column">
|
40 | <dl class="dl-summary-callout">
|
41 | <dt><a href="module-collections.html#~filter">filter(fn, collection)</a></dt>
|
42 | <dd>
|
43 | </dd>
|
44 | </dl>
|
45 | </div>
|
46 | <div class="summary-column">
|
47 | <dl class="dl-summary-callout">
|
48 | <dt><a href="module-collections.html#~map">map(fn, collection)</a></dt>
|
49 | <dd>
|
50 | </dd>
|
51 | </dl>
|
52 | </div>
|
53 | <div class="summary-column">
|
54 | <dl class="dl-summary-callout">
|
55 | <dt><a href="module-collections.html#~reduce">reduce(fn, init, collection)</a></dt>
|
56 | <dd>
|
57 | </dd>
|
58 | </dl>
|
59 | </div>
|
60 | </div>
|
61 | </div>
|
62 | </section>
|
63 | <section>
|
64 | <h2>Methods</h2>
|
65 | <section>
|
66 | <div class="symbol-detail-labels"><span class="label label-inner">inner</span></div>
|
67 | <h3 id="~filter"><span class="symbol-name">filter</span><span class="signature"><span class="signature-params">(fn, collection)</span> → <span class="signature-returns"> (Array or Object)</span></span></h3>
|
68 | <p>Filters an array/object based on the boolean evaluation of the passed function.</p>
|
69 | <section>
|
70 | <h4>
|
71 | Example
|
72 | </h4>
|
73 | <div>
|
74 | <pre class="prettyprint"><code>//Arrays
|
75 | filter(x => x > 1, [1,2,3]) // -> [2,3]
|
76 | //Objects
|
77 | filter(x => x > 1, {a:1,b:2}) // -> {b:2}</code></pre>
|
78 | </div>
|
79 | </section>
|
80 | <section>
|
81 | <h4>Parameters</h4>
|
82 | <table class="jsdoc-details-table">
|
83 | <thead>
|
84 | <tr>
|
85 | <th>Name</th>
|
86 | <th>Type</th>
|
87 | <th>Optional</th>
|
88 | <th>Description</th>
|
89 | </tr>
|
90 | </thead>
|
91 | <tbody>
|
92 | <tr>
|
93 | <td>
|
94 | <p>fn</p>
|
95 | </td>
|
96 | <td>
|
97 | <p>function()</p>
|
98 | </td>
|
99 | <td>
|
100 | <p> </p>
|
101 | </td>
|
102 | <td>
|
103 | <p>Reduce function</p>
|
104 | </td>
|
105 | </tr>
|
106 | <tr>
|
107 | <td>
|
108 | <p>collection</p>
|
109 | </td>
|
110 | <td>
|
111 | <p>(Array or Object)</p>
|
112 | </td>
|
113 | <td>
|
114 | <p> </p>
|
115 | </td>
|
116 | <td>
|
117 | <p>iterable collection to traverse</p>
|
118 | </td>
|
119 | </tr>
|
120 | </tbody>
|
121 | </table>
|
122 | </section>
|
123 | <dl class="dl-compact">
|
124 | <dt>See also</dt>
|
125 | <dd>
|
126 | <p><a href="https://github.com/nerac/keyu/blob/master/test/collectionsTest.js">collectionsTest.js</a></p>
|
127 | </dd>
|
128 | <dt>Returns</dt>
|
129 | <dd>
|
130 | <p><code>(Array or Object)</code> </p>
|
131 | </dd>
|
132 | </dl>
|
133 | <div class="symbol-detail-labels"><span class="label label-inner">inner</span></div>
|
134 | <h3 id="~map"><span class="symbol-name">map</span><span class="signature"><span class="signature-params">(fn, collection)</span> → <span class="signature-returns"> (Array or Object)</span></span></h3>
|
135 | <p>Maps over an array/object applying the passed function</p>
|
136 | <section>
|
137 | <h4>
|
138 | Example
|
139 | </h4>
|
140 | <div>
|
141 | <pre class="prettyprint"><code>//Arrays
|
142 | map(x => x+1, [1,2,3]) // -> [2,3,4]
|
143 | //Objects
|
144 | map(x => x+1, {a:1,b:2}) // -> {a:2,b:3}</code></pre>
|
145 | </div>
|
146 | </section>
|
147 | <section>
|
148 | <h4>Parameters</h4>
|
149 | <table class="jsdoc-details-table">
|
150 | <thead>
|
151 | <tr>
|
152 | <th>Name</th>
|
153 | <th>Type</th>
|
154 | <th>Optional</th>
|
155 | <th>Description</th>
|
156 | </tr>
|
157 | </thead>
|
158 | <tbody>
|
159 | <tr>
|
160 | <td>
|
161 | <p>fn</p>
|
162 | </td>
|
163 | <td>
|
164 | <p>function()</p>
|
165 | </td>
|
166 | <td>
|
167 | <p> </p>
|
168 | </td>
|
169 | <td>
|
170 | <p>Reduce function</p>
|
171 | </td>
|
172 | </tr>
|
173 | <tr>
|
174 | <td>
|
175 | <p>collection</p>
|
176 | </td>
|
177 | <td>
|
178 | <p>(Array or Object)</p>
|
179 | </td>
|
180 | <td>
|
181 | <p> </p>
|
182 | </td>
|
183 | <td>
|
184 | <p>iterable collection to traverse</p>
|
185 | </td>
|
186 | </tr>
|
187 | </tbody>
|
188 | </table>
|
189 | </section>
|
190 | <dl class="dl-compact">
|
191 | <dt>See also</dt>
|
192 | <dd>
|
193 | <p><a href="https://github.com/nerac/keyu/blob/master/test/collectionsTest.js">collectionsTest.js</a></p>
|
194 | </dd>
|
195 | <dt>Returns</dt>
|
196 | <dd>
|
197 | <p><code>(Array or Object)</code> </p>
|
198 | </dd>
|
199 | </dl>
|
200 | <div class="symbol-detail-labels"><span class="label label-inner">inner</span></div>
|
201 | <h3 id="~reduce"><span class="symbol-name">reduce</span><span class="signature"><span class="signature-params">(fn, init, collection)</span> → <span class="signature-returns"> any type</span></span></h3>
|
202 | <p>Reduces an array/object based on the reduction function
|
203 | and the initialization value passed</p>
|
204 | <section>
|
205 | <h4>
|
206 | Example
|
207 | </h4>
|
208 | <div>
|
209 | <pre class="prettyprint"><code>//Arrays
|
210 | reduce((a,b)=> a+b,0,[1,2,3]) // -> 6
|
211 | reduce((a,b)=> a.concat(b+1),[],[1,2,3]) // -> [2,3,4]
|
212 | //Objects
|
213 | reduce((a,v,k)=> ({..a,[k],v+1}),{},{a:1,b:2}) // -> {a:2,b:3}</code></pre>
|
214 | </div>
|
215 | </section>
|
216 | <section>
|
217 | <h4>Parameters</h4>
|
218 | <table class="jsdoc-details-table">
|
219 | <thead>
|
220 | <tr>
|
221 | <th>Name</th>
|
222 | <th>Type</th>
|
223 | <th>Optional</th>
|
224 | <th>Description</th>
|
225 | </tr>
|
226 | </thead>
|
227 | <tbody>
|
228 | <tr>
|
229 | <td>
|
230 | <p>fn</p>
|
231 | </td>
|
232 | <td>
|
233 | <p>function()</p>
|
234 | </td>
|
235 | <td>
|
236 | <p> </p>
|
237 | </td>
|
238 | <td>
|
239 | <p>Reduce function</p>
|
240 | </td>
|
241 | </tr>
|
242 | <tr>
|
243 | <td>
|
244 | <p>init</p>
|
245 | </td>
|
246 | <td>
|
247 | <p>any type</p>
|
248 | </td>
|
249 | <td>
|
250 | <p> </p>
|
251 | </td>
|
252 | <td>
|
253 | <p>Initial value to accumulate</p>
|
254 | </td>
|
255 | </tr>
|
256 | <tr>
|
257 | <td>
|
258 | <p>collection</p>
|
259 | </td>
|
260 | <td>
|
261 | <p>(Array or Object)</p>
|
262 | </td>
|
263 | <td>
|
264 | <p> </p>
|
265 | </td>
|
266 | <td>
|
267 | <p>iterable collection to traverse</p>
|
268 | </td>
|
269 | </tr>
|
270 | </tbody>
|
271 | </table>
|
272 | </section>
|
273 | <dl class="dl-compact">
|
274 | <dt>See also</dt>
|
275 | <dd>
|
276 | <p><a href="https://github.com/nerac/keyu/blob/master/test/collectionsTest.js">collectionsTest.js</a></p>
|
277 | </dd>
|
278 | <dt>Returns</dt>
|
279 | <dd>
|
280 | <p><code>any type</code> </p>
|
281 | </dd>
|
282 | </dl>
|
283 | </section>
|
284 | </section>
|
285 | </div>
|
286 | </div>
|
287 | <nav id="jsdoc-toc-nav" role="navigation"></nav>
|
288 | </div>
|
289 | </div>
|
290 | <footer id="jsdoc-footer" class="jsdoc-footer">
|
291 | <div id="jsdoc-footer-container">
|
292 | <p>
|
293 | Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.2 on June 17, 2019.
|
294 | </p>
|
295 | </div>
|
296 | </footer>
|
297 | <script src="scripts/jquery.min.js"></script>
|
298 | <script src="scripts/jquery.cookie.js"></script>
|
299 | <script src="scripts/tree.jquery.js"></script>
|
300 | <script src="scripts/prettify.js"></script>
|
301 | <script src="scripts/jsdoc-toc.js"></script>
|
302 | <script src="scripts/linenumber.js"></script>
|
303 | <script src="scripts/scrollanchor.js"></script>
|
304 | </body>
|
305 |
|
306 | </html> |
\ | No newline at end of file |