source: frontend/node_modules/is-boolean-object/index.js

Last change on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 11 days ago

Fix frontend appearance

  • Property mode set to 100644
File size: 711 bytes
RevLine 
[9af201e]1'use strict';
2
3var callBound = require('call-bound');
4var $boolToStr = callBound('Boolean.prototype.toString');
5var $toString = callBound('Object.prototype.toString');
6
7/** @type {import('.')} */
8var tryBooleanObject = function booleanBrandCheck(value) {
9 try {
10 $boolToStr(value);
11 return true;
12 } catch (e) {
13 return false;
14 }
15};
16var boolClass = '[object Boolean]';
17var hasToStringTag = require('has-tostringtag/shams')();
18
19/** @type {import('.')} */
20module.exports = function isBoolean(value) {
21 if (typeof value === 'boolean') {
22 return true;
23 }
24 if (value === null || typeof value !== 'object') {
25 return false;
26 }
27 return hasToStringTag ? tryBooleanObject(value) : $toString(value) === boolClass;
28};
Note: See TracBrowser for help on using the repository browser.