[ Index ] |
PHP Cross Reference of Unnamed Project |
[Summary view] [Print] [Text view]
1 /* 2 YUI 3.17.2 (build 9c3c78e) 3 Copyright 2014 Yahoo! Inc. All rights reserved. 4 Licensed under the BSD License. 5 http://yuilibrary.com/license/ 6 */ 7 8 YUI.add('array-invoke', function (Y, NAME) { 9 10 /** 11 @module collection 12 @submodule array-invoke 13 */ 14 15 /** 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. 18 19 @example 20 21 Y.Array.invoke(arrayOfDrags, 'plug', Y.Plugin.DDProxy); 22 23 @method invoke 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. 29 @static 30 @for Array 31 **/ 32 Y.Array.invoke = function(items, name) { 33 var args = Y.Array(arguments, 2, true), 34 isFunction = Y.Lang.isFunction, 35 ret = []; 36 37 Y.Array.each(Y.Array(items), function(item, i) { 38 if (item && isFunction(item[name])) { 39 ret[i] = item[name].apply(item, args); 40 } 41 }); 42 43 return ret; 44 }; 45 46 47 }, '3.17.2', {"requires": ["yui-base"]});
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Thu Aug 11 10:00:09 2016 | Cross-referenced by PHPXref 0.7.1 |