Creates a method that implements the given definition
@private
@param {Object} The method configuration
@param {String} method The name of the method
@return {Function} A stub capable of proxying the requested method call
764691
function _createMethod(definition, method){
        var slice = Array.prototype.slice;
        
        return function(){
            var l = arguments.length, callback, message = {
                method: method
            };
            
            if (l > 0 && typeof arguments[l - 1] === "function") {
                //with callback, procedure
                if (l > 1 && typeof arguments[l - 2] === "function") {
                    // two callbacks, success and error
                    callback = {
                        success: arguments[l - 2],
                        error: arguments[l - 1]
                    };
                    message.params = slice.call(arguments, 0, l - 2);
                }
                else {
                    // single callback, success
                    callback = {
                        success: arguments[l - 1]
                    };
                    message.params = slice.call(arguments, 0, l - 1);
                }
                _callbacks["" + (++_callbackCounter)] = callback;
                message.id = _callbackCounter;
            }
            else {
                // no callbacks, a notification
                message.params = slice.call(arguments, 0);
            }
            if (definition.namedParams && message.params.length === 1) {
                message.params = message.params[0];
            }
            // Send the method request
            _send(message);
        };
    }
928787
function sortArgs(method, args) {

		// get the method definition
		var def = _.get(_client.types, method.replace(/\_Task$/i, '') + 'RequestType');
		
		// if found create the definition by calling its function
		if (def) {
			return getFields(def(), args);
		}
		return args;
	}
1300668
function(object, method) {
      if (object == null) return void 0;
      var func = object[method];
      var args = slice.call(arguments, 2);
      return _.isFunction(func) ? func.apply(object, args) : void 0;
    }
989270
function API(method, url, data, callback) {
    if (typeof callback === 'undefined') {
        callback  = data;
        data  = {};
    }

    url             = this.prepareUrl(url);
    this.callback   = callback || noop;
    this.data       = data;

    this.options          = extend({}, requestOptions);
    this.options.encoding = this.options.encoding || 'utf-8';

    // these particular set of options should be immutable
    this.options.method         = method;
    this.options.uri            = url;
    this.options.followRedirect = false;

    this[method.toLowerCase()]();

    return this;
}
1267850
function buildMethodMap(methods) {
  // Makes a fake set of initial methods
  var methodMap = {};
  methods.forEach(function(method) {
    methodMap[method.name] = getMethod(method.name);
  });
  return methodMap;
}
180587
function(method) {
		 	if(typeof method === "function") {
				var args = [];
								
				for(var x = 1; x <= arguments.length; x++) {
					if(arguments[x]) {
						args.push(arguments[x]);
					}
				}
				
				method.apply(this, args);
			}
		}
977671
function createMethodsManager() {
    var methods = {};

    return {
        addMethod: addMethod,
        setTarget: setTarget
    };

    /*
     * Adds a method that will be available to extend the object.
     *
     * @param {string} name The method name
     * @param {function} [method] The handler for the specified method name.
     * @return {function} The handler for the specified method name.
     */
    function addMethod(name, method) {
        if (method !== undefined) {
            methods[name] = method;
        }
        return methods[name];
    }

    /*
     * Sets the target object to extend.
     *
     * @param {object} target The target object.
     */
    function setTarget(target) {
        var targetMethods = {};
        for (var name in methods) {
            targetMethods[name] = wrapMethod(target, methods[name]);
        }
        return targetMethods;
    }

    /*
     * Wraps the method so that it is executed with the appropriate
     * arguments.
     *
     * @param {object} target The target object.
     * @param {function} method The method to wrap.
     */
    function wrapMethod(target, method) {
        return function() {

            // Put arguments into a real array.
            var methodArgs = [];
            for (var i = 0; i < arguments.length; i++) {
                methodArgs.push(arguments[i]);
            }

            var params = method(target, parseMethodArgs, methodArgs);

            modifyTarget(target,
                params.source,
                params.sourceKeys,
                params.filters,
                params.overrideKeys);
            return this;
        };
    }
}
1326246
function Method(method, path) {
    return function (target, propertyKey, descriptor) {
        path = (path != undefined) ? path : propertyKey;
        method = method.toLowerCase();
        let m = exports.globalKCState.getOrInsertController(target.constructor).getOrInsertMethod(propertyKey);
        m.methodMountpoints.push({ "path": U.UrlJoin("/", path), "httpMethod": method });
        m.explicitlyDeclared = true;
    };
}
721650
public final String callMethod(String method) {
    parent.assertConnected();
    return debugger.callFunctionOnObject(method, objectId);
  }
936706
function (methods) {
    this.lazyRouter();
    this.router.method(methods);
    utils.arrayify(methods).forEach(function (method) {
      this.define(method, function(path) {
        var route = this.router.route(path);
        var args = [].slice.call(arguments, 1);
        route[method].apply(route, args);
        return this;
      }.bind(this));
    }.bind(this));
  }
390662
function(method, args, options) {
            var that = this, methodHandler;

            options = options || {};

            var handler = this.getHandler(method);
            if (!handler) return Q.reject(new Error("No handler found for method: "+method));

            // Is offline
            if (!Offline.isConnected()) {
                methodHandler = handler.fallback;
            }
            methodHandler = methodHandler || handler.execute || this.defaultHandler.execute;

            // No default
            if (!methodHandler) {
                return Q.reject(new Error("No handler found for this method in this backend"));
            }

            return Q(methodHandler(args, options, method)).then(function(results) {
                if (handler.after) {
                    return Q.all([
                        Q(handler.after(args, results, options, method)),
                        Q((that.defaultHandler.after || function() {})(args, results, options, method))
                    ]).then(function() {
                        return Q(results);
                    }, function() {
                        return Q(results);
                    });
                }
                return results;
            });
        }
649082
function methodPromify(target, method, arg0, arg1) {
  var chopLength = 2
    , argCount = arguments.length - chopLength;
  if (argCount > 2) {
    var args = slice.call(arguments, chopLength);
    return new MyPromise(function(resolve, reject) {
      args.push(function(err, result) {
        if (err) { reject(err); }
        else { resolve(result); }
      });
      target[method].apply(target, args);
    });
  } else {
    return new MyPromise(function(resolve, reject) {
      var cb = function(err, result) {
        if (err) { reject(err); }
        else { resolve(result); }
      };
      if (argCount === 2) {
        target[method].call(target, arg0, arg1, cb);
      } else if (argCount === 1) {
        target[method].call(target, arg0, cb);
      } else if (argCount === 0) {
        target[method].call(target, cb);
      }
    });
  }
}
278325
function addMethod(name, method) {
        if (method !== undefined) {
            methods[name] = method;
        }
        return methods[name];
    }
950213
function(authMethods){
      var _method = {};
      var _methodName;

      try{
        _.each(authMethods, function(method){
          _methodName = method.name;
          method = _.merge(require('../../'+_methodName), method);
          _method[method.authType] = method;
        });
      }catch(e){
        this._errorHandler(_methodName);
      }

      return _method;
    }
769089
function(methodName) {
                    var origMethod = that[methodName],
                        ret;

                    that[methodName] = function() {
                        args = _simplifyArray(Array.prototype.slice.call(arguments, 0));
                        ret = origMethod.apply(that, arguments);
           
                        that._trace({
                            method: methodName,
                            args: args
                        });
                 
                        return ret;
                    };
            }
201357
function( name, method ) {
			var m = this.settings.messages[name];
			return m && (m.constructor === String ? m : m[method]);
		}
722533
function methodToAbi (method) {
  const length = method.length;
  const typesStart = method.indexOf('(');
  const typesEnd = method.indexOf(')');

  if (typesStart === -1) {
    throw new Error(`Missing start ( in call to decodeMethod with ${method}`);
  } else if (typesEnd === -1) {
    throw new Error(`Missing end ) in call to decodeMethod with ${method}`);
  } else if (typesEnd < typesStart) {
    throw new Error(`End ) is before start ( in call to decodeMethod with ${method}`);
  } else if (typesEnd !== length - 1) {
    throw new Error(`Extra characters after end ) in call to decodeMethod with ${method}`);
  }

  const name = method.substr(0, typesStart);
  const types = method.substr(typesStart + 1, length - (typesStart + 1) - 1).split(',');
  const inputs = types.filter((_type) => _type.length).map((_type) => {
    const type = fromParamType(toParamType(_type));

    return { type };
  });

  return { type: 'function', name, inputs };
}