Skip to content

Commit

Permalink
Use is-observable to detect observables
Browse files Browse the repository at this point in the history
  • Loading branch information
SamVerschueren committed Oct 24, 2017
1 parent 7434dfd commit faf367e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
6 changes: 2 additions & 4 deletions lib/utils.js
@@ -1,9 +1,7 @@
'use strict';
const isStream = require('is-stream');

const isObservable = obj => Boolean(obj && typeof obj.subscribe === 'function' && obj.constructor.name === 'Observable');
const isObservable = require('is-observable');

exports.isListr = obj => Boolean(obj && obj.setRenderer && obj.add && obj.run);
// https://github.com/sindresorhus/is-observable/issues/1
exports.isObservable = isObservable;
exports.isObservable = obj => isObservable(obj);
exports.isStream = obj => isStream(obj) && !isObservable(obj);
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": "^0.2.0",
"is-promise": "^2.1.0",
"is-stream": "^1.1.0",
"listr-silent-renderer": "^1.1.1",
Expand Down

0 comments on commit faf367e

Please sign in to comment.