Last change
on this file since 6a3a178 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
681 bytes
|
Rev | Line | |
---|
[6a3a178] | 1 | var baseGetTag = require('./_baseGetTag'),
|
---|
| 2 | isObjectLike = require('./isObjectLike');
|
---|
| 3 |
|
---|
| 4 | /** `Object#toString` result references. */
|
---|
| 5 | var boolTag = '[object Boolean]';
|
---|
| 6 |
|
---|
| 7 | /**
|
---|
| 8 | * Checks if `value` is classified as a boolean primitive or object.
|
---|
| 9 | *
|
---|
| 10 | * @static
|
---|
| 11 | * @memberOf _
|
---|
| 12 | * @since 0.1.0
|
---|
| 13 | * @category Lang
|
---|
| 14 | * @param {*} value The value to check.
|
---|
| 15 | * @returns {boolean} Returns `true` if `value` is a boolean, else `false`.
|
---|
| 16 | * @example
|
---|
| 17 | *
|
---|
| 18 | * _.isBoolean(false);
|
---|
| 19 | * // => true
|
---|
| 20 | *
|
---|
| 21 | * _.isBoolean(null);
|
---|
| 22 | * // => false
|
---|
| 23 | */
|
---|
| 24 | function isBoolean(value) {
|
---|
| 25 | return value === true || value === false ||
|
---|
| 26 | (isObjectLike(value) && baseGetTag(value) == boolTag);
|
---|
| 27 | }
|
---|
| 28 |
|
---|
| 29 | module.exports = isBoolean;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.