|
0
|
1 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> |
|
|
2 |
<html xmlns:yui="http://yuilibrary.com/rdf/1.0/yui.rdf#"> |
|
|
3 |
<head> |
|
|
4 |
<meta http-equiv="content-type" content="text/html; charset=UTF-8" /> |
|
|
5 |
<title>API: collection YUI~array~extras (YUI Library)</title> |
|
|
6 |
|
|
|
7 |
<link rel="stylesheet" type="text/css" href="assets/reset-fonts-grids-min.css" /> |
|
|
8 |
<link rel="stylesheet" type="text/css" href="assets/api.css" /> |
|
|
9 |
|
|
|
10 |
<script type="text/javascript" src="assets/api-js"></script> |
|
|
11 |
<script type="text/javascript" src="assets/ac-js"></script> |
|
|
12 |
</head> |
|
|
13 |
|
|
|
14 |
<body id="yahoo-com"> |
|
|
15 |
|
|
|
16 |
<div id="doc3" class="yui-t2"> |
|
|
17 |
<div id="hd"> |
|
|
18 |
<h1><a href="http://developer.yahoo.com/yui/" title="Yahoo! UI Library">Yahoo! UI Library</a></h1> |
|
|
19 |
<h3>collection <span class="subtitle">3.0.0</span></h3> |
|
|
20 |
<a href="./index.html" title="Yahoo! UI Library">Yahoo! UI Library</a> |
|
|
21 |
> <a href="./module_collection.html" title="collection">collection</a> |
|
|
22 |
> YUI~array~extras |
|
|
23 |
|
|
|
24 |
<form onsubmit="return false"> |
|
|
25 |
<div id="propertysearch"> |
|
|
26 |
Search: <input autocomplete="off" id="searchinput" /> |
|
|
27 |
<div id="searchresults"> |
|
|
28 |
|
|
|
29 |
</div> |
|
|
30 |
</div> |
|
|
31 |
</form> |
|
|
32 |
</div> |
|
|
33 |
|
|
|
34 |
<div id="bd"> |
|
|
35 |
<div id="yui-main"> |
|
|
36 |
<div class="yui-b"> |
|
|
37 |
<form action="#" name="yui-classopts-form" method="get" id="yui-classopts-form"> |
|
|
38 |
<fieldset> |
|
|
39 |
<legend>Filters</legend> |
|
|
40 |
<span class="classopts"><input type="checkbox" name="show_private" id="show_private" /> <label for="show_private">Show Private</label></span> |
|
|
41 |
<span class="classopts"><input type="checkbox" name="show_protected" id="show_protected" /> <label for="show_protected">Show Protected</label></span> |
|
|
42 |
<span class="classopts"><input type="checkbox" name="show_deprecated" id="show_deprecated" /> <label for="show_deprecated">Show Deprecated</label></span> |
|
|
43 |
</fieldset> |
|
|
44 |
</form> |
|
|
45 |
|
|
|
46 |
<h2> |
|
|
47 |
|
|
|
48 |
|
|
|
49 |
|
|
|
50 |
|
|
|
51 |
Class <b property="yui:name">YUI~array~extras</b> |
|
|
52 |
<span class="extends"> |
|
|
53 |
</span> |
|
|
54 |
|
|
|
55 |
</h2> |
|
|
56 |
<!-- class tree goes here --> |
|
|
57 |
|
|
|
58 |
|
|
|
59 |
|
|
|
60 |
|
|
|
61 |
<div class="summary description" property="yui:description"> |
|
|
62 |
Adds the following array utilities to the YUI instance |
|
|
63 |
(Y.Array). This is in addition to the methods provided |
|
|
64 |
in the core. |
|
|
65 |
</div> |
|
|
66 |
|
|
|
67 |
|
|
|
68 |
<div rel="yui:properties" resource="#properties"> |
|
|
69 |
<div class="section field details"> |
|
|
70 |
<h3 id="properties">Properties</h3> |
|
|
71 |
<div class="content"> |
|
|
72 |
<div class="" rel="yui:property" resource="#property_lastIndexOf"> |
|
|
73 |
<h4><a name="property_lastIndexOf" property="yui:name">lastIndexOf</a> |
|
|
74 |
- <code>static <span property="yui:type">object</span></code> |
|
|
75 |
</h4> |
|
|
76 |
<div class="detail"> |
|
|
77 |
<div class="description" property="yui:description"> |
|
|
78 |
Returns the index of the last item in the array |
|
|
79 |
that contains the specified value, -1 if the |
|
|
80 |
value isn't found. |
|
|
81 |
method Array.lastIndexOf |
|
|
82 |
</div> |
|
|
83 |
</div> |
|
|
84 |
|
|
|
85 |
|
|
|
86 |
|
|
|
87 |
|
|
|
88 |
<hr /> |
|
|
89 |
</div> |
|
|
90 |
</div> |
|
|
91 |
</div> |
|
|
92 |
|
|
|
93 |
</div> |
|
|
94 |
|
|
|
95 |
<div rel="yui:methods" resource="#methods"> |
|
|
96 |
<div class="section method details"> |
|
|
97 |
<h3 id="methods">Methods</h3> |
|
|
98 |
<div class="content"> |
|
|
99 |
<div class="" rel="yui:method" resource="#method_Array.every"> |
|
|
100 |
<h4> |
|
|
101 |
<a name="method_Array.every">Array.every</a></h4> |
|
|
102 |
<div class="detail" > |
|
|
103 |
<code> |
|
|
104 |
|
|
|
105 |
static |
|
|
106 |
|
|
|
107 |
boolean |
|
|
108 |
<strong property="yui:name">Array.every</strong> |
|
|
109 |
( |
|
|
110 |
|
|
|
111 |
|
|
|
112 |
a |
|
|
113 |
|
|
|
114 |
|
|
|
115 |
, |
|
|
116 |
f |
|
|
117 |
|
|
|
118 |
|
|
|
119 |
, |
|
|
120 |
o |
|
|
121 |
|
|
|
122 |
|
|
|
123 |
) |
|
|
124 |
</code> |
|
|
125 |
|
|
|
126 |
<div class="description" property="yui:description"> |
|
|
127 |
Executes the supplied function on each item in the array. |
|
|
128 |
</div> |
|
|
129 |
|
|
|
130 |
<div class="description"> |
|
|
131 |
|
|
|
132 |
<dl rel="yui:parameters"> |
|
|
133 |
<dt>Parameters:</dt> |
|
|
134 |
<dd rel="yui:parameter"> |
|
|
135 |
<code><span property="yui:name">a</span> |
|
|
136 |
<<span property="yui:type">Array</span>> |
|
|
137 |
</code> |
|
|
138 |
<span property="yui:description"> the array to iterate</span> |
|
|
139 |
</dd> |
|
|
140 |
<dd rel="yui:parameter"> |
|
|
141 |
<code><span property="yui:name">f</span> |
|
|
142 |
<<span property="yui:type">Function</span>> |
|
|
143 |
</code> |
|
|
144 |
<span property="yui:description"> the function to execute on each item</span> |
|
|
145 |
</dd> |
|
|
146 |
<dd rel="yui:parameter"> |
|
|
147 |
<code><span property="yui:name">o</span> |
|
|
148 |
<<span property="yui:type">object</span>> |
|
|
149 |
</code> |
|
|
150 |
<span property="yui:description"> Optional context object</span> |
|
|
151 |
</dd> |
|
|
152 |
</dl> |
|
|
153 |
|
|
|
154 |
<dl> |
|
|
155 |
<dt>Returns: |
|
|
156 |
<code property="yui:return"> |
|
|
157 |
boolean |
|
|
158 |
</code></dt> |
|
|
159 |
<dd property="yui:returnInfo">true if every item in the array returns true |
|
|
160 |
from the supplied function.</dd> |
|
|
161 |
</dl> |
|
|
162 |
|
|
|
163 |
|
|
|
164 |
|
|
|
165 |
|
|
|
166 |
</div> |
|
|
167 |
|
|
|
168 |
</div> |
|
|
169 |
<hr /> |
|
|
170 |
</div> |
|
|
171 |
<div class="" rel="yui:method" resource="#method_Array.filter"> |
|
|
172 |
<h4> |
|
|
173 |
<a name="method_Array.filter">Array.filter</a></h4> |
|
|
174 |
<div class="detail" > |
|
|
175 |
<code> |
|
|
176 |
|
|
|
177 |
static |
|
|
178 |
|
|
|
179 |
Array |
|
|
180 |
<strong property="yui:name">Array.filter</strong> |
|
|
181 |
( |
|
|
182 |
|
|
|
183 |
|
|
|
184 |
a |
|
|
185 |
|
|
|
186 |
|
|
|
187 |
, |
|
|
188 |
f |
|
|
189 |
|
|
|
190 |
|
|
|
191 |
, |
|
|
192 |
o |
|
|
193 |
|
|
|
194 |
|
|
|
195 |
) |
|
|
196 |
</code> |
|
|
197 |
|
|
|
198 |
<div class="description" property="yui:description"> |
|
|
199 |
Executes the supplied function on each item in the array. |
|
|
200 |
Returns a new array containing the items that the supplied |
|
|
201 |
function returned true for. |
|
|
202 |
</div> |
|
|
203 |
|
|
|
204 |
<div class="description"> |
|
|
205 |
|
|
|
206 |
<dl rel="yui:parameters"> |
|
|
207 |
<dt>Parameters:</dt> |
|
|
208 |
<dd rel="yui:parameter"> |
|
|
209 |
<code><span property="yui:name">a</span> |
|
|
210 |
<<span property="yui:type">Array</span>> |
|
|
211 |
</code> |
|
|
212 |
<span property="yui:description"> the array to iterate</span> |
|
|
213 |
</dd> |
|
|
214 |
<dd rel="yui:parameter"> |
|
|
215 |
<code><span property="yui:name">f</span> |
|
|
216 |
<<span property="yui:type">Function</span>> |
|
|
217 |
</code> |
|
|
218 |
<span property="yui:description"> the function to execute on each item</span> |
|
|
219 |
</dd> |
|
|
220 |
<dd rel="yui:parameter"> |
|
|
221 |
<code><span property="yui:name">o</span> |
|
|
222 |
<<span property="yui:type">object</span>> |
|
|
223 |
</code> |
|
|
224 |
<span property="yui:description"> Optional context object</span> |
|
|
225 |
</dd> |
|
|
226 |
</dl> |
|
|
227 |
|
|
|
228 |
<dl> |
|
|
229 |
<dt>Returns: |
|
|
230 |
<code property="yui:return"> |
|
|
231 |
Array |
|
|
232 |
</code></dt> |
|
|
233 |
<dd property="yui:returnInfo">The items on which the supplied function |
|
|
234 |
returned true. If no items matched an empty array is |
|
|
235 |
returned.</dd> |
|
|
236 |
</dl> |
|
|
237 |
|
|
|
238 |
|
|
|
239 |
|
|
|
240 |
|
|
|
241 |
</div> |
|
|
242 |
|
|
|
243 |
</div> |
|
|
244 |
<hr /> |
|
|
245 |
</div> |
|
|
246 |
<div class="" rel="yui:method" resource="#method_Array.find"> |
|
|
247 |
<h4> |
|
|
248 |
<a name="method_Array.find">Array.find</a></h4> |
|
|
249 |
<div class="detail" > |
|
|
250 |
<code> |
|
|
251 |
|
|
|
252 |
static |
|
|
253 |
|
|
|
254 |
object |
|
|
255 |
<strong property="yui:name">Array.find</strong> |
|
|
256 |
( |
|
|
257 |
|
|
|
258 |
|
|
|
259 |
a |
|
|
260 |
|
|
|
261 |
|
|
|
262 |
, |
|
|
263 |
f |
|
|
264 |
|
|
|
265 |
|
|
|
266 |
, |
|
|
267 |
o |
|
|
268 |
|
|
|
269 |
|
|
|
270 |
) |
|
|
271 |
</code> |
|
|
272 |
|
|
|
273 |
<div class="description" property="yui:description"> |
|
|
274 |
Executes the supplied function on each item in the array, |
|
|
275 |
searching for the first item that matches the supplied |
|
|
276 |
function. |
|
|
277 |
</div> |
|
|
278 |
|
|
|
279 |
<div class="description"> |
|
|
280 |
|
|
|
281 |
<dl rel="yui:parameters"> |
|
|
282 |
<dt>Parameters:</dt> |
|
|
283 |
<dd rel="yui:parameter"> |
|
|
284 |
<code><span property="yui:name">a</span> |
|
|
285 |
<<span property="yui:type">Array</span>> |
|
|
286 |
</code> |
|
|
287 |
<span property="yui:description"> the array to search</span> |
|
|
288 |
</dd> |
|
|
289 |
<dd rel="yui:parameter"> |
|
|
290 |
<code><span property="yui:name">f</span> |
|
|
291 |
<<span property="yui:type">Function</span>> |
|
|
292 |
</code> |
|
|
293 |
<span property="yui:description"> the function to execute on each item. |
|
|
294 |
Iteration is stopped as soon as this function returns true |
|
|
295 |
on an item.</span> |
|
|
296 |
</dd> |
|
|
297 |
<dd rel="yui:parameter"> |
|
|
298 |
<code><span property="yui:name">o</span> |
|
|
299 |
<<span property="yui:type">object</span>> |
|
|
300 |
</code> |
|
|
301 |
<span property="yui:description"> Optional context object</span> |
|
|
302 |
</dd> |
|
|
303 |
</dl> |
|
|
304 |
|
|
|
305 |
<dl> |
|
|
306 |
<dt>Returns: |
|
|
307 |
<code property="yui:return"> |
|
|
308 |
object |
|
|
309 |
</code></dt> |
|
|
310 |
<dd property="yui:returnInfo">the first item that the supplied function |
|
|
311 |
returns true for, or null if it never returns true</dd> |
|
|
312 |
</dl> |
|
|
313 |
|
|
|
314 |
|
|
|
315 |
|
|
|
316 |
|
|
|
317 |
</div> |
|
|
318 |
|
|
|
319 |
</div> |
|
|
320 |
<hr /> |
|
|
321 |
</div> |
|
|
322 |
<div class="" rel="yui:method" resource="#method_Array.grep"> |
|
|
323 |
<h4> |
|
|
324 |
<a name="method_Array.grep">Array.grep</a></h4> |
|
|
325 |
<div class="detail" > |
|
|
326 |
<code> |
|
|
327 |
|
|
|
328 |
static |
|
|
329 |
|
|
|
330 |
Array |
|
|
331 |
<strong property="yui:name">Array.grep</strong> |
|
|
332 |
( |
|
|
333 |
|
|
|
334 |
|
|
|
335 |
a |
|
|
336 |
|
|
|
337 |
|
|
|
338 |
, |
|
|
339 |
pattern |
|
|
340 |
|
|
|
341 |
|
|
|
342 |
) |
|
|
343 |
</code> |
|
|
344 |
|
|
|
345 |
<div class="description" property="yui:description"> |
|
|
346 |
Iterates over an array, returning a new array of all the elements |
|
|
347 |
that match the supplied regular expression |
|
|
348 |
</div> |
|
|
349 |
|
|
|
350 |
<div class="description"> |
|
|
351 |
|
|
|
352 |
<dl rel="yui:parameters"> |
|
|
353 |
<dt>Parameters:</dt> |
|
|
354 |
<dd rel="yui:parameter"> |
|
|
355 |
<code><span property="yui:name">a</span> |
|
|
356 |
<<span property="yui:type">Array</span>> |
|
|
357 |
</code> |
|
|
358 |
<span property="yui:description"> a collection to iterate over</span> |
|
|
359 |
</dd> |
|
|
360 |
<dd rel="yui:parameter"> |
|
|
361 |
<code><span property="yui:name">pattern</span> |
|
|
362 |
<<span property="yui:type">RegExp</span>> |
|
|
363 |
</code> |
|
|
364 |
<span property="yui:description"> The regular expression to test against |
|
|
365 |
each item</span> |
|
|
366 |
</dd> |
|
|
367 |
</dl> |
|
|
368 |
|
|
|
369 |
<dl> |
|
|
370 |
<dt>Returns: |
|
|
371 |
<code property="yui:return"> |
|
|
372 |
Array |
|
|
373 |
</code></dt> |
|
|
374 |
<dd property="yui:returnInfo">All the items in the collection that |
|
|
375 |
produce a match against the supplied regular expression. |
|
|
376 |
If no items match, an empty array is returned.</dd> |
|
|
377 |
</dl> |
|
|
378 |
|
|
|
379 |
|
|
|
380 |
|
|
|
381 |
|
|
|
382 |
</div> |
|
|
383 |
|
|
|
384 |
</div> |
|
|
385 |
<hr /> |
|
|
386 |
</div> |
|
|
387 |
<div class="" rel="yui:method" resource="#method_Array.map"> |
|
|
388 |
<h4> |
|
|
389 |
<a name="method_Array.map">Array.map</a></h4> |
|
|
390 |
<div class="detail" > |
|
|
391 |
<code> |
|
|
392 |
|
|
|
393 |
static |
|
|
394 |
|
|
|
395 |
Array |
|
|
396 |
<strong property="yui:name">Array.map</strong> |
|
|
397 |
( |
|
|
398 |
|
|
|
399 |
|
|
|
400 |
a |
|
|
401 |
|
|
|
402 |
|
|
|
403 |
, |
|
|
404 |
f |
|
|
405 |
|
|
|
406 |
|
|
|
407 |
, |
|
|
408 |
o |
|
|
409 |
|
|
|
410 |
|
|
|
411 |
) |
|
|
412 |
</code> |
|
|
413 |
|
|
|
414 |
<div class="description" property="yui:description"> |
|
|
415 |
Executes the supplied function on each item in the array. |
|
|
416 |
</div> |
|
|
417 |
|
|
|
418 |
<div class="description"> |
|
|
419 |
|
|
|
420 |
<dl rel="yui:parameters"> |
|
|
421 |
<dt>Parameters:</dt> |
|
|
422 |
<dd rel="yui:parameter"> |
|
|
423 |
<code><span property="yui:name">a</span> |
|
|
424 |
<<span property="yui:type">Array</span>> |
|
|
425 |
</code> |
|
|
426 |
<span property="yui:description"> the array to iterate</span> |
|
|
427 |
</dd> |
|
|
428 |
<dd rel="yui:parameter"> |
|
|
429 |
<code><span property="yui:name">f</span> |
|
|
430 |
<<span property="yui:type">Function</span>> |
|
|
431 |
</code> |
|
|
432 |
<span property="yui:description"> the function to execute on each item</span> |
|
|
433 |
</dd> |
|
|
434 |
<dd rel="yui:parameter"> |
|
|
435 |
<code><span property="yui:name">o</span> |
|
|
436 |
<<span property="yui:type">object</span>> |
|
|
437 |
</code> |
|
|
438 |
<span property="yui:description"> Optional context object</span> |
|
|
439 |
</dd> |
|
|
440 |
</dl> |
|
|
441 |
|
|
|
442 |
<dl> |
|
|
443 |
<dt>Returns: |
|
|
444 |
<code property="yui:return"> |
|
|
445 |
Array |
|
|
446 |
</code></dt> |
|
|
447 |
<dd property="yui:returnInfo">A new array containing the return value |
|
|
448 |
of the supplied function for each item in the original |
|
|
449 |
array.</dd> |
|
|
450 |
</dl> |
|
|
451 |
|
|
|
452 |
|
|
|
453 |
|
|
|
454 |
|
|
|
455 |
</div> |
|
|
456 |
|
|
|
457 |
</div> |
|
|
458 |
<hr /> |
|
|
459 |
</div> |
|
|
460 |
<div class="" rel="yui:method" resource="#method_Array.partition"> |
|
|
461 |
<h4> |
|
|
462 |
<a name="method_Array.partition">Array.partition</a></h4> |
|
|
463 |
<div class="detail" > |
|
|
464 |
<code> |
|
|
465 |
|
|
|
466 |
static |
|
|
467 |
|
|
|
468 |
|
|
|
469 |
<strong property="yui:name">Array.partition</strong> |
|
|
470 |
( |
|
|
471 |
|
|
|
472 |
|
|
|
473 |
a |
|
|
474 |
|
|
|
475 |
|
|
|
476 |
, |
|
|
477 |
o |
|
|
478 |
|
|
|
479 |
|
|
|
480 |
) |
|
|
481 |
</code> |
|
|
482 |
|
|
|
483 |
<div class="description" property="yui:description"> |
|
|
484 |
Partitions an array into two new arrays, one with the items |
|
|
485 |
that match the supplied function, and one with the items that |
|
|
486 |
do not. |
|
|
487 |
</div> |
|
|
488 |
|
|
|
489 |
<div class="description"> |
|
|
490 |
|
|
|
491 |
<dl rel="yui:parameters"> |
|
|
492 |
<dt>Parameters:</dt> |
|
|
493 |
<dd rel="yui:parameter"> |
|
|
494 |
<code><span property="yui:name">a</span> |
|
|
495 |
<<span property="yui:type">Array</span>> |
|
|
496 |
</code> |
|
|
497 |
<span property="yui:description"> a collection to iterate over</span> |
|
|
498 |
</dd> |
|
|
499 |
<dd rel="yui:parameter"> |
|
|
500 |
<code><span property="yui:name">o</span> |
|
|
501 |
<<span property="yui:type">object</span>> |
|
|
502 |
</code> |
|
|
503 |
<span property="yui:description"> Optional execution context of f.</span> |
|
|
504 |
</dd> |
|
|
505 |
</dl> |
|
|
506 |
|
|
|
507 |
<dl> |
|
|
508 |
<dt>Returns: |
|
|
509 |
<code property="yui:return"> |
|
|
510 |
</code></dt> |
|
|
511 |
<dd property="yui:returnInfo">An object with two members, 'matches' and 'rejects', |
|
|
512 |
that are arrays containing the items that were selected or |
|
|
513 |
rejected by the test function (or an empty array).</dd> |
|
|
514 |
</dl> |
|
|
515 |
|
|
|
516 |
|
|
|
517 |
|
|
|
518 |
|
|
|
519 |
</div> |
|
|
520 |
|
|
|
521 |
</div> |
|
|
522 |
<hr /> |
|
|
523 |
</div> |
|
|
524 |
<div class="" rel="yui:method" resource="#method_Array.reduce"> |
|
|
525 |
<h4> |
|
|
526 |
<a name="method_Array.reduce">Array.reduce</a></h4> |
|
|
527 |
<div class="detail" > |
|
|
528 |
<code> |
|
|
529 |
|
|
|
530 |
static |
|
|
531 |
|
|
|
532 |
|
|
|
533 |
<strong property="yui:name">Array.reduce</strong> |
|
|
534 |
( |
|
|
535 |
|
|
|
536 |
|
|
|
537 |
a |
|
|
538 |
|
|
|
539 |
|
|
|
540 |
, |
|
|
541 |
init |
|
|
542 |
|
|
|
543 |
|
|
|
544 |
, |
|
|
545 |
f |
|
|
546 |
|
|
|
547 |
|
|
|
548 |
, |
|
|
549 |
o |
|
|
550 |
|
|
|
551 |
|
|
|
552 |
) |
|
|
553 |
</code> |
|
|
554 |
|
|
|
555 |
<div class="description" property="yui:description"> |
|
|
556 |
Executes the supplied function on each item in the array. |
|
|
557 |
Reduce "folds" the array into a single value. |
|
|
558 |
</div> |
|
|
559 |
|
|
|
560 |
<div class="description"> |
|
|
561 |
|
|
|
562 |
<dl rel="yui:parameters"> |
|
|
563 |
<dt>Parameters:</dt> |
|
|
564 |
<dd rel="yui:parameter"> |
|
|
565 |
<code><span property="yui:name">a</span> |
|
|
566 |
<<span property="yui:type">Array</span>> |
|
|
567 |
</code> |
|
|
568 |
<span property="yui:description"> the array to iterate</span> |
|
|
569 |
</dd> |
|
|
570 |
<dd rel="yui:parameter"> |
|
|
571 |
<code><span property="yui:name">init</span> |
|
|
572 |
<<span property="yui:type">object</span>> |
|
|
573 |
</code> |
|
|
574 |
<span property="yui:description"> The initial value to start from</span> |
|
|
575 |
</dd> |
|
|
576 |
<dd rel="yui:parameter"> |
|
|
577 |
<code><span property="yui:name">f</span> |
|
|
578 |
<<span property="yui:type">Function</span>> |
|
|
579 |
</code> |
|
|
580 |
<span property="yui:description"> the function to execute on each item. It |
|
|
581 |
is responsible for returning the updated value of the |
|
|
582 |
computation.</span> |
|
|
583 |
</dd> |
|
|
584 |
<dd rel="yui:parameter"> |
|
|
585 |
<code><span property="yui:name">o</span> |
|
|
586 |
<<span property="yui:type">object</span>> |
|
|
587 |
</code> |
|
|
588 |
<span property="yui:description"> Optional context object</span> |
|
|
589 |
</dd> |
|
|
590 |
</dl> |
|
|
591 |
|
|
|
592 |
<dl> |
|
|
593 |
<dt>Returns: |
|
|
594 |
<code property="yui:return"> |
|
|
595 |
</code></dt> |
|
|
596 |
<dd property="yui:returnInfo">A value that results from iteratively applying the |
|
|
597 |
supplied function to each element in the array.</dd> |
|
|
598 |
</dl> |
|
|
599 |
|
|
|
600 |
|
|
|
601 |
|
|
|
602 |
|
|
|
603 |
</div> |
|
|
604 |
|
|
|
605 |
</div> |
|
|
606 |
<hr /> |
|
|
607 |
</div> |
|
|
608 |
<div class="" rel="yui:method" resource="#method_Array.reject"> |
|
|
609 |
<h4> |
|
|
610 |
<a name="method_Array.reject">Array.reject</a></h4> |
|
|
611 |
<div class="detail" > |
|
|
612 |
<code> |
|
|
613 |
|
|
|
614 |
static |
|
|
615 |
|
|
|
616 |
Array |
|
|
617 |
<strong property="yui:name">Array.reject</strong> |
|
|
618 |
( |
|
|
619 |
|
|
|
620 |
|
|
|
621 |
a |
|
|
622 |
|
|
|
623 |
|
|
|
624 |
, |
|
|
625 |
f |
|
|
626 |
|
|
|
627 |
|
|
|
628 |
, |
|
|
629 |
o |
|
|
630 |
|
|
|
631 |
|
|
|
632 |
) |
|
|
633 |
</code> |
|
|
634 |
|
|
|
635 |
<div class="description" property="yui:description"> |
|
|
636 |
The inverse of filter. Executes the supplied function on each item. |
|
|
637 |
Returns a new array containing the items that the supplied |
|
|
638 |
function returned *false* for. |
|
|
639 |
</div> |
|
|
640 |
|
|
|
641 |
<div class="description"> |
|
|
642 |
|
|
|
643 |
<dl rel="yui:parameters"> |
|
|
644 |
<dt>Parameters:</dt> |
|
|
645 |
<dd rel="yui:parameter"> |
|
|
646 |
<code><span property="yui:name">a</span> |
|
|
647 |
<<span property="yui:type">Array</span>> |
|
|
648 |
</code> |
|
|
649 |
<span property="yui:description"> the array to iterate</span> |
|
|
650 |
</dd> |
|
|
651 |
<dd rel="yui:parameter"> |
|
|
652 |
<code><span property="yui:name">f</span> |
|
|
653 |
<<span property="yui:type">Function</span>> |
|
|
654 |
</code> |
|
|
655 |
<span property="yui:description"> the function to execute on each item</span> |
|
|
656 |
</dd> |
|
|
657 |
<dd rel="yui:parameter"> |
|
|
658 |
<code><span property="yui:name">o</span> |
|
|
659 |
<<span property="yui:type">object</span>> |
|
|
660 |
</code> |
|
|
661 |
<span property="yui:description"> Optional context object</span> |
|
|
662 |
</dd> |
|
|
663 |
</dl> |
|
|
664 |
|
|
|
665 |
<dl> |
|
|
666 |
<dt>Returns: |
|
|
667 |
<code property="yui:return"> |
|
|
668 |
Array |
|
|
669 |
</code></dt> |
|
|
670 |
<dd property="yui:returnInfo">The items on which the supplied function |
|
|
671 |
returned false.</dd> |
|
|
672 |
</dl> |
|
|
673 |
|
|
|
674 |
|
|
|
675 |
|
|
|
676 |
|
|
|
677 |
</div> |
|
|
678 |
|
|
|
679 |
</div> |
|
|
680 |
<hr /> |
|
|
681 |
</div> |
|
|
682 |
<div class="" rel="yui:method" resource="#method_Array.unique"> |
|
|
683 |
<h4> |
|
|
684 |
<a name="method_Array.unique">Array.unique</a></h4> |
|
|
685 |
<div class="detail" > |
|
|
686 |
<code> |
|
|
687 |
|
|
|
688 |
static |
|
|
689 |
|
|
|
690 |
Array |
|
|
691 |
<strong property="yui:name">Array.unique</strong> |
|
|
692 |
( |
|
|
693 |
|
|
|
694 |
|
|
|
695 |
a |
|
|
696 |
|
|
|
697 |
|
|
|
698 |
, |
|
|
699 |
sort |
|
|
700 |
|
|
|
701 |
|
|
|
702 |
) |
|
|
703 |
</code> |
|
|
704 |
|
|
|
705 |
<div class="description" property="yui:description"> |
|
|
706 |
Returns a copy of the array with the duplicate entries removed |
|
|
707 |
</div> |
|
|
708 |
|
|
|
709 |
<div class="description"> |
|
|
710 |
|
|
|
711 |
<dl rel="yui:parameters"> |
|
|
712 |
<dt>Parameters:</dt> |
|
|
713 |
<dd rel="yui:parameter"> |
|
|
714 |
<code><span property="yui:name">a</span> |
|
|
715 |
<<span property="yui:type">Array</span>> |
|
|
716 |
</code> |
|
|
717 |
<span property="yui:description"> the array to find the subset of uniques for</span> |
|
|
718 |
</dd> |
|
|
719 |
<dd rel="yui:parameter"> |
|
|
720 |
<code><span property="yui:name">sort</span> |
|
|
721 |
<<span property="yui:type">bool</span>> |
|
|
722 |
</code> |
|
|
723 |
<span property="yui:description"> flag to denote if the array is sorted or not. Defaults to false, the more general operation</span> |
|
|
724 |
</dd> |
|
|
725 |
</dl> |
|
|
726 |
|
|
|
727 |
<dl> |
|
|
728 |
<dt>Returns: |
|
|
729 |
<code property="yui:return"> |
|
|
730 |
Array |
|
|
731 |
</code></dt> |
|
|
732 |
<dd property="yui:returnInfo">a copy of the array with duplicate entries removed</dd> |
|
|
733 |
</dl> |
|
|
734 |
|
|
|
735 |
|
|
|
736 |
|
|
|
737 |
|
|
|
738 |
</div> |
|
|
739 |
|
|
|
740 |
</div> |
|
|
741 |
<hr /> |
|
|
742 |
</div> |
|
|
743 |
<div class="" rel="yui:method" resource="#method_Array.zip"> |
|
|
744 |
<h4> |
|
|
745 |
<a name="method_Array.zip">Array.zip</a></h4> |
|
|
746 |
<div class="detail" > |
|
|
747 |
<code> |
|
|
748 |
|
|
|
749 |
static |
|
|
750 |
|
|
|
751 |
|
|
|
752 |
<strong property="yui:name">Array.zip</strong> |
|
|
753 |
( |
|
|
754 |
|
|
|
755 |
|
|
|
756 |
a |
|
|
757 |
|
|
|
758 |
|
|
|
759 |
, |
|
|
760 |
a2 |
|
|
761 |
|
|
|
762 |
|
|
|
763 |
) |
|
|
764 |
</code> |
|
|
765 |
|
|
|
766 |
<div class="description" property="yui:description"> |
|
|
767 |
Creates an array of arrays by pairing the corresponding |
|
|
768 |
elements of two arrays together into a new array. |
|
|
769 |
</div> |
|
|
770 |
|
|
|
771 |
<div class="description"> |
|
|
772 |
|
|
|
773 |
<dl rel="yui:parameters"> |
|
|
774 |
<dt>Parameters:</dt> |
|
|
775 |
<dd rel="yui:parameter"> |
|
|
776 |
<code><span property="yui:name">a</span> |
|
|
777 |
<<span property="yui:type">Array</span>> |
|
|
778 |
</code> |
|
|
779 |
<span property="yui:description"> a collection to iterate over</span> |
|
|
780 |
</dd> |
|
|
781 |
<dd rel="yui:parameter"> |
|
|
782 |
<code><span property="yui:name">a2</span> |
|
|
783 |
<<span property="yui:type">Array</span>> |
|
|
784 |
</code> |
|
|
785 |
<span property="yui:description"> another collection whose members will be |
|
|
786 |
paired with members of the first parameter</span> |
|
|
787 |
</dd> |
|
|
788 |
</dl> |
|
|
789 |
|
|
|
790 |
<dl> |
|
|
791 |
<dt>Returns: |
|
|
792 |
<code property="yui:return"> |
|
|
793 |
</code></dt> |
|
|
794 |
<dd property="yui:returnInfo">An array of arrays formed by pairing each element |
|
|
795 |
of the first collection with an item in the second collection |
|
|
796 |
having the corresponding index.</dd> |
|
|
797 |
</dl> |
|
|
798 |
|
|
|
799 |
|
|
|
800 |
|
|
|
801 |
|
|
|
802 |
</div> |
|
|
803 |
|
|
|
804 |
</div> |
|
|
805 |
<hr /> |
|
|
806 |
</div> |
|
|
807 |
</div> |
|
|
808 |
</div> |
|
|
809 |
|
|
|
810 |
</div> |
|
|
811 |
|
|
|
812 |
<div rel="yui:events" resource="#events"> |
|
|
813 |
|
|
|
814 |
|
|
|
815 |
</div> |
|
|
816 |
|
|
|
817 |
<div rel="yui:attributes" resource="#configattributes"> |
|
|
818 |
|
|
|
819 |
</div> |
|
|
820 |
|
|
|
821 |
</div> |
|
|
822 |
</div> |
|
|
823 |
<div class="yui-b"> |
|
|
824 |
<div class="nav"> |
|
|
825 |
|
|
|
826 |
<div id="moduleList" class="module"> |
|
|
827 |
<h4>Modules</h4> |
|
|
828 |
<ul class="content"> |
|
|
829 |
<li class=""><a href="module_anim.html" title="anim">anim</a></li> |
|
|
830 |
<li class=""><a href="module_async-queue.html" title="async-queue">async-queue</a></li> |
|
|
831 |
<li class=""><a href="module_attribute.html" title="attribute">attribute</a></li> |
|
|
832 |
<li class=""><a href="module_base.html" title="base">base</a></li> |
|
|
833 |
<li class=""><a href="module_cache.html" title="cache">cache</a></li> |
|
|
834 |
<li class=""><a href="module_classnamemanager.html" title="classnamemanager">classnamemanager</a></li> |
|
|
835 |
<li class="selected"><a href="module_collection.html" title="collection">collection</a></li> |
|
|
836 |
<li class=""><a href="module_console.html" title="console">console</a></li> |
|
|
837 |
<li class=""><a href="module_console-filters.html" title="console-filters">console-filters</a></li> |
|
|
838 |
<li class=""><a href="module_cookie.html" title="cookie">cookie</a></li> |
|
|
839 |
<li class=""><a href="module_dataschema.html" title="dataschema">dataschema</a></li> |
|
|
840 |
<li class=""><a href="module_datasource.html" title="datasource">datasource</a></li> |
|
|
841 |
<li class=""><a href="module_datatype.html" title="datatype">datatype</a></li> |
|
|
842 |
<li class=""><a href="module_dd.html" title="dd">dd</a></li> |
|
|
843 |
<li class=""><a href="module_dom.html" title="dom">dom</a></li> |
|
|
844 |
<li class=""><a href="module_dump.html" title="dump">dump</a></li> |
|
|
845 |
<li class=""><a href="module_event.html" title="event">event</a></li> |
|
|
846 |
<li class=""><a href="module_event-custom.html" title="event-custom">event-custom</a></li> |
|
|
847 |
<li class=""><a href="module_event-simulate.html" title="event-simulate">event-simulate</a></li> |
|
|
848 |
<li class=""><a href="module_history.html" title="history">history</a></li> |
|
|
849 |
<li class=""><a href="module_imageloader.html" title="imageloader">imageloader</a></li> |
|
|
850 |
<li class=""><a href="module_io.html" title="io">io</a></li> |
|
|
851 |
<li class=""><a href="module_json.html" title="json">json</a></li> |
|
|
852 |
<li class=""><a href="module_node.html" title="node">node</a></li> |
|
|
853 |
<li class=""><a href="module_node-focusmanager.html" title="node-focusmanager">node-focusmanager</a></li> |
|
|
854 |
<li class=""><a href="module_node-menunav.html" title="node-menunav">node-menunav</a></li> |
|
|
855 |
<li class=""><a href="module_oop.html" title="oop">oop</a></li> |
|
|
856 |
<li class=""><a href="module_overlay.html" title="overlay">overlay</a></li> |
|
|
857 |
<li class=""><a href="module_plugin.html" title="plugin">plugin</a></li> |
|
|
858 |
<li class=""><a href="module_profiler.html" title="profiler">profiler</a></li> |
|
|
859 |
<li class=""><a href="module_queue-promote.html" title="queue-promote">queue-promote</a></li> |
|
|
860 |
<li class=""><a href="module_slider.html" title="slider">slider</a></li> |
|
|
861 |
<li class=""><a href="module_stylesheet.html" title="stylesheet">stylesheet</a></li> |
|
|
862 |
<li class=""><a href="module_substitute.html" title="substitute">substitute</a></li> |
|
|
863 |
<li class=""><a href="module_test.html" title="test">test</a></li> |
|
|
864 |
<li class=""><a href="module_widget.html" title="widget">widget</a></li> |
|
|
865 |
<li class=""><a href="module_widget-position.html" title="widget-position">widget-position</a></li> |
|
|
866 |
<li class=""><a href="module_widget-position-ext.html" title="widget-position-ext">widget-position-ext</a></li> |
|
|
867 |
<li class=""><a href="module_widget-stack.html" title="widget-stack">widget-stack</a></li> |
|
|
868 |
<li class=""><a href="module_widget-stdmod.html" title="widget-stdmod">widget-stdmod</a></li> |
|
|
869 |
<li class=""><a href="module_yui.html" title="yui">yui</a></li> |
|
|
870 |
</ul> |
|
|
871 |
</div> |
|
|
872 |
|
|
|
873 |
<div id="classList" class="module"> |
|
|
874 |
<h4>Classes</h4> |
|
|
875 |
<ul class="content"> |
|
|
876 |
<li class="selected"><a href="YUI~array~extras.html" title="YUI~array~extras">YUI~array~extras</a></li> |
|
|
877 |
</ul> |
|
|
878 |
</div> |
|
|
879 |
|
|
|
880 |
<div id="fileList" class="module"> |
|
|
881 |
<h4>Files</h4> |
|
|
882 |
<ul class="content"> |
|
|
883 |
<li class=""><a href="array-extras.js.html" title="array-extras.js">array-extras.js</a></li> |
|
|
884 |
</ul> |
|
|
885 |
</div> |
|
|
886 |
|
|
|
887 |
<div id="propertyList" class="module"> |
|
|
888 |
<h4>Properties</h4> |
|
|
889 |
<ul class="content"> |
|
|
890 |
<li class=""><a href="#property_lastIndexOf" title="lastIndexOf">lastIndexOf</a></li> |
|
|
891 |
</ul> |
|
|
892 |
</div> |
|
|
893 |
|
|
|
894 |
<div id="methodsList" class="module"> |
|
|
895 |
<h4>Methods</h4> |
|
|
896 |
<ul class="content"> |
|
|
897 |
<li class=""><a href="#method_Array.every" title="Array.every">Array.every</a></li> |
|
|
898 |
<li class=""><a href="#method_Array.filter" title="Array.filter">Array.filter</a></li> |
|
|
899 |
<li class=""><a href="#method_Array.find" title="Array.find">Array.find</a></li> |
|
|
900 |
<li class=""><a href="#method_Array.grep" title="Array.grep">Array.grep</a></li> |
|
|
901 |
<li class=""><a href="#method_Array.map" title="Array.map">Array.map</a></li> |
|
|
902 |
<li class=""><a href="#method_Array.partition" title="Array.partition">Array.partition</a></li> |
|
|
903 |
<li class=""><a href="#method_Array.reduce" title="Array.reduce">Array.reduce</a></li> |
|
|
904 |
<li class=""><a href="#method_Array.reject" title="Array.reject">Array.reject</a></li> |
|
|
905 |
<li class=""><a href="#method_Array.unique" title="Array.unique">Array.unique</a></li> |
|
|
906 |
<li class=""><a href="#method_Array.zip" title="Array.zip">Array.zip</a></li> |
|
|
907 |
</ul> |
|
|
908 |
</div> |
|
|
909 |
|
|
|
910 |
|
|
|
911 |
|
|
|
912 |
</div> |
|
|
913 |
</div> |
|
|
914 |
</div> |
|
|
915 |
<div id="ft"> |
|
|
916 |
<hr /> |
|
|
917 |
Copyright © 2009 Yahoo! Inc. All rights reserved. |
|
|
918 |
</div> |
|
|
919 |
</div> |
|
|
920 |
<script type="text/javascript"> |
|
|
921 |
ALL_YUI_PROPS = [{"access": "", "host": "YUI~array~extras", "name": "Array.every", "url": "YUI~array~extras.html#method_Array.every", "type": "method"}, {"access": "", "host": "YUI~array~extras", "name": "Array.filter", "url": "YUI~array~extras.html#method_Array.filter", "type": "method"}, {"access": "", "host": "YUI~array~extras", "name": "Array.find", "url": "YUI~array~extras.html#method_Array.find", "type": "method"}, {"access": "", "host": "YUI~array~extras", "name": "Array.grep", "url": "YUI~array~extras.html#method_Array.grep", "type": "method"}, {"access": "", "host": "YUI~array~extras", "name": "Array.map", "url": "YUI~array~extras.html#method_Array.map", "type": "method"}, {"access": "", "host": "YUI~array~extras", "name": "Array.partition", "url": "YUI~array~extras.html#method_Array.partition", "type": "method"}, {"access": "", "host": "YUI~array~extras", "name": "Array.reduce", "url": "YUI~array~extras.html#method_Array.reduce", "type": "method"}, {"access": "", "host": "YUI~array~extras", "name": "Array.reject", "url": "YUI~array~extras.html#method_Array.reject", "type": "method"}, {"access": "", "host": "YUI~array~extras", "name": "Array.unique", "url": "YUI~array~extras.html#method_Array.unique", "type": "method"}, {"access": "", "host": "YUI~array~extras", "name": "Array.zip", "url": "YUI~array~extras.html#method_Array.zip", "type": "method"}, {"access": "", "host": "YUI~array~extras", "name": "lastIndexOf", "url": "YUI~array~extras.html#property_lastIndexOf", "type": "property"}]; |
|
|
922 |
</script> |
|
|
923 |
</body> |
|
|
924 |
</html> |