Asserts that the target includes all members of the expected value (order doesn't matter). Uses strict equality (===) for comparison. Both the target and expected values must conform to ArrayLikeOrSizedIterable but can be different concrete types.
Note on NaN: Since this function uses strict equality (===), NaN values will NOT match other NaN values. Use includeDeepMembersFunc if you need NaN values to be considered equal.
The assert scope.
The expected subset collection to check for (must be an ArrayLikeOrSizedIterable).
OptionalevalMsg: MsgSource
The message to display if the assertion fails.
import { assert } from "@nevware21/tripwire";
assert([1, 2, 3, 4]).includes.members([2, 4]); // Passes - subset present
assert([1, 2, 3, 4]).includes.members([4, 2]); // Passes - order doesn't matter
assert([1, 2, 3]).includes.members([1, 2, 3, 4]); // Fails - not a subset
assert([1, 2, 3]).includes.members([5]); // Fails - member not found
assert(new Set([1, 2, 3, 4])).includes.members([2, 4]); // Passes - different types
// NaN behavior
assert([NaN, 1, 2]).includes.members([NaN]); // Fails - NaN !== NaN with strict equality
Export assertion functions