From 187f3000385f136c8766fbfb2d18d24832ecf4b5 Mon Sep 17 00:00:00 2001 From: Juuso Lapinlampi Date: Mon, 28 Sep 2015 19:03:34 +0000 Subject: 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 --- js/cabinet.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'js/cabinet.js') 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) { -- cgit v1.2.3