Created
February 24, 2019 10:07
-
-
Save hallojoe/4877098269c594a8b5dd0c46c9e85f7c to your computer and use it in GitHub Desktop.
A thing JavaScript that convert a boolean'ish strings and a number to boolean
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
var isTrue = function (value) { | |
if ('string' === typeof (value)) value = value.toLowerCase().trim(); | |
return ['true', '1', 'on', 'yes', 1].indexOf(value) > -1; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment