Function filterEntries
- filter
Entries <T>(record, predicate): Record<string, T> Type Parameters
Parameters
Returns Record<string, T>
A new record with all entries that match the given predicate.
Example: Basic usage
import { filterEntries } from "@std/collections/filter-entries";
import { assertEquals } from "@std/assert";
const menu = {
Salad: 11,
Soup: 8,
Pasta: 13,
};
const myOptions = filterEntries(
menu,
([item, price]) => item !== "Pasta" && price < 10,
);
assertEquals(myOptions, { Soup: 8 });
Returns a new record with all entries of the given record except the ones that do not match the given predicate.