@unction/where
v9.15.0
Published
Compares a Record of Predicate Functions to a Functor of values
Downloads
30
Readme
@unction/where
PredicateFunctionType => KeyedArray | Set | Record<string | number | symbol, unknown> | Map<B, unknown> | string => boolean
Compares a Keyed Enumerable of Predicate Functions to a Enumerable of values. It is partial and prefers truthiness (meaning it only checks a key on the Functor if there is a key on the matcher).
where(
{name: equals("Kurtis Rainbolt-Greene")}
)({
name: "Kurtis Rainbolt-Greene",
age: 30,
}) // true
where(
{name: equals("Kurtis Rainbolt-Greene")}
)(
new Map([
[
"name",
"Kurtis Rainbolt-Greene",
],
[
"age",
30,
],
])
)
where(
new Map([
[
[
"attributes",
"name",
],
equals("Kurtis Rainbolt-Greene"),
],
])
)({
attributes: {
name: "Kurtis Rainbolt-Greene",
age: 30,
},
}) // true
where(
[
equals("Kurtis Rainbolt-Greene"),
]
)(
[
"Kurtis Rainbolt-Greene",
30,
]
) // true