Skip to content

checkContext

Source Code | Documentation

Restrict a hook to run for certain methods and method types.

ts
  import { 
checkContext
} from 'feathers-utils/utils';

Type declaration

ts
/**
 * Restrict a hook to run for certain methods and method types.
 *
 * @see https://utils.feathersjs.com/utils/check-context.html
 */
export declare function checkContext<H extends HookContext = HookContext>(
  context: H,
  type?: HookType | HookType[] | null,
  methods?: MethodName | MethodName[] | null,
  label?: string,
): void
ArgumentTypeDescription
contextH
typeHookType | HookType[] | null
methodsMethodName | MethodName[] | null
labelany

Released under the MIT License.