fix(isObservable): Fix throwing error when testing isObservable(null)#3688
Merged
benlesh merged 3 commits intoReactiveX:masterfrom May 21, 2018
Merged
fix(isObservable): Fix throwing error when testing isObservable(null)#3688benlesh merged 3 commits intoReactiveX:masterfrom
benlesh merged 3 commits intoReactiveX:masterfrom
Conversation
benlesh
requested changes
May 15, 2018
Member
benlesh
left a comment
There was a problem hiding this comment.
This isn't quite right. We don't need to check to see if it's a function or object, we just needed to group the checks after the "falsiness" check.
return obj && (obj instanceof Observable || (typeof obj.lift === 'function' && typeof obj.subscribe === 'function'))
Contributor
Author
|
@benlesh Above suggestion gave me |
demensky
suggested changes
May 16, 2018
src/internal/util/isObservable.ts
Outdated
| import { Observable } from '../Observable'; | ||
| import { ObservableInput } from '../types'; | ||
| import { isObject } from './isObject'; | ||
| import { isFunction } from './isFunction'; |
Contributor
Author
There was a problem hiding this comment.
Good catch, updated.
benlesh
approved these changes
May 21, 2018
Member
|
thanks @bbonnet! |
This file contains hidden or 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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description:
Fix
isObservableto test to make sure the test subject is a function or object before attempting to access properties on it.Related issue (if exists):
#3687