Skip to main content
Module

x/rimbu/mod.ts>Eq.tupleSymmetric

Rimbu is a TypeScript library focused on immutable, performant, and type-safe collections and other tools.
Go to Latest
function Eq.tupleSymmetric
import { Eq } from "https://deno.land/x/rimbu@0.14.0/mod.ts";
const { tupleSymmetric } = Eq;

Returns an Eq instance for tuples that considers two tuples [A, B] and [C, D] equal if [A, B] equals [C, D], or if [A, B] equals [D, C]

Examples

Example 1

const eq = Eq.tupleSymmetric()
console.log(eq([1, 2], [1, 2]))
// => true
console.log(eq([1, 2], [2, 1]))
// => true
console.log(eq([1, 3], [2, 1]))
// => false

Parameters

optional
eq: Eq<T> = [UNSUPPORTED]
  • (optional) an alternative Eq instance to use for the values in the tuple

Returns

Eq<readonly [T, T]>