isMatch
Problem
You need partial structural matching — checking that an object contains at least the keys and values of a source, without requiring exact equality.
Solution
Use isMatch(object, source) to confirm that object has every key-value from source (recursively).
ts
import { isMatch } from '@vielzeug/arsenal';
const user = { id: 1, name: 'Alice', role: 'admin', active: true };
isMatch(user, { role: 'admin' }); // true
isMatch(user, { role: 'admin', active: true }); // true
isMatch(user, { role: 'user' }); // falsePitfalls
MapandSetsources always returnfalse— useisEqualfor those types.- Only checks keys present in
source— extra keys inobjectare ignored.