Add topic_generator.map().

This commit is contained in:
Steve Howell
2017-04-21 08:26:40 -07:00
committed by Tim Abbott
parent bdcddd35d0
commit d332df8cc6
2 changed files with 19 additions and 0 deletions

View File

@@ -110,6 +110,18 @@ exports.filter = function (gen, filter_func) {
};
};
exports.map = function (gen, map_func) {
return {
next: function () {
var val = gen.next();
if (val === undefined) {
return;
}
return map_func(val);
},
};
};
exports.next_topic = function (streams, get_topics, has_unread_messages, curr_stream, curr_topic) {
var stream_gen = exports.wrap(streams, curr_stream);