-
Notifications
You must be signed in to change notification settings - Fork 50.2k
Add react-is package #12199
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Add react-is package #12199
Changes from 1 commit
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
12d7a8c
Authoritative brand checking library
sebmarkbage f44c668
Patched up react-is and added some tests and docs
bvaughn 0f92bd3
Updated react-is version number to mirror other packages
bvaughn c91ef08
Fix export for tests
bvaughn 78c264d
Prettier
bvaughn cbffbd1
Add umd files to package
bvaughn 88d1dd4
typeOf returns symbols; symbols exported for switch/case
bvaughn b8f67c2
README tweaks
bvaughn 784fffc
Added broader isElement() tests
bvaughn 7b060d3
Replaced default exports with named exports
bvaughn 70bccd8
Added results.json
bvaughn b4ff653
Updated README
bvaughn 54588e4
Removed UMD target from react-is bundle
bvaughn 21a64bd
Documentation nits
bvaughn a06e6f7
Re-enabled UMD build for react-is
bvaughn b22a7b7
Made fragment/async/strict mode checks more strict
bvaughn ef0a900
Adjusted typeOf() to be more efficient
bvaughn f111111
Added a couple of additional tests
bvaughn 9c8385c
Removed unnecessary, nested not-null check
bvaughn File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Adjusted typeOf() to be more efficient
- Loading branch information
commit ef0a90099eb8304028d0564312791de10a5d89af
There are no files selected for viewing
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
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
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
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.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I find the structure of this function a bit hard to follow. Is there any specific reason it is written this way?
It also seems like we're reading
.typeand compare it many times in pretty common cases like when the input is an element.I would prefer to write it inline:
What do you think? IMO this makes the object structure a bit clearer, and avoids unnecessary property reads.
It also mirrors how we use it in practice (both Fiber and SSR) so it is helpful as a guide for "how do I handle all the cases".