3 Methods for dealing with collections (Array or Objects).
7 ## contains(list, value):Boolean
9 Checks if collection contains value.
12 contains({a: 1, b: 2, c: 'bar'}, 2); // true
13 contains([1, 2, 3], 'foo'); // false
16 See: [array/contains](array.html#contains), [object/contains](object.html#contains)
20 ## every(list, callback, [thisObj]):Boolean
22 Tests whether all values in the collection pass the test implemented by the
33 every(obj, isNumber); // false
36 See: [array/every](array.html#every), [object/every](object.html#every)
40 ## filter(list, callback, [thisObj]):Array
42 Filter collection properties.
44 See: [array/filter](array.html#filter), [object/filter](object.html#filter)
48 ## find(list, callback, [thisObj]):*
50 Loops through all the values in the collection and returns the first one that
51 passes a truth test (callback).
53 **Important:** loop order over objects properties isn't guaranteed to be the
54 same on all environments.
57 find({a: 'foo', b: 12}, isString); // 'foo'
58 find(['foo', 12], isNumber); // 12
61 See: [array/find](array.html#find), [object/find](object.html#find)
65 ## forEach(list, callback, [thisObj])
67 Loop through all values of the collection.
69 See: [array/forEach](array.html#forEach), [object/forOwn](object.html#forOwn)
73 ## map(list, callback, [thisObj]):Array
75 Returns a new collection where the properties values are the result of calling
76 the callback for each property in the original collection.
78 See: [array/map](array.html#map), [object/map](object.html#map)
82 ## max(list, [iterator]):*
84 Returns maximum value inside collection or use a custom iterator to define how
85 items should be compared.
87 See: [`min()`](#min), [array/max](array.html#max), [object/max](object.html#max)
90 max({a: 100, b: 2, c: 1, d: 3, e: 200}); // 200
91 max(['foo', 'lorem', 'amet'], function(val){
98 ## min(list, [iterator]):*
100 Returns minimum value inside collection or use a custom iterator to define how
101 items should be compared.
103 See: [`max()`](#max), [array/min](array.html#min), [object/min](object.html#min)
106 min([10, 2, 7]); // 2
107 min({a: 'foo', b: 'lorem', c: 'amet'}, function(val){
114 ## pluck(list, propName):Array
116 Extract a list of property values.
130 pluck(users, 'name'); // ["John", "Jane"]
131 pluck(users, 'age'); // [21, 27]
144 pluck(users, 'name'); // ['John', 'Mary']
147 See: [array/pluck](array.html#pluck), [object/pluck](object.html#pluck)
151 ## reduce(list, callback, initial, [thisObj]):*
153 Apply a function against an accumulator and each value in the collection as to
154 reduce it to a single value.
157 var obj = {a: 1, b: 2, c: 3, d: 4};
159 function sum(prev, cur, key, list) {
163 reduce(obj, sum); // 10
166 See: [array/reduce](array.html#reduce), [object/reduce](object.html#reduce)
170 ## reject(list, fn, [thisObj]):Array
172 Creates a new array with all the elements that do **not** pass the truth test.
173 Opposite of [`filter()`](#filter).
178 var numbers = [1, 2, 3, 4, 5];
179 reject(numbers, function(x) { return (x % 2) !== 0; }); // [2, 4]
181 var obj = {a: 1, b: 2, c: 3, d: 4, e: 5};
182 reject(obj, function(x) { return (x % 2) !== 0; }); // [2, 4]
185 See: [array/reject](array.html#reject), [object/reject](object.html#reject)
191 Returns the number of values in the collection.
204 See: [object/size](object.html#size)
208 ## some(list, callback, [thisObj]):Boolean
210 Tests whether any values in the collection pass the test implemented by the
221 some(obj, isNumber); // true
222 some(obj, isString); // true
223 some([1, 2, 3], isNumber) // true
224 some([1, 2, 3], isString) // false
227 See: [array/some](array.html#some), [object/some](object.html#some)
230 -------------------------------------------------------------------------------
232 For more usage examples check specs inside `/tests` folder. Unit tests are the
233 best documentation you can get...