We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ba00c97 commit 99cfd90Copy full SHA for 99cfd90
src/lib/isBoolean.js
@@ -1,16 +1,15 @@
1
import assertString from './util/assertString';
2
3
const defaultOptions = { loose: false };
4
+const strictBooleans = ['true', 'false', '1', '0'];
5
+const looseBooleans = [...strictBooleans, 'yes', 'no'];
6
7
export default function isBoolean(str, options = defaultOptions) {
8
assertString(str);
9
- const strictBooleans = ['true', 'false', '1', '0'];
- const looseBooleans = [...strictBooleans, 'yes', 'no'];
10
-
11
if (options.loose) {
12
- return (looseBooleans.indexOf(str.toLowerCase()) >= 0);
+ return looseBooleans.includes(str.toLowerCase());
13
}
14
15
- return (strictBooleans.indexOf(str) >= 0);
+ return strictBooleans.includes(str);
16
0 commit comments