diff options
| author | Juuso Lapinlampi <wub@partyvan.eu> | 2015-09-28 21:03:34 +0200 |
|---|---|---|
| committer | Juuso Lapinlampi <wub@partyvan.eu> | 2015-09-28 21:16:33 +0200 |
| commit | 187f3000385f136c8766fbfb2d18d24832ecf4b5 (patch) | |
| tree | bb87bac74a5e8d7ad17a0e98905af962e1fc95d7 | |
| parent | 043967a00987a840dffb3a5845246e5eef5a033b (diff) | |
Fix unexpected use of undefined with Boolean()
Airbnb style guide recommends checking booleans this way or using
(!!window.FormData). The latter is more confusing for many.
While !! is indeed 0.2% faster than Boolean(), it's called
micro-optimization. There is no noticeable difference to the user in our
use scenario and I prefer more readable code any day.
Fixes ESLint no-undefined warning using Airbnb ES5 config.
Reference: https://jsperf.com/boolean-conversion-speed
| -rw-r--r-- | js/cabinet.js | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/js/cabinet.js b/js/cabinet.js index 2f3a3a6..a74bb40 100644 --- a/js/cabinet.js +++ b/js/cabinet.js @@ -23,7 +23,7 @@ /* jshint browser:true, jquery:true */ (function($) { $.hasFileAPI = function hasFileAPI() { - return (window.FormData !== undefined); + return Boolean(window.FormData); }; $.fn.cabinet = function(input) { |
