MCPcopy Create free account
hub / github.com/TanStack/db / filter

Function filter

packages/db-ivm/src/operators/filter.ts:32–47  ·  view source on GitHub ↗
(f: (data: T) => boolean)

Source from the content-addressed store, hash-verified

30 * @param f - The predicate to filter elements
31 */
32export function filter<T>(f: (data: T) => boolean): PipedOperator<T, T> {
33 return (stream: IStreamBuilder<T>): IStreamBuilder<T> => {
34 const output = new StreamBuilder<T>(
35 stream.graph,
36 new DifferenceStreamWriter<T>(),
37 )
38 const operator = new FilterOperator<T>(
39 stream.graph.getNextOperatorId(),
40 stream.connectReader(),
41 output.writer,
42 f,
43 )
44 stream.graph.addOperator(operator)
45 return output
46 }
47}

Callers 4

compileQueryFunction · 0.90
processJoinResultsFunction · 0.90
processGroupByFunction · 0.90
filter.test.tsFile · 0.85

Calls 3

getNextOperatorIdMethod · 0.80
connectReaderMethod · 0.80
addOperatorMethod · 0.80

Tested by

no test coverage detected