Upgrade to ExtJS 4.0.0 - Released 04/26/2011
[extjs.git] / docs / api / Ext.Array.html
1 <!DOCTYPE html><html><head><title>Ext.Array | Ext JS 4.0 Documentation</title><script type="text/javascript" src="../ext-all.js"></script><link rel="stylesheet" href="../reset.css" type="text/css"><link rel="stylesheet" href="../scrollbars.css" type="text/css"><link rel="stylesheet" href="../docs.css" type="text/css"><link id="styleCss" rel="stylesheet" href="../style.css" type="text/css"><script type="text/javascript" src="../prettify.js"></script><link rel="stylesheet" href="../prettify.css" type="text/css"><!-- link(rel: 'stylesheet', href: req.baseURL + '/css/ext4.css', type: 'text/css')--><link rel="shortcut icon" type="image/ico" href="../favicon.ico"><!--[if IE]>
2 <style type="text/css">.head-band { display: none; }
3 .header { border: 0; top: 0; left: 0px; background: url(../header.gif) repeat-x; }
4 .doc-tab .members .member a.more { background-color: #efefef; }
5 </style><link rel="stylesheet" href="/new/css/ie.css" type="text/css"><![endif]-->
6 </head><body id="ext-body" class="iScroll"><div id="notice" class="notice">For up to date documentation and features, visit 
7 <a href="http://docs.sencha.com/ext-js/4-0">http://docs.sencha.com/ext-js/4-0</a></div><div class="wrapper"><div class="head-band"></div><div class="header"><h2><a href="../index.html">Sencha Documentation</a></h2></div><div id="search"><form><input type="text" placeholder="Search" id="search-field" autocomplete="off" name="q"></form><div id="search-box"></div></div><div id="treePanel"></div><div id="container"><script type="text/javascript">
8
9     req = {
10         liveURL: '.',
11         standAloneMode: true,
12         origDocClass: 'Ext.Array',
13         docClass: 'Ext.Array',
14         docReq: 'Ext.Array',
15         version: '4.0',
16         baseURL: '.',
17         baseDocURL: '.',
18         baseProdURL: '.'
19     };
20
21     clsInfo = {};
22
23
24
25 </script>
26
27 <script type="text/javascript" src="../search.js"></script>
28 <!--script type="text/javascript" src="/new/javascripts/app/examples.js"></script-->
29 <script type="text/javascript" src="../class_tree.js"></script>
30 <script type="text/javascript" src="../class_doc.js"></script>
31 <script type="text/javascript">
32     req.source = 'Array2.html#Ext-Array';
33     clsInfo = {"methods":["clean","clone","contains","difference","every","filter","flatten","forEach","from","include","indexOf","intersect","map","max","mean","merge","min","pluck","remove","some","sort","sum","toArray","union","unique"],"cfgs":[],"properties":[],"events":[],"subclasses":[]};
34     Ext.onReady(function() {
35         Ext.create('Docs.classPanel');
36     });
37 </script><div id="top-block" class="top-block"><h1 id="clsTitle" class="cls"><a href="../source/Array2.html#Ext-Array" target="_blank">Ext.Array</a></h1></div><div id="docContent"><div id="doc-overview-content"><div class="lft"><p>A set of useful static methods to deal with arrays; provide missing methods for older browsers.</p>
38 <div class="members"><div class="m-methods"><a name="methods"></a><div class="definedBy">Defined By</div><h3 class="mth p">Methods</h3><div id="method-clean" class="member f ni"><a href="Ext.Array.html#method-clean" rel="method-clean" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.Array.html" class="definedIn docClass">Ext.Array</a><br/><a href="../source/Array2.html#Ext-Array-method-clean" class="viewSource">view source</a></div><a name="clean"></a><a name="method-clean"></a><a href="Ext.Array.html#" rel="method-clean" class="cls expand">clean</a>(
39 <span class="pre">Array array</span>)
40  : Array</div><div class="description"><div class="short"><p>Filter through an array and remove empty item as defined in <a href="Ext.html#isEmpty" rel="Ext#isEmpty" class="docClass">Ext.isEmpty</a></p>
41
42 <p>@see Ext.Array.filter</p>
43 </div><div class="long"><p>Filter through an array and remove empty item as defined in <a href="Ext.html#isEmpty" rel="Ext#isEmpty" class="docClass">Ext.isEmpty</a></p>
44
45 <p>@see Ext.Array.filter</p>
46 <h3 class="pa">Parameters</h3><ul><li><span class="pre">array</span> : Array<div class="sub-desc">
47 </div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">Array</span>&nbsp; &nbsp;<p>results</p>
48 </li></ul></div></div></div><div id="method-clone" class="member ni"><a href="Ext.Array.html#method-clone" rel="method-clone" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.Array.html" class="definedIn docClass">Ext.Array</a><br/><a href="../source/Array2.html#Ext-Array-method-clone" class="viewSource">view source</a></div><a name="clone"></a><a name="method-clone"></a><a href="Ext.Array.html#" rel="method-clone" class="cls expand">clone</a>(
49 <span class="pre">Array array</span>)
50  : Array</div><div class="description"><div class="short">Clone a flat array without referencing the previous one. Note that this is different
51 from Ext.clone since it doesn't ...</div><div class="long"><p>Clone a flat array without referencing the previous one. Note that this is different
52 from Ext.clone since it doesn't handle recursive cloning. It's simply a convenient, easy-to-remember method
53 for Array.prototype.slice.call(array)</p>
54 <h3 class="pa">Parameters</h3><ul><li><span class="pre">array</span> : Array<div class="sub-desc"><p>The array</p>
55 </div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">Array</span>&nbsp; &nbsp;<p>The clone array</p>
56 </li></ul></div></div></div><div id="method-contains" class="member ni"><a href="Ext.Array.html#method-contains" rel="method-contains" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.Array.html" class="definedIn docClass">Ext.Array</a><br/><a href="../source/Array2.html#Ext-Array-method-contains" class="viewSource">view source</a></div><a name="contains"></a><a name="method-contains"></a><a href="Ext.Array.html#" rel="method-contains" class="cls expand">contains</a>(
57 <span class="pre">Array array, Mixed item</span>)
58  : Boolean</div><div class="description"><div class="short"><p>Checks whether or not the given <code>array</code> contains the specified <code>item</code></p>
59 </div><div class="long"><p>Checks whether or not the given <code>array</code> contains the specified <code>item</code></p>
60 <h3 class="pa">Parameters</h3><ul><li><span class="pre">array</span> : Array<div class="sub-desc"><p>The array to check</p>
61 </div></li><li><span class="pre">item</span> : Mixed<div class="sub-desc"><p>The item to look for</p>
62 </div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">Boolean</span>&nbsp; &nbsp;<p>True if the array contains the item, false otherwise</p>
63 </li></ul></div></div></div><div id="method-difference" class="member ni"><a href="Ext.Array.html#method-difference" rel="method-difference" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.Array.html" class="definedIn docClass">Ext.Array</a><br/><a href="../source/Array2.html#Ext-Array-method-difference" class="viewSource">view source</a></div><a name="difference"></a><a name="method-difference"></a><a href="Ext.Array.html#" rel="method-difference" class="cls expand">difference</a>(
64 <span class="pre">Array array, Array array</span>)
65  : Array</div><div class="description"><div class="short"><p>Perform a set difference A-B by subtracting all items in array B from array A.</p>
66 </div><div class="long"><p>Perform a set difference A-B by subtracting all items in array B from array A.</p>
67 <h3 class="pa">Parameters</h3><ul><li><span class="pre">array</span> : Array<div class="sub-desc"><p>A</p>
68 </div></li><li><span class="pre">array</span> : Array<div class="sub-desc"><p>B</p>
69 </div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">Array</span>&nbsp; &nbsp;<p>difference</p>
70 </li></ul></div></div></div><div id="method-every" class="member ni"><a href="Ext.Array.html#method-every" rel="method-every" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.Array.html" class="definedIn docClass">Ext.Array</a><br/><a href="../source/Array2.html#Ext-Array-method-every" class="viewSource">view source</a></div><a name="every"></a><a name="method-every"></a><a href="Ext.Array.html#" rel="method-every" class="cls expand">every</a>(
71 <span class="pre">Array array, Function fn, Object scope</span>)
72  : Boolean</div><div class="description"><div class="short">Executes the specified function for each array element until the function returns a falsy value.
73 If such an item is f...</div><div class="long"><p>Executes the specified function for each array element until the function returns a falsy value.
74 If such an item is found, the function will return false immediately.
75 Otherwise, it will return true.</p>
76 <h3 class="pa">Parameters</h3><ul><li><span class="pre">array</span> : Array<div class="sub-desc">
77 </div></li><li><span class="pre">fn</span> : Function<div class="sub-desc"><p>Callback function for each item</p>
78 </div></li><li><span class="pre">scope</span> : Object<div class="sub-desc"><p>Callback function scope</p>
79 </div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">Boolean</span>&nbsp; &nbsp;<p>True if no false value is returned by the callback function.</p>
80 </li></ul></div></div></div><div id="method-filter" class="member ni"><a href="Ext.Array.html#method-filter" rel="method-filter" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.Array.html" class="definedIn docClass">Ext.Array</a><br/><a href="../source/Array2.html#Ext-Array-method-filter" class="viewSource">view source</a></div><a name="filter"></a><a name="method-filter"></a><a href="Ext.Array.html#" rel="method-filter" class="cls expand">filter</a>(
81 <span class="pre">Array array, Function fn, Object scope</span>)
82  : Array</div><div class="description"><div class="short"><p>Creates a new array with all of the elements of this array for which
83 the provided filtering function returns true.</p>
84 </div><div class="long"><p>Creates a new array with all of the elements of this array for which
85 the provided filtering function returns true.</p>
86 <h3 class="pa">Parameters</h3><ul><li><span class="pre">array</span> : Array<div class="sub-desc">
87 </div></li><li><span class="pre">fn</span> : Function<div class="sub-desc"><p>Callback function for each item</p>
88 </div></li><li><span class="pre">scope</span> : Object<div class="sub-desc"><p>Callback function scope</p>
89 </div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">Array</span>&nbsp; &nbsp;<p>results</p>
90 </li></ul></div></div></div><div id="method-flatten" class="member ni"><a href="Ext.Array.html#method-flatten" rel="method-flatten" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.Array.html" class="definedIn docClass">Ext.Array</a><br/><a href="../source/Array2.html#Ext-Array-method-flatten" class="viewSource">view source</a></div><a name="flatten"></a><a name="method-flatten"></a><a href="Ext.Array.html#" rel="method-flatten" class="cls expand">flatten</a>(
91 <span class="pre">Array array</span>)
92  : Array</div><div class="description"><div class="short"><p>Recursively flattens into 1-d Array. Injects Arrays inline.</p>
93 </div><div class="long"><p>Recursively flattens into 1-d Array. Injects Arrays inline.</p>
94 <h3 class="pa">Parameters</h3><ul><li><span class="pre">array</span> : Array<div class="sub-desc"><p>The array to flatten</p>
95 </div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">Array</span>&nbsp; &nbsp;<p>The new, flattened array.</p>
96 </li></ul></div></div></div><div id="method-forEach" class="member ni"><a href="Ext.Array.html#method-forEach" rel="method-forEach" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.Array.html" class="definedIn docClass">Ext.Array</a><br/><a href="../source/Array2.html#Ext-Array-method-forEach" class="viewSource">view source</a></div><a name="forEach"></a><a name="method-forEach"></a><a href="Ext.Array.html#" rel="method-forEach" class="cls expand">forEach</a>(
97 <span class="pre">Array array, Function fn, Object scope</span>)
98  : void</div><div class="description"><div class="short">Iterates an array and invoke the given callback function for each item. Note that this will simply
99 delegate to the na...</div><div class="long"><p>Iterates an array and invoke the given callback function for each item. Note that this will simply
100 delegate to the native Array.prototype.forEach method if supported.
101 It doesn't support stopping the iteration by returning false in the callback function like
102 <a href="Ext.Array.html#each" rel="Ext.Array#each" class="docClass">each</a>. However, performance could be much better in modern browsers comparing with
103 <a href="Ext.Array.html#each" rel="Ext.Array#each" class="docClass">each</a></p>
104 <h3 class="pa">Parameters</h3><ul><li><span class="pre">array</span> : Array<div class="sub-desc"><p>The array to iterate</p>
105 </div></li><li><span class="pre">fn</span> : Function<div class="sub-desc"><p>The function callback, to be invoked these arguments:</p>
106
107 <ul>
108 <li><code>item</code>: {Mixed} The item at the current <code>index</code> in the passed <code>array</code></li>
109 <li><code>index</code>: {Number} The current <code>index</code> within the <code>array</code></li>
110 <li><code>allItems</code>: {Array} The <code>array</code> itself which was passed as the first argument</li>
111 </ul>
112
113 </div></li><li><span class="pre">scope</span> : Object<div class="sub-desc"><p>(Optional) The execution scope (<code>this</code>) in which the specified function is executed.</p>
114 </div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">void</span>&nbsp; &nbsp;
115 </li></ul></div></div></div><div id="method-from" class="member ni"><a href="Ext.Array.html#method-from" rel="method-from" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.Array.html" class="definedIn docClass">Ext.Array</a><br/><a href="../source/Array2.html#Ext-Array-method-from" class="viewSource">view source</a></div><a name="from"></a><a name="method-from"></a><a href="Ext.Array.html#" rel="method-from" class="cls expand">from</a>(
116 <span class="pre">Array/Mixed value, Boolean newReference</span>)
117  : Array</div><div class="description"><div class="short">Converts a value to an array if it's not already an array; returns:
118
119
120 An empty array if given value is undefined or n...</div><div class="long"><p>Converts a value to an array if it's not already an array; returns:</p>
121
122 <ul>
123 <li>An empty array if given value is <code>undefined</code> or <code>null</code></li>
124 <li>Itself if given value is already an array</li>
125 <li>An array copy if given value is <a href="Ext.html#isIterable" rel="Ext#isIterable" class="docClass">iterable</a> (arguments, NodeList and alike)</li>
126 <li>An array with one item which is the given value, otherwise</li>
127 </ul>
128
129 <h3 class="pa">Parameters</h3><ul><li><span class="pre">value</span> : Array/Mixed<div class="sub-desc"><p>The value to convert to an array if it's not already is an array</p>
130 </div></li><li><span class="pre">newReference</span> : Boolean<div class="sub-desc"><p>(Optional) newReference True to clone the given array and return a new reference if necessary,
131 defaults to false</p>
132 </div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">Array</span>&nbsp; &nbsp;<p>array</p>
133 </li></ul></div></div></div><div id="method-include" class="member ni"><a href="Ext.Array.html#method-include" rel="method-include" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.Array.html" class="definedIn docClass">Ext.Array</a><br/><a href="../source/Array2.html#Ext-Array-method-include" class="viewSource">view source</a></div><a name="include"></a><a name="method-include"></a><a href="Ext.Array.html#" rel="method-include" class="cls expand">include</a>(
134 <span class="pre">Array array, Mixed item</span>)
135  : Array</div><div class="description"><div class="short"><p>Push an item into the array only if the array doesn't contain it yet</p>
136 </div><div class="long"><p>Push an item into the array only if the array doesn't contain it yet</p>
137 <h3 class="pa">Parameters</h3><ul><li><span class="pre">array</span> : Array<div class="sub-desc"><p>The array</p>
138 </div></li><li><span class="pre">item</span> : Mixed<div class="sub-desc"><p>The item to include</p>
139 </div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">Array</span>&nbsp; &nbsp;<p>The passed array itself</p>
140 </li></ul></div></div></div><div id="method-indexOf" class="member ni"><a href="Ext.Array.html#method-indexOf" rel="method-indexOf" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.Array.html" class="definedIn docClass">Ext.Array</a><br/><a href="../source/Array2.html#Ext-Array-method-indexOf" class="viewSource">view source</a></div><a name="indexOf"></a><a name="method-indexOf"></a><a href="Ext.Array.html#" rel="method-indexOf" class="cls expand">indexOf</a>(
141 <span class="pre">Array array, Mixed item, Number from</span>)
142  : Number</div><div class="description"><div class="short">Get the index of the provided item in the given array, a supplement for the
143 missing arrayPrototype.indexOf in Interne...</div><div class="long"><p>Get the index of the provided <code>item</code> in the given <code>array</code>, a supplement for the
144 missing arrayPrototype.indexOf in Internet Explorer.</p>
145 <h3 class="pa">Parameters</h3><ul><li><span class="pre">array</span> : Array<div class="sub-desc"><p>The array to check</p>
146 </div></li><li><span class="pre">item</span> : Mixed<div class="sub-desc"><p>The item to look for</p>
147 </div></li><li><span class="pre">from</span> : Number<div class="sub-desc"><p>(Optional) The index at which to begin the search</p>
148 </div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">Number</span>&nbsp; &nbsp;<p>The index of item in the array (or -1 if it is not found)</p>
149 </li></ul></div></div></div><div id="method-intersect" class="member ni"><a href="Ext.Array.html#method-intersect" rel="method-intersect" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.Array.html" class="definedIn docClass">Ext.Array</a><br/><a href="../source/Array2.html#Ext-Array-method-intersect" class="viewSource">view source</a></div><a name="intersect"></a><a name="method-intersect"></a><a href="Ext.Array.html#" rel="method-intersect" class="cls expand">intersect</a>(
150 <span class="pre">Array array</span>)
151  : Array</div><div class="description"><div class="short"><p>Merge multiple arrays into one with unique items that exist in all of the arrays.</p>
152 </div><div class="long"><p>Merge multiple arrays into one with unique items that exist in all of the arrays.</p>
153 <h3 class="pa">Parameters</h3><ul><li><span class="pre">array</span> : Array<div class="sub-desc"><p>,...</p>
154 </div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">Array</span>&nbsp; &nbsp;<p>intersect</p>
155 </li></ul></div></div></div><div id="method-map" class="member ni"><a href="Ext.Array.html#method-map" rel="method-map" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.Array.html" class="definedIn docClass">Ext.Array</a><br/><a href="../source/Array2.html#Ext-Array-method-map" class="viewSource">view source</a></div><a name="map"></a><a name="method-map"></a><a href="Ext.Array.html#" rel="method-map" class="cls expand">map</a>(
156 <span class="pre">Array array, Function fn, Object scope</span>)
157  : Array</div><div class="description"><div class="short"><p>Creates a new array with the results of calling a provided function on every element in this array.</p>
158 </div><div class="long"><p>Creates a new array with the results of calling a provided function on every element in this array.</p>
159 <h3 class="pa">Parameters</h3><ul><li><span class="pre">array</span> : Array<div class="sub-desc">
160 </div></li><li><span class="pre">fn</span> : Function<div class="sub-desc"><p>Callback function for each item</p>
161 </div></li><li><span class="pre">scope</span> : Object<div class="sub-desc"><p>Callback function scope</p>
162 </div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">Array</span>&nbsp; &nbsp;<p>results</p>
163 </li></ul></div></div></div><div id="method-max" class="member ni"><a href="Ext.Array.html#method-max" rel="method-max" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.Array.html" class="definedIn docClass">Ext.Array</a><br/><a href="../source/Array2.html#Ext-Array-method-max" class="viewSource">view source</a></div><a name="max"></a><a name="method-max"></a><a href="Ext.Array.html#" rel="method-max" class="cls expand">max</a>(
164 <span class="pre">Array|NodeList array, [Function comparisonFn]</span>)
165  : Mixed</div><div class="description"><div class="short"><p>Returns the maximum value in the Array</p>
166 </div><div class="long"><p>Returns the maximum value in the Array</p>
167 <h3 class="pa">Parameters</h3><ul><li><span class="pre">array</span> : Array|NodeList<div class="sub-desc"><p>The Array from which to select the maximum value.</p>
168 </div></li><li><span class="pre">comparisonFn</span> : Function<div class="sub-desc"><p>(optional) a function to perform the comparision which determines maximization.</p>
169
170 <pre><code>              If omitted the "&gt;" operator will be used. Note: gt = 1; eq = 0; lt = -1
171 </code></pre>
172 </div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">Mixed</span>&nbsp; &nbsp;<p>maxValue The maximum value</p>
173 </li></ul></div></div></div><div id="method-mean" class="member ni"><a href="Ext.Array.html#method-mean" rel="method-mean" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.Array.html" class="definedIn docClass">Ext.Array</a><br/><a href="../source/Array2.html#Ext-Array-method-mean" class="viewSource">view source</a></div><a name="mean"></a><a name="method-mean"></a><a href="Ext.Array.html#" rel="method-mean" class="cls expand">mean</a>(
174 <span class="pre">Array array</span>)
175  : Number</div><div class="description"><div class="short"><p>Calculates the mean of all items in the array</p>
176 </div><div class="long"><p>Calculates the mean of all items in the array</p>
177 <h3 class="pa">Parameters</h3><ul><li><span class="pre">array</span> : Array<div class="sub-desc"><p>The Array to calculate the mean value of.</p>
178 </div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">Number</span>&nbsp; &nbsp;<p>The mean.</p>
179 </li></ul></div></div></div><div id="method-merge" class="member ni"><a href="Ext.Array.html#method-merge" rel="method-merge" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.Array.html" class="definedIn docClass">Ext.Array</a><br/><a href="../source/Array2.html#Ext-Array-method-merge" class="viewSource">view source</a></div><a name="merge"></a><a name="method-merge"></a><a href="Ext.Array.html#" rel="method-merge" class="cls expand">merge</a>(
180 <span class="pre">Array array</span>)
181  : Array</div><div class="description"><div class="short"><p>Merge multiple arrays into one with unique items. Alias to <a href="Ext.Array.html#union" rel="Ext.Array#union" class="docClass">union</a>.</p>
182 </div><div class="long"><p>Merge multiple arrays into one with unique items. Alias to <a href="Ext.Array.html#union" rel="Ext.Array#union" class="docClass">union</a>.</p>
183 <h3 class="pa">Parameters</h3><ul><li><span class="pre">array</span> : Array<div class="sub-desc"><p>,...</p>
184 </div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">Array</span>&nbsp; &nbsp;<p>merged</p>
185 </li></ul></div></div></div><div id="method-min" class="member ni"><a href="Ext.Array.html#method-min" rel="method-min" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.Array.html" class="definedIn docClass">Ext.Array</a><br/><a href="../source/Array2.html#Ext-Array-method-min" class="viewSource">view source</a></div><a name="min"></a><a name="method-min"></a><a href="Ext.Array.html#" rel="method-min" class="cls expand">min</a>(
186 <span class="pre">Array|NodeList array, [Function comparisonFn]</span>)
187  : Mixed</div><div class="description"><div class="short"><p>Returns the minimum value in the Array.</p>
188 </div><div class="long"><p>Returns the minimum value in the Array.</p>
189 <h3 class="pa">Parameters</h3><ul><li><span class="pre">array</span> : Array|NodeList<div class="sub-desc"><p>The Array from which to select the minimum value.</p>
190 </div></li><li><span class="pre">comparisonFn</span> : Function<div class="sub-desc"><p>(optional) a function to perform the comparision which determines minimization.</p>
191
192 <pre><code>              If omitted the "&lt;" operator will be used. Note: gt = 1; eq = 0; lt = -1
193 </code></pre>
194 </div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">Mixed</span>&nbsp; &nbsp;<p>minValue The minimum value</p>
195 </li></ul></div></div></div><div id="method-pluck" class="member ni"><a href="Ext.Array.html#method-pluck" rel="method-pluck" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.Array.html" class="definedIn docClass">Ext.Array</a><br/><a href="../source/Array2.html#Ext-Array-method-pluck" class="viewSource">view source</a></div><a name="pluck"></a><a name="method-pluck"></a><a href="Ext.Array.html#" rel="method-pluck" class="cls expand">pluck</a>(
196 <span class="pre">Array|NodeList array, String propertyName</span>)
197  : Array</div><div class="description"><div class="short">Plucks the value of a property from each item in the Array. Example:
198
199 Ext.Array.pluck(Ext.query("p"), "className"); /...</div><div class="long"><p>Plucks the value of a property from each item in the Array. Example:</p>
200
201 <pre><code>Ext.Array.pluck(Ext.query("p"), "className"); // [el1.className, el2.className, ..., elN.className]
202 </code></pre>
203 <h3 class="pa">Parameters</h3><ul><li><span class="pre">array</span> : Array|NodeList<div class="sub-desc"><p>The Array of items to pluck the value from.</p>
204 </div></li><li><span class="pre">propertyName</span> : String<div class="sub-desc"><p>The property name to pluck from each element.</p>
205 </div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">Array</span>&nbsp; &nbsp;<p>The value from each item in the Array.</p>
206 </li></ul></div></div></div><div id="method-remove" class="member ni"><a href="Ext.Array.html#method-remove" rel="method-remove" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.Array.html" class="definedIn docClass">Ext.Array</a><br/><a href="../source/Array2.html#Ext-Array-method-remove" class="viewSource">view source</a></div><a name="remove"></a><a name="method-remove"></a><a href="Ext.Array.html#" rel="method-remove" class="cls expand">remove</a>(
207 <span class="pre">Array array, Mixed item</span>)
208  : Array</div><div class="description"><div class="short"><p>Removes the specified item from the array if it exists</p>
209 </div><div class="long"><p>Removes the specified item from the array if it exists</p>
210 <h3 class="pa">Parameters</h3><ul><li><span class="pre">array</span> : Array<div class="sub-desc"><p>The array</p>
211 </div></li><li><span class="pre">item</span> : Mixed<div class="sub-desc"><p>The item to remove</p>
212 </div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">Array</span>&nbsp; &nbsp;<p>The passed array itself</p>
213 </li></ul></div></div></div><div id="method-some" class="member ni"><a href="Ext.Array.html#method-some" rel="method-some" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.Array.html" class="definedIn docClass">Ext.Array</a><br/><a href="../source/Array2.html#Ext-Array-method-some" class="viewSource">view source</a></div><a name="some"></a><a name="method-some"></a><a href="Ext.Array.html#" rel="method-some" class="cls expand">some</a>(
214 <span class="pre">Array array, Function fn, Object scope</span>)
215  : Boolean</div><div class="description"><div class="short">Executes the specified function for each array element until the function returns a truthy value.
216 If such an item is ...</div><div class="long"><p>Executes the specified function for each array element until the function returns a truthy value.
217 If such an item is found, the function will return true immediately. Otherwise, it will return false.</p>
218 <h3 class="pa">Parameters</h3><ul><li><span class="pre">array</span> : Array<div class="sub-desc">
219 </div></li><li><span class="pre">fn</span> : Function<div class="sub-desc"><p>Callback function for each item</p>
220 </div></li><li><span class="pre">scope</span> : Object<div class="sub-desc"><p>Callback function scope</p>
221 </div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">Boolean</span>&nbsp; &nbsp;<p>True if the callback function returns a truthy value.</p>
222 </li></ul></div></div></div><div id="method-sort" class="member ni"><a href="Ext.Array.html#method-sort" rel="method-sort" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.Array.html" class="definedIn docClass">Ext.Array</a><br/><a href="../source/Array2.html#Ext-Array-method-sort" class="viewSource">view source</a></div><a name="sort"></a><a name="method-sort"></a><a href="Ext.Array.html#" rel="method-sort" class="cls expand">sort</a>(
223 <span class="pre">Array array, [Function sortFn]</span>)
224  : Array</div><div class="description"><div class="short"><p>Sorts the elements of an Array.
225 By default, this method sorts the elements alphabetically and ascending.</p>
226 </div><div class="long"><p>Sorts the elements of an Array.
227 By default, this method sorts the elements alphabetically and ascending.</p>
228 <h3 class="pa">Parameters</h3><ul><li><span class="pre">array</span> : Array<div class="sub-desc"><p>The array to sort.</p>
229 </div></li><li><span class="pre">sortFn</span> : Function<div class="sub-desc"><p>(optional) The comparison function.</p>
230 </div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">Array</span>&nbsp; &nbsp;<p>The sorted array.</p>
231 </li></ul></div></div></div><div id="method-sum" class="member ni"><a href="Ext.Array.html#method-sum" rel="method-sum" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.Array.html" class="definedIn docClass">Ext.Array</a><br/><a href="../source/Array2.html#Ext-Array-method-sum" class="viewSource">view source</a></div><a name="sum"></a><a name="method-sum"></a><a href="Ext.Array.html#" rel="method-sum" class="cls expand">sum</a>(
232 <span class="pre">Array array</span>)
233  : Number</div><div class="description"><div class="short"><p>Calculates the sum of all items in the given array</p>
234 </div><div class="long"><p>Calculates the sum of all items in the given array</p>
235 <h3 class="pa">Parameters</h3><ul><li><span class="pre">array</span> : Array<div class="sub-desc"><p>The Array to calculate the sum value of.</p>
236 </div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">Number</span>&nbsp; &nbsp;<p>The sum.</p>
237 </li></ul></div></div></div><div id="method-toArray" class="member ni"><a href="Ext.Array.html#method-toArray" rel="method-toArray" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.Array.html" class="definedIn docClass">Ext.Array</a><br/><a href="../source/Array2.html#Ext-Array-method-toArray" class="viewSource">view source</a></div><a name="toArray"></a><a name="method-toArray"></a><a href="Ext.Array.html#" rel="method-toArray" class="cls expand">toArray</a>(
238 <span class="pre">Mixed iterable, Number start, Number end</span>)
239  : Array</div><div class="description"><div class="short">Converts any iterable (numeric indices and a length property) into a true array.
240
241 function test() {
242
243 var args = Ext.A...</div><div class="long"><p>Converts any iterable (numeric indices and a length property) into a true array.</p>
244
245 <p>function test() {</p>
246
247 <pre><code>var args = Ext.Array.toArray(arguments),
248     fromSecondToLastArgs = Ext.Array.toArray(arguments, 1);
249
250 alert(args.join(' '));
251 alert(fromSecondToLastArgs.join(' '));
252 </code></pre>
253
254 <p>}</p>
255
256 <p>test('just', 'testing', 'here'); // alerts 'just testing here';</p>
257
258 <pre><code>                             // alerts 'testing here';
259 </code></pre>
260
261 <p>Ext.Array.toArray(document.getElementsByTagName('div')); // will convert the NodeList into an array
262 Ext.Array.toArray('splitted'); // returns ['s', 'p', 'l', 'i', 't', 't', 'e', 'd']
263 Ext.Array.toArray('splitted', 0, 3); // returns ['s', 'p', 'l', 'i']</p>
264 <h3 class="pa">Parameters</h3><ul><li><span class="pre">iterable</span> : Mixed<div class="sub-desc"><p>the iterable object to be turned into a true Array.</p>
265 </div></li><li><span class="pre">start</span> : Number<div class="sub-desc"><p>(Optional) a zero-based index that specifies the start of extraction. Defaults to 0</p>
266 </div></li><li><span class="pre">end</span> : Number<div class="sub-desc"><p>(Optional) a zero-based index that specifies the end of extraction. Defaults to the last
267 index of the iterable value</p>
268 </div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">Array</span>&nbsp; &nbsp;<p>array</p>
269 </li></ul></div></div></div><div id="method-union" class="member ni"><a href="Ext.Array.html#method-union" rel="method-union" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.Array.html" class="definedIn docClass">Ext.Array</a><br/><a href="../source/Array2.html#Ext-Array-method-union" class="viewSource">view source</a></div><a name="union"></a><a name="method-union"></a><a href="Ext.Array.html#" rel="method-union" class="cls expand">union</a> : void</div><div class="description"><div class="short"><p>Alias to <a href="Ext.Array.html#merge" rel="Ext.Array#merge" class="docClass">merge</a>.</p>
270 </div><div class="long"><p>Alias to <a href="Ext.Array.html#merge" rel="Ext.Array#merge" class="docClass">merge</a>.</p>
271 <h3 class="pa">Returns</h3><ul><li><span class="pre">void</span>&nbsp; &nbsp;
272 </li></ul></div></div></div><div id="method-unique" class="member ni"><a href="Ext.Array.html#method-unique" rel="method-unique" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.Array.html" class="definedIn docClass">Ext.Array</a><br/><a href="../source/Array2.html#Ext-Array-method-unique" class="viewSource">view source</a></div><a name="unique"></a><a name="method-unique"></a><a href="Ext.Array.html#" rel="method-unique" class="cls expand">unique</a>(
273 <span class="pre">Array array</span>)
274  : Array</div><div class="description"><div class="short"><p>Returns a new array with unique items</p>
275 </div><div class="long"><p>Returns a new array with unique items</p>
276 <h3 class="pa">Parameters</h3><ul><li><span class="pre">array</span> : Array<div class="sub-desc">
277 </div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">Array</span>&nbsp; &nbsp;<p>results</p>
278 </li></ul></div></div></div></div></div></div></div><div id="pageContent"></div></div></div></div></body></html>