Skip to main content
Module

x/equal/deps.ts>xor

TypeScript-first deep equivalence comparison between two values
Latest
variable xor
import { xor } from "https://deno.land/x/equal@v1.5.0/deps.ts";

Returns true if one of the arguments is truthy and the other is falsy; otherwise false.

Examples

Example 1

xor(true, false) // true
xor(false, true) // true
xor(true, true) // false
xor(false, false) // false
xor(() => 1, () => 0) // true
xor(() => 0, () => 0) // false

type

<T, U>(a: T | AnyFn<any, T>, b: U | AnyFn<any, U>) => T extends FalsyLike ? (U extends FalsyLike ? false : boolean) : boolean