【发布时间】:2016-06-26 22:18:15
【问题描述】:
使用 .groupBy 和 .concatAll 的组合对输出进行分组时,不会生成一些预期的输出。
示例代码:
var Rx = require('rx');
var source = Rx.Observable.from(['a1', 'a2', 'b1', 'b2', 'a3', 'a4', 'b3', 'b4'])
.groupBy(function (item) { return item.substr(0, 1); })
.concatAll();
var subscription = source.subscribe(
function (x) {
console.log('Next: %s', x);
},
function (err) {
console.log('Error: %s', err);
},
function () {
console.log('Completed');
});
实际输出:
$ node index.js
Next: a1
Next: a2
Next: a3
Next: a4
Completed
预期输出:
$ node index.js
Next: a1
Next: a2
Next: a3
Next: a4
Next: b1
Next: b2
Next: b3
Next: b4
Completed
我是否误解了这些运算符的工作原理?或者这是一个 RxJS 错误? (已在https://github.com/Reactive-Extensions/RxJS/issues/1264 暂时提交为错误。)
【问题讨论】:
标签: javascript rxjs frp reactivex