Channel.isChannel: Work with 'undefined' and 'null'.

This commit is contained in:
David Braun 2018-04-26 13:09:28 -04:00
parent fda1c036b4
commit 237f5c302b
2 changed files with 5 additions and 1 deletions

View file

@ -408,7 +408,9 @@ Channel.from = (values, mapfn, thisArg) => {
};
Channel.of = (...values) => Channel.from(values);
Channel.isChannel = arg => Object.getPrototypeOf(arg) === prototype;
Channel.isChannel = arg =>
arg !== undefined && arg !== null && Object.getPrototypeOf(arg) === prototype;
Channel.select = methodPromises =>
Object.assign(

View file

@ -82,6 +82,8 @@ describe(`Channel function`, function() {
it(`isChannel`, function() {
assert(Channel.isChannel(Channel.of(0, 1, 2)));
assert(!Channel.isChannel(Array.of(0, 1, 2)));
assert(!Channel.isChannel(undefined));
assert(!Channel.isChannel(null));
assert(Channel.isChannel(Channel().readOnly()));
assert(Channel.isChannel(Channel().writeOnly()));
});