import { match } from "https://deno.land/x/rimbu@0.11.6/mod.ts";
Returns true if the given value
object matches the given matcher
, false otherwise.
Examples
Example 1
Example 1
const input = { a: 1, b: { c: true, d: 'a' } }
match(input, { a: 1 }) // => true
match(input, { a: 2 }) // => false
match(input, { a: v => v > 10 }) // => false
match(input, { b: { c: true }}) // => true
match(input, ({ every }) => every({ a: v => v > 0 }, { b: { c: true } } )) // => true
match(input, { b: { c: (v, parent, root) => v && parent.d.length > 0 && root.a > 0 } })
// => true