在highlandjs中调用`group`之后调用转换

问题描述 投票:0回答:1

目标是将流中的项目分组为多个组。分别对这些组运行转换,然后将所有组重新组合成一个流。

我可以在group之后使用的唯一调用似乎是each并且不会将单个组传递给我的回调它传递整个分组对象的字典。调用map不会将任何内容传递给我的回调。例:

const groups = stream.group(func);
groups.map(item => console.log(item)); // prints nothing
groups.each(item => console.log(item)); // instead of item being one of the groups created, it's a dictionary with all the groups included. 

我怎样才能做到这一点?

node.js stream-processing highland.js
1个回答
0
投票

你在找这个吗? :

groups.on('error', handleError)
        .pipe(transformObject(async item => {
            some code...

如果不是,请尝试举例说明您要对数据执行的操作。

© www.soinside.com 2019 - 2024. All rights reserved.