from: Support 'mapfn'.

This commit is contained in:
David Braun 2017-10-22 02:59:29 -04:00
parent 6b577ea6cd
commit 8088d7e096
No known key found for this signature in database
GPG key ID: 5694EEC4D129BDCF
3 changed files with 16 additions and 4 deletions

View file

@ -306,7 +306,7 @@ const Channel = function(length = 0) {
);
};
Channel.from = values => {
Channel.from = (values, mapfn, thisArg) => {
const channel = Channel();
(async () => {
@ -349,7 +349,7 @@ Channel.from = values => {
}
})();
return channel;
return mapfn ? channel.map(mapfn, thisArg) : channel;
};
Channel.of = (...values) => Channel.from(values);