Skip to content

Commit

Permalink
Fix isStream check
Browse files Browse the repository at this point in the history
  • Loading branch information
SamVerschueren committed Oct 24, 2017
1 parent 983cc24 commit 5c3392e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 1 addition & 2 deletions lib/task.js
@@ -1,5 +1,4 @@
'use strict';
const isStream = require('is-stream');
const isPromise = require('is-promise');
const streamToObservable = require('stream-to-observable');
const Subject = require('rxjs/Subject').Subject;
Expand Down Expand Up @@ -122,7 +121,7 @@ class Task extends Subject {
}

// Detect stream
if (isStream(result)) {
if (utils.isStream(result)) {
result = streamToObservable(result);
}

Expand Down
6 changes: 5 additions & 1 deletion lib/utils.js
@@ -1,5 +1,9 @@
'use strict';
const isStream = require('is-stream');

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

exports.isListr = obj => Boolean(obj && obj.setRenderer && obj.add && obj.run);
// https://github.com/sindresorhus/is-observable/issues/1
exports.isObservable = obj => Boolean(obj && typeof obj.subscribe === 'function' && obj.constructor.name === 'Observable');
exports.isObservable = isObservable;
exports.isStream = obj => isStream(obj) && !isObservable(obj);

0 comments on commit 5c3392e

Please sign in to comment.