.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ですでにバグとして暫定的に提出されています。)