Skip to content

Commit

Permalink
Fix is-observable detection for RxJS@6
Browse files Browse the repository at this point in the history
  • Loading branch information
SamVerschueren committed May 9, 2018
1 parent 4e41f98 commit d6a722f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/utils.js
@@ -1,8 +1,10 @@
'use strict';
const isStream = require('is-stream');

// TODO https://github.com/sindresorhus/is-observable/issues/1
const isObservable = obj => Boolean(obj && typeof obj.subscribe === 'function' && obj.constructor.name === 'Observable');
// RxJS@6 symbol (https://github.com/sindresorhus/is-observable/issues/1#issuecomment-387843191)
const symbolObservable = typeof Symbol === 'function' && Symbol.observable || '@@observable'; // eslint-disable-line no-mixed-operators

const isObservable = obj => Boolean(obj && obj[symbolObservable] && obj === obj[symbolObservable]()) || require('is-observable')(obj);

exports.isListr = obj => Boolean(obj && obj.setRenderer && obj.add && obj.run);
exports.isObservable = obj => isObservable(obj);
Expand Down
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -42,6 +42,7 @@
"cli-truncate": "^0.2.1",
"figures": "^1.7.0",
"indent-string": "^2.1.0",
"is-observable": "^1.1.0",
"is-promise": "^2.1.0",
"is-stream": "^1.1.0",
"listr-silent-renderer": "^1.1.1",
Expand Down

0 comments on commit d6a722f

Please sign in to comment.