-
-
Notifications
You must be signed in to change notification settings - Fork 109
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5e11919
commit a620662
Showing
4 changed files
with
31 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
'use strict'; | ||
|
||
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'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import test from 'ava'; | ||
import {Observable as RxObservable} from 'rxjs/Observable'; | ||
import ZenObservable from 'zen-observable'; | ||
import Listr from '../'; | ||
import {isListr, isObservable} from '../lib/utils'; | ||
|
||
test('isListr', t => { | ||
t.false(isListr(null)); | ||
t.false(isListr({})); | ||
t.false(isListr(() => {})); | ||
t.true(isListr(new Listr([]))); | ||
}); | ||
|
||
test('isObservable', t => { | ||
t.false(isObservable(null)); | ||
t.false(isObservable({})); | ||
t.false(isObservable(new Listr([]))); | ||
t.false(isObservable(new Promise(() => {}))); | ||
t.true(isObservable(new RxObservable(() => {}))); | ||
t.true(isObservable(new ZenObservable(() => {}))); | ||
}); |