Wraps a method.
Makes some aliases, such as $super and $self, work correctly.

@param {String}   name        The method name
@param {Function} method      The method to wrap
@param {Function} constructor The constructor

@return {Function} The wrapper
505317
function wrapMethod(name, method, constructor, isStatic) {
        if (method[$wrapped]) {
            method = method[$wrapped];
        }

        var parentClass = constructor.$parent,
            parentSource = parentClass && (isStatic ? parentClass : parentClass.prototype),
            parentMeta = parentClass && parentClass[$class][isStatic ? 'staticMethods' : 'methods'][name],
            parentLocked = parentClass && parentClass[$class].locked && !parentClass[$class].forceUnlocked,
            parentMethod,
            wrapper;

        if (parentMeta) {
            if (!isStatic && parentMeta.isPrivate && name === 'initialize') {
                parentMethod = callingPrivateConstructor;
                parentSource = null;
            } else {
                parentMethod = parentMeta.implementation;
            }
        } else {
            parentMethod = defaultSuper;
        }

        wrapper = function () {
            var that = this == null || this === glob ? {} : this,
                _super = that.$super,
                _self = that.$self,
                prevCaller,
                ret,
                parent;

            // Use the real source of the method if available, fallbacking to the
            // cached one because private/protected are not on the parent prototype
            // See: https://github.com/IndigoUnited/dejavu/issues/49
            parent = parentLocked || !parentSource ? parentMethod : parentSource[name];

            prevCaller = caller;
            caller = {
                method: method,
                constructor: constructor,
                constructorId: constructor[$class].id
            };
            that.$super = parent;
            that.$self = constructor;

            try {
                ret = method.apply(this, arguments);
            } finally {
                that.$super = _super;
                that.$self = _self;
                caller = prevCaller;
            }

            return ret;
        };

        obfuscateProperty(wrapper, $wrapped, method);

        if (method[$name]) {
            obfuscateProperty(wrapper, $name, method[$name]);
        }

        return wrapper;
    }
1327827
function(method) {
            return _.find(this.methods, function(handler) {
                return handler.regexp.test(method);
            }) || this.defaultHandler;
        }
227504
function wrap(callback, name) {
  var isLST
    , stack
    , d
    , oldStack

  if ('function' !== typeof callback || callback && callback.name === '_trycatchOnError') return callback

  isLST = options['long-stack-traces']
  d = process.domain
  if (isLST) {
    oldStack = trycatch.currentStack
    stack = getUpdatedCurrentStack()
  }

  // Inherit from callback for when properties are added
  _trycatchNewCallback.__proto__ = callback
  _trycatchNewCallback._trycatchCurrentStack = stack
  return _trycatchNewCallback

  function _trycatchNewCallback() {
    // Don't stomp stack in synchronous EventEmitter case
    if (isLST) {
      if (trycatch.currentStack !== oldStack) {
        trycatch.currentStack = stack
      } else if (trycatch.currentStack !== null) {
        trycatch.currentStack = stack
      }
    }
    runInDomain(d, callback, trycatchit, this, arguments)
  }
}
780726
function(name, fn) {
    // Init options.
    var opts = {
      name: name,
      methods: {}
    };
    _.each(methodNames, function(methodName) {
      opts.methods[methodName] = function() {
        throw new Error('Method not implemented : ' + methodName);
      };
    });
    // Give options to callback function for decoration.
    fn(opts);
    // Return options.
    return opts;
  }
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);
        };
    }
305980
function polyconsole(method) {
      var attach = { debug: 1, error: 1, log: 1, warn: 1 };

      //
      // Ensure that this host environment always has working console.
      //
      global.console[method] = function polyfilled() {
        var args = Array.prototype.slice.call(arguments, 0);

        //
        // If the host supports this given method natively, execute it.
        //
        if (method in fconsole) fconsole[method].apply(fconsole, args);

        //
        // Proxy messages to the container.
        //
        this._alcatraz_method_({
          attach: method in attach,
          type: 'console',
          scope: method,
          args: args
        });
      };
    }
364154
function (context, name) {
			var method = typeof name === "string" ? context[name] : name;

			if (typeof method !== "function") {
				method = context[method];
			}
            var Control = this;
			function controlMethod() {
				var wrapped = Control.wrapElement(this);
				context.called = name;
				return method.apply(context, [wrapped].concat(slice.call(arguments, 0)));
			}
      //!steal-remove-start
      if(process.env.NODE_ENV !== 'production') {
	      Object.defineProperty(controlMethod, "name", {
	      	value: canReflect.getName(this) + "["+name+"]",
	      });
	     }
      //!steal-remove-end
      return controlMethod;
		}
1106558
function wrapMethod(app,fn){
    //Override original express method
    return function(){
        let args = Array.prototype.slice.call(arguments)
        //Check if any middleware argument is a generator function
        for( let i=0; i<args.length; i++ ){
            //Wrap this if necessary
            args[i] = controllerWrapper(args[i])
        }
        
        //Call original method handler
        return fn.apply(app,args)
    }
}
348595
function Class(name,options) {

  this.name = name || "";
  this.mixins = [];
  this.methods = {};
  this.properties = {};

  if (lib.type.isObject(options)) {
    var keys = Object.keys(options);
    var length = keys.length;
    for (var i = 0; i < length; i++) {
      var key = keys[i];
      var value = options[key];
      if (key === "constructor") {
        this.addConstructor(value);
      } else if (key === "inherits") {
        this.inherit(value);
      } else if (key === "mixins") {
        this.mixin(value);
      } else if (lib.type.isFunction(value) && lib.inherits.superOf(value,Property)) {
        this.addProperty(key,value);
      } else {
        this.addMethod(key,value);
      }
    }
  }

}
324889
function(authMethod){
      var method = {};
      var _methodName = authMethod.name;

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

      return method;
    }
1038487
function WithName(name, Base) {
  let BaseClass =  Base || Therror;
  return class extends BaseClass {
    constructor(err, msg, prop) {
      super(err, msg, prop);
      this.name = name;
    }
  };
}
347596
function Method(entity, name, method, opts) {
  if (!(this instanceof Method)) return new Method(entity, name, method, opts);
  this._entity = entity;
  this._name = name;
  this._method = method;
  this._options = opts || {};
  this._chain = [];
  this.on('error', function() { /* stifle auto exit on error */ });
  debug('Creating `%s` method for `%s` entity', method, this._entity._route);
}
392619
function (jsName, methodName) {
    return function () {
        var args = slice.call(arguments, 0);
        var i = 0, max, arg, util, id, exportable;
        for (max=args.length; i<max; i++) {
            arg = args[i];
 
            if (arg.kirin_bridgeUtils) {
                util = arg.kirin_bridgeUtils;
                util.fillInDefaults(arg);
                util.validate(arg);

                exportable = util.createExportableObject(arg);
                if (util.hasCallbacks(arg)) {
                    // TODO stash the original object some place where we can use it for callbacks later.
                    id = tokenGenerator(jsName, methodName);
                    exportable.__id = id;
                    nativeAccessibleJavascriptObjects[id] = arg;
                }
                args[i] = exportable;
                
            } else if (typeof arg === 'function') {
                console.error("OMG WE'RE WRAPPING AN ERRANT FUNCTION");
                args[i] = wrapCallback(arg, jsName, methodName);
            }
        }
        args.unshift(jsName + "." + methodName);
        return Native.exec.apply(null, args);
    };
}
1037953
function(name) {
    if (this[name]) {
      this[name].apply(this, [].slice.call(arguments, 1));
    }
    this._super.apply(this, arguments);
  }
187244
function(name) {
        var list = this.getMethods();
        for (var i in list) {
            if (list[i].getName() === name) {
                return list[i];
            }
        }
        throw 'Method "' + name + '" does not exist.';
    }
1139300
function load(method, config) {
  return function(patterns, options) {
    var opts = mergeOptions(this, config, options);
    var loader = createLoader(opts, this[method]);
    return loader.apply(this, arguments);
  };
}
83570
function methodCall( $elems, methodName, args ) {
    var returnValue;
    var pluginMethodStr = '$().' + namespace + '("' + methodName + '")';

    $elems.each( function( i, elem ) {
      // get instance
      var instance = $.data( elem, namespace );
      if ( !instance ) {
        logError( namespace + ' not initialized. Cannot call methods, i.e. ' +
          pluginMethodStr );
        return;
      }

      var method = instance[ methodName ];
      if ( !method || methodName.charAt(0) == '_' ) {
        logError( pluginMethodStr + ' is not a valid method' );
        return;
      }

      // apply method, get return value
      var value = method.apply( instance, args );
      // set return value if value is returned, use only first value
      returnValue = returnValue === undefined ? value : returnValue;
    });

    return returnValue !== undefined ? returnValue : $elems;
  }