Skip to main content
Module

x/rimbu/deep/mod.ts>matchAtWith

Rimbu is a TypeScript library focused on immutable, performant, and type-safe collections and other tools.
Go to Latest
function matchAtWith
import { matchAtWith } from "https://deno.land/x/rimbu@0.14.0/deep/mod.ts";

Returns a function that matches a given value with the given matcher at the given string path.

Examples

Example 1

const items = [{ a: { b:  1, c: 'a' } }, { a: { b: 2, c: 'b' } }];
items.filter(Deep.matchAtWith('a.b', 2));
// => [{ a: 2, b: 'b' }]

Type Parameters

T
P extends Path.Get<T>
optional
TE extends T = T

Parameters

path: P
  • the string path in the object
matcher: Match<Path.Result<T & TE, P>>
  • a matcher object that matches input values.

Returns

(source: T) => boolean