* Creates an array of values by running each element in the collection * through the callback. The callback is bound to `thisArg` and invoked with * three arguments; (value, index|key, collection). * * If a property name is provided for `callback` the created "_.pluck" style
(collection, callback, thisArg)
| 38632 | * // => ['barney', 'fred'] |
| 38633 | */ |
| 38634 | function map(collection, callback, thisArg) { |
| 38635 | var index = -1, |
| 38636 | length = collection ? collection.length : 0; |
| 38637 | |
| 38638 | callback = lodash.createCallback(callback, thisArg, 3); |
| 38639 | if (typeof length == 'number') { |
| 38640 | var result = Array(length); |
| 38641 | while (++index < length) { |
| 38642 | result[index] = callback(collection[index], index, collection); |
| 38643 | } |
| 38644 | } else { |
| 38645 | result = []; |
| 38646 | forOwn(collection, function(value, key, collection) { |
| 38647 | result[++index] = callback(value, key, collection); |
| 38648 | }); |
| 38649 | } |
| 38650 | return result; |
| 38651 | } |
| 38652 | |
| 38653 | /** |
| 38654 | * Retrieves the maximum value of a collection. If the collection is empty or |
no test coverage detected