Added the underscore node_module.
All checks were successful
Auto Maintenance Cycle / pre-commit Autoupdate (push) Successful in 39s
All checks were successful
Auto Maintenance Cycle / pre-commit Autoupdate (push) Successful in 39s
This commit is contained in:
28
node_modules/underscore/amd/invoke.js
generated
vendored
Normal file
28
node_modules/underscore/amd/invoke.js
generated
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
define(['./restArguments', './isFunction', './map', './_deepGet', './_toPath'], function (restArguments, isFunction, map, _deepGet, _toPath) {
|
||||
|
||||
// Invoke a method (with arguments) on every item in a collection.
|
||||
var invoke = restArguments(function(obj, path, args) {
|
||||
var contextPath, func;
|
||||
if (isFunction(path)) {
|
||||
func = path;
|
||||
} else {
|
||||
path = _toPath(path);
|
||||
contextPath = path.slice(0, -1);
|
||||
path = path[path.length - 1];
|
||||
}
|
||||
return map(obj, function(context) {
|
||||
var method = func;
|
||||
if (!method) {
|
||||
if (contextPath && contextPath.length) {
|
||||
context = _deepGet(context, contextPath);
|
||||
}
|
||||
if (context == null) return void 0;
|
||||
method = context[path];
|
||||
}
|
||||
return method == null ? method : method.apply(context, args);
|
||||
});
|
||||
});
|
||||
|
||||
return invoke;
|
||||
|
||||
});
|
Reference in New Issue
Block a user