"pre" hook handler
181586
function nextPreHook() {
                    /**
                     * read the arguments from previous "hook" response
                     */
                    const args = Array.prototype.slice.apply(arguments);

                    /**
                     * Check if the arguments contains an "__override" property
                     * that would override the arguments sent originally to the
                     * target method
                     */
                    if (is.object(args[0]) && {}.hasOwnProperty.call(args[0], '__override')) {
                        passedArgs = arrify(args[0].__override);
                    }

                    /**
                     * Reference to current pre hook
                     */
                    let currentHook;

                    if (currentPre + 1 < totalPres) {
                        currentPre += 1;
                        currentHook = pres[currentPre];
                        const hookMethod = currentHook.displayName || currentHook.name;
                        /**
                         * If there is a __scopeHook function on the object
                         * we call it to get the scope wanted for the hook
                         */
                        scope = getScope(self, name, passedArgs, hookMethod, 'pre');

                        /**
                         * Execute the hook and recursively call the next one
                         */
                        return currentHook.apply(scope, passedArgs).then(nextPreHook, handleError);
                    }

                    /**
                     * We are done with "pre" hooks
                     */
                    return done.apply(scope, passedArgs);
                }
533095
function nextPostHook(res) {
                    response = checkResponse(res, response);

                    if (currentPost + 1 < totalPost && self.__hooksEnabled !== false) {
                        currentPost += 1;

                        // Reference to current post hook
                        const currPost = posts[currentPost];
                        const hookMethod = currPost.displayName || currPost.name;
                        scope = getScope(self, name, res, hookMethod, 'post');

                        // Recursively call all the "post" hooks
                        return currPost.call(scope, response).then(nextPostHook, postHookErrorHandler);
                    }

                    /**
                     * All "post" hook process done.
                     * If the response has an "__override" property it will be our response
                     */
                    if (is.object(response) && {}.hasOwnProperty.call(response, '__override')) {
                        response = response.__override;
                    }

                    return resolveFn(response);
                }
1024315
def _execute_hooks(self, element):
        
        if self.hooks and self.finalize_hooks:
            self.param.warning(
                "Supply either hooks or finalize_hooks not both, "
                "using hooks and ignoring finalize_hooks.")
        hooks = self.hooks or self.finalize_hooks
        for hook in hooks:
            try:
                hook(self, element)
            except Exception as e:
                self.param.warning("Plotting hook %r could not be "
                                   "applied:\n\n %s" % (hook, e))
1094333
function(hook) {
			hooks[hook] && hooks[hook].trigger.apply(hooks[hook], Array.prototype.slice.call(arguments, 1));
		}
710389
def dispatch_hook(key, hooks, hook_data, **kwargs):
    """"""
    hooks = hooks or {}
    hooks = hooks.get(key)
    if hooks:
        if hasattr(hooks, '__call__'):
            hooks = [hooks]
        for hook in hooks:
            _hook_data = hook(hook_data, **kwargs)
            if _hook_data is not None:
                hook_data = _hook_data
    return hook_data
1137109
def prewalk_hook(self, dispatcher, node):
        

        self.walk(dispatcher, node)
        self.finalize()
        return node
177311
def _superclass_hooks
      hooks = { before: {}, after: {} }
      ancestors.reverse.each do |ancestor|
        next if ancestor == self
        hooks = hooks.deep_merge(ancestor.send(:_hooks)) if ancestor.respond_to?(:_hooks)
      end
      hooks
    end
748543
function addHook(hooks, type, weight, hook) {
    const length = arguments.length;
    let start = 2;

    if (typeof type !== 'string') {
        const err = Error('Expected first parameter to be a string. Received: ' + type);
        err.code = 'ESHOOK';
        throw err;
    }

    // handle variable input parameters
    if (typeof arguments[2] === 'number') {
        start = 3;
    } else {
        weight = 0;
    }

    if (!hooks[type]) hooks[type] = [];
    const store = hooks[type];
    for (let i = start; i < length; i++) {
        const hook = arguments[i];
        if (typeof hook !== 'function') {
            const err = Error('Invalid hook specified. Expected a function. Received: ' + hook);
            err.code = 'ESHOOK';
            throw err;
        }
        store.push({ weight: weight, hook: hook });
    }

    return this;
}
1204994
function beforeAction(callable $callback, $subtype = false)
    {
        $this->addHook(self::HOOK_BEFORE_ACTION, $callback, false, $subtype);
    }
649951
protected function handlePrePersist()
    {
        $environment = $this->getEnvironment();
        if (null !== $this->preFunction) {
            \call_user_func($this->preFunction, $environment, $this->model, $this->originalModel);
        }

        $environment->getEventDispatcher()->dispatch(
            PrePersistModelEvent::NAME,
            new PrePersistModelEvent($environment, $this->model, $this->originalModel)
        );
    }
779842
public function processPreAdd($entity, $name, &$value, $locale=null, $hook=true, $silentException=false) {
		if($hook)
			$this->trigger('set', [$entity, $name, &$value, $locale]);

		if(!$this->hasProperty($name))
			return;

		if($this->property($name)->get('hooks.set')) {
			$hook  = $this->property($name)->get('hooks.set');
			$value = call_user_func_array($hook, [$value, $entity]);
		}

		$value = $this->property($name)->_doSet($value, $entity, $name, $silentException);
	}
728723
function getHook(className, hookType) {
  if (hooks[className] && hooks[className][hookType]) {
    return hooks[className][hookType];
  }
  return undefined;
}
190317
def run_hook(self, hook, *args, **kwargs):
        
        for plugin in self.raw_plugins:
            if hasattr(plugin, hook):
                self.logger.debug('Calling hook {0} in plugin {1}'.format(hook, plugin.__name__))
                getattr(plugin, hook)(*args, **kwargs)
605248
def define_log_pre_format_hooks(self):
        
        hooks = super(Server, self).define_log_pre_format_hooks()
        # NOTE enabling logs only on debug mode
        if self.args.func == self.run and self.args.debug:
            hooks.append(self._send_log_to_ws)

        return hooks
1069023
def register_precmd_hook(self, func: Callable[[plugin.PrecommandData], plugin.PrecommandData]) -> None:
        """"""
        self._validate_prepostcmd_hook(func, plugin.PrecommandData)
        self._precmd_hooks.append(func)
1196272
function prepend(pre) {
  function prepender(string) { return pre + string; }

  return arguments.length > 1
  ? prepender(arguments[1])
  : prepender;
}
498777
function beforeUnloadHook() {
    // Synchronously check to see if any route hooks want
    // to prevent the current window/tab from closing.
    if (state.routes) {
      var hooks = getRouteHooksForRoutes(state.routes);

      var message = void 0;
      for (var i = 0, len = hooks.length; typeof message !== 'string' && i < len; ++i) {
        // Passing no args indicates to the user that this is a
        // beforeunload hook. We don't know the next location.
        message = hooks[i]();
      }

      return message;
    }
  }