API · Transform
pick()
Create a new object containing only the requested fields from each record.
Signature
pick<K extends keyof T>(fields: readonly K[]): Exstream<Pick<T, K>, C> Example
const publicUsers = exstream(users).pick(['id', 'displayName'] as const) Parameters
fields-
String, number, or symbol keys to copy. Missing keys are omitted. A readonly tuple preserves the exact output keys in TypeScript.
Behavior
Each successful input produces a fresh plain object. Keys are tested with the in operator, so inherited properties are included and read through normal property access. Property descriptors and the input prototype are not copied. Duplicate field names simply assign the same output property again.
The operator is synchronous, stable, one-to-one, context-preserving, and backpressure-aware. It does not mutate the input.
Errors
Applying pick() to null, undefined, or another value that cannot be used with in produces a record error for that input. Existing record errors pass through.
Forms
stream.pick(['id', 'name'])
exstream.pipeline().pick(['id', 'name'])
exstream.pick(['id', 'name'], stream)
stream.through(exstream.pick(['id', 'name']))