-
Notifications
You must be signed in to change notification settings - Fork 242
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
Simpler and better cordova/util.getPlatformApiFunction #767
Conversation
Codecov Report
@@ Coverage Diff @@
## master #767 +/- ##
==========================================
+ Coverage 85.71% 85.86% +0.14%
==========================================
Files 50 50
Lines 2598 2589 -9
==========================================
- Hits 2227 2223 -4
+ Misses 371 366 -5
Continue to review full report at Codecov.
|
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.
👍
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.
LGTM, only made small changes in my opinion but not actually required.
Co-Authored-By: raphinesse <raphinesse@gmail.com>
Motivation and Context
The logic in
cordova/util.getPlatformApiFunction
was a tad to complex and had a few problems because of that.During testing I frequently had the situation that an error occurred during loading of a platform API module, mostly because of a missing dependency. This function caught these errors and insted threw an error claiming
'Your ' + platform + ' platform does not have Api.js'
which was plainly wrong and confusing.On top of that came a dead code branch and IMHO unnecessary checks. Enough reason for a rewrite
AFAICT this method is not publicly exposed, so this should be a minor change at most.
Description
Api.js
!platforms[platform]
)Testing
The existing tests pass.