allows

The function allows takes in three parameters: event, fn, and error. It performs a check using the fn function and throws an error using the createError function if the check fails.

Function:

allows(
  event: H3Event,
  fn: () => boolean, error: string | (Partial<H3Error> & { status?: number; statusText?: string; })
) => void

Parameters:

  • event: An object of type H3Event.
  • fn: A function that returns a boolean value.
  • error: A string or an object of type Partial<H3Error> with optional properties status and statusText. Default value is { status: 403, statusText: "Forbidden" }.

Returns: void

Please note that the types H3Error and H3Event are imported from the "h3" module, but their specific definitions are not available in the provided code snippet.