Hyperlinkv0.8.0-beta.28

Predicate

Predicate.isFunctionfunctioneffect/Predicate.ts:736
(input: unknown): input is Function

Checks whether a value is a function.

When to use

Use when you need a Predicate guard to narrow an unknown value to a callable function.

Details

Uses typeof input === "function".

Example (Guarding functions)

import { Predicate } from "effect"

const data: unknown = () => 1

if (Predicate.isFunction(data)) {
  console.log(data())
}
export function isFunction(input: unknown): input is Function {
  return typeof input === "function"
}
Referenced by 6 symbols