Hyperlinkv0.8.0-beta.28

Predicate

Predicate.isObjectKeywordfunctioneffect/Predicate.ts:1096
(input: unknown): input is object

Checks whether a value is an object in the JavaScript sense (objects, arrays, functions).

When to use

Use when you need a Predicate guard that accepts arrays and functions as well as objects.

Details

Returns true for arrays and functions, and false for null.

Example (Checking object keywords)

import { Predicate } from "effect"

console.log(Predicate.isObjectKeyword(() => 1))
console.log(Predicate.isObjectKeyword(null))
export function isObjectKeyword(input: unknown): input is object {
  return (typeof input === "object" && input !== null) || isFunction(input)
}
Referenced by 2 symbols