demos/Collage/fabric.js
function invoke(array, method) {
    var args = slice.call(arguments, 2), result = [ ];
    for (var i = 0, len = array.length; i < len; i++) {
      result[i] = args.length ? array[i][method].apply(array[i], args) : array[i][method].call(array[i]);
    }
    return result;
  }
function invoke(array, method) {
    var args = slice.call(arguments, 2), result = [ ];
    for (var i = 0, len = array.length; i < len; i++) {
      result[i] = args.length ? array[i][method].apply(array[i], args) : array[i][method].call(array[i]);
    }
    return result;
  }
function invoke ( array , method ) { var args = slice . call ( arguments , 2 ) , result = [ ] ; for ( var i = 0 , len = array . length ; i < len ; i ++ ) { result [ i ] = args . length ? array [ i ] [ method ] . apply ( array [ i ] , args ) : array [ i ] [ method ] . call ( array [ i ] ) ; } return result ; }
Invokes method on all items in a given array
@method invoke
@memberOf fabric.util.array
@param {Array} array Array to iterate over
@param {String} method Name of a method to invoke
Invokes method on all items in a given array