1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | 1 1 3 3 6 3 1 | define(['./forEach'], function (forEach) { /** * Call `methodName` on each item of the array passing custom arguments if * needed. */ function invoke(arr, methodName, var_args){ var args = Array.prototype.slice.call(arguments, 2); forEach(arr, function(item){ item[methodName].apply(item, args); }); return arr; } return invoke; }); |