UNPKG

@johngw/stream

Version:

Reactive programming tools using the WHATWG Streams API.

38 lines 950 B
/** * Maps each chunk as an object with a "label" and a "value". * * The label can be the result of a property on the chunk. * * @group Transformers * @see {@link groupBy:function} * @example * ``` * --one--------------------two--------------------three------------------- * * label('length') * * --{label:3,value:'one'}--{label:3,value:'two'}--{label:5,value:'three'}- * ``` */ export declare function label<T, K extends keyof T>(propName: K): TransformStream<T, { label: T[K]; value: T; }>; /** * The label can be the result of calling a provided function. * * @group Transformers * @example * ``` * --6.1------------------4.2------------------6.3------------------ * * label(Math.floor) * * --{label:6,value:6.1}--{label:4,value:4.2}--{label:6,value:6.3}-- * ``` */ export declare function label<T, L>(fn: (chunk: T) => L): TransformStream<T, { label: L; value: T; }>; //# sourceMappingURL=label.d.ts.map