fixed utils.isTruthy() and utils.isFalsy()
Showing
1 changed file
with
2 additions
and
2 deletions
... | @@ -295,7 +295,7 @@ exports.isClipRect = isClipRect; | ... | @@ -295,7 +295,7 @@ exports.isClipRect = isClipRect; |
295 | function isFalsy(subject) { | 295 | function isFalsy(subject) { |
296 | "use strict"; | 296 | "use strict"; |
297 | /*jshint eqeqeq:false*/ | 297 | /*jshint eqeqeq:false*/ |
298 | return subject == new Function('return false;')(); | 298 | return !subject; |
299 | } | 299 | } |
300 | exports.isFalsy = isFalsy; | 300 | exports.isFalsy = isFalsy; |
301 | /** | 301 | /** |
... | @@ -392,7 +392,7 @@ exports.isString = isString; | ... | @@ -392,7 +392,7 @@ exports.isString = isString; |
392 | function isTruthy(subject) { | 392 | function isTruthy(subject) { |
393 | "use strict"; | 393 | "use strict"; |
394 | /*jshint eqeqeq:false*/ | 394 | /*jshint eqeqeq:false*/ |
395 | return subject == new Function('return true;')(); | 395 | return !!subject; |
396 | } | 396 | } |
397 | exports.isTruthy = isTruthy; | 397 | exports.isTruthy = isTruthy; |
398 | 398 | ... | ... |
-
Please register or sign in to post a comment