Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/rimbu/common/internal.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@1.0.0/common/internal.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]>