1 | ;
|
2 |
|
3 | /**
|
4 | * Checks whether a value is a boolean
|
5 | *
|
6 | * **Aliases** _bool_
|
7 | *
|
8 | * @function boolean
|
9 | *
|
10 | * @example
|
11 | * var is = require('predicates');
|
12 | *
|
13 | * is.boolean(true); // true
|
14 | * is.boolean(false);; // true
|
15 | * is.boolean(0); // false
|
16 | *
|
17 | * @param {*} value
|
18 | * @returns {Boolean}
|
19 | */
|
20 | module.exports = function isBoolean(value) {
|
21 | return typeof value === 'boolean' || Object.prototype.toString.call(value) === '[object Boolean]';
|
22 | };
|