UNPKG

locutus

Version:

Locutus other languages' standard libraries to JavaScript for fun and educational purposes

15 lines (14 loc) 581 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.is_bool = is_bool; function is_bool(mixedVar) { // discuss at: https://locutus.io/php/is_bool/ // parity verified: PHP 8.3 // original by: Onno Marsman (https://twitter.com/onnomarsman) // improved by: CoursesWeb (https://www.coursesweb.net/) // example 1: is_bool(false) // returns 1: true // example 2: is_bool(0) // returns 2: false return mixedVar === true || mixedVar === false; // Faster (in FF) than type checking }