@yanick/remeda-extra
Version:
A handful of added functions for Remeda
13 lines (12 loc) • 392 B
JavaScript
import { purry } from 'remeda';
function _matches(target, condition) {
if (typeof condition === 'function')
return condition(target);
if (typeof condition === 'object') {
return Object.entries(condition).every(([key, value]) => matches(target[key], value));
}
return target === condition;
}
export function matches() {
return purry(_matches, arguments);
}