is-kit

equals

Value equality with Object.is semantics; suitable for precise comparisons.

import { equals } from 'is-kit';
equals(1, 1); // true
equals(NaN, NaN); // true (Object.is semantics)

equalsBy / equalsKey

Compare by derived values or by property keys when building guards.

import { equalsBy, equalsKey, isString } from 'is-kit';
// Build a comparator in two steps for clarity
const lengthOfString = equalsBy(isString)((s) => s.length);
const isLength3 = lengthOfString(3 as const);
isLength3('foo'); // true
// Key-based equality guard
const hasId1 = equalsKey('id', 1 as const);
hasId1({ id: 1 }); // true