2 YUI 3.13.0 (build 508226d)
3 Copyright 2013 Yahoo! Inc. All rights reserved.
4 Licensed under the BSD License.
5 http://yuilibrary.com/license/
8 YUI.add('array-invoke', function (Y, NAME) {
12 @submodule array-invoke
16 Executes a named method on each item in an array of objects. Items in the array
17 that do not have a function by that name will be skipped.
21 Y.Array.invoke(arrayOfDrags, 'plug', Y.Plugin.DDProxy);
24 @param {Array} items Array of objects supporting the named method.
25 @param {String} name the name of the method to execute on each item.
26 @param {Any} [args*] Any number of additional args are passed as parameters to
27 the execution of the named method.
28 @return {Array} All return values, indexed according to the item index.
32 Y.Array.invoke = function(items, name) {
33 var args = Y.Array(arguments, 2, true),
34 isFunction = Y.Lang.isFunction,
37 Y.Array.each(Y.Array(items), function(item, i) {
38 if (item && isFunction(item[name])) {
39 ret[i] = item[name].apply(item, args);
47 }, '3.13.0', {"requires": ["yui-base"]});