1234567891011121314151617181920212223242526272829303132333435363738394041 |
- var apply = require('./_apply'),
- baseEach = require('./_baseEach'),
- baseInvoke = require('./_baseInvoke'),
- baseRest = require('./_baseRest'),
- isArrayLike = require('./isArrayLike');
- var invokeMap = baseRest(function(collection, path, args) {
- var index = -1,
- isFunc = typeof path == 'function',
- result = isArrayLike(collection) ? Array(collection.length) : [];
- baseEach(collection, function(value) {
- result[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args);
- });
- return result;
- });
- module.exports = invokeMap;
|