diff --git a/lib/index.js b/lib/index.js index a9bd55c..0125830 100644 --- a/lib/index.js +++ b/lib/index.js @@ -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( diff --git a/test/index.js b/test/index.js index 05a0220..dda61a9 100644 --- a/test/index.js +++ b/test/index.js @@ -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())); });