Hyperlinkv0.8.0-beta.28

Predicate

Predicate.norconsteffect/Predicate.ts:1756
<A>(that: Predicate<A>): (self: Predicate<A>) => Predicate<A>
<A>(self: Predicate<A>, that: Predicate<A>): Predicate<A>

Creates a predicate that returns true when neither predicate is true.

When to use

Use when you want to combine two Predicates with logical NOR semantics.

Details

Returns the negation of or.

Example (Checking NOR conditions)

import { Predicate } from "effect"

const neither = Predicate.nor(Predicate.isString, Predicate.isNumber)

console.log(neither(true))
combinatorsornot
export const nor: {
  <A>(that: Predicate<A>): (self: Predicate<A>) => Predicate<A>
  <A>(self: Predicate<A>, that: Predicate<A>): Predicate<A>
} = dual(
  2,
  <A>(self: Predicate<A>, that: Predicate<A>): Predicate<A> => (a) => !(self(a) || that(a))
)