3 Copyright 2012 Yahoo! Inc. All rights reserved.
4 Licensed under the BSD License.
5 http://yuilibrary.com/license/
7 YUI.add('arraylist-filter', function(Y) {
10 * Collection utilities beyond what is provided in the YUI core
12 * @submodule arraylist-filter
13 * @deprecated Use ModelList or a custom subclass implementation
17 * Adds filter method to ArrayList prototype
19 Y.mix(Y.ArrayList.prototype, {
22 * <p>Create a new ArrayList (or augmenting class instance) from a subset
23 * of items as determined by the boolean function passed as the
24 * argument. The original ArrayList is unchanged.</p>
26 * <p>The validator signature is <code>validator( item )</code>.</p>
29 * @param { Function } validator Boolean function to determine in or out.
30 * @return { ArrayList } New instance based on who passed the validator.
32 * @deprecated Use ModelList or a custom subclass implementation
34 filter: function(validator) {
37 Y.Array.each(this._items, function(item, i) {
40 if (validator(item)) {
45 return new this.constructor(items);
51 }, '3.5.0' ,{requires:['arraylist']});