README
is-boolean
Determine if a value is Boolean
install
npm i @silen/is-boolean
api
declare function isBoolean(val: any): boolean;
usage
const { isBoolean } = require('@silen/is-boolean');
// or
import { isBoolean } from '@silen/is-boolean';
console.log(isBoolean(new Buffer(4)));
console.log(isBoolean(Buffer.alloc(4)));
console.log(isBoolean(undefined));
console.log(isBoolean(null));
console.log(isBoolean(''));
console.log(isBoolean(true));
console.log(isBoolean(0));
console.log(isBoolean(1));
console.log(isBoolean(1.0));
console.log(isBoolean('string'));
console.log(isBoolean({}));
console.log(isBoolean(function foo() {}));
console.log(isBoolean(Symbol()));
console.log(isBoolean(new Set));
console.log(isBoolean(new Map));
console.log(isBoolean(new WeakMap));
console.log(isBoolean(new WeakSet));
// or
console.log(window.Type.isBoolean(new WeakSet));
This is a demo for testing the usage of isBoolean
from @silen/is-boolean
module. You can try the others and do likewise.
others
- type
- isArray
- isUndefined
- isNull
- isBuffer
- isArrayBuffer
- isFormData
- isArrayBufferView
- isString
- isNumber
- isObject
- isPlainObject
- isDate
- isArguments
- isFile
- isBlob
- isFunction
- isSymbol
- isRegExp
- isInt8Array
- isUint8Array
- isUint8ClampedArray
- isInt16Array
- isUint16Array
- isInt32Array
- isUint32Array
- isFloat32Array
- isFloat64Array
- isError
- isPromise
- isSet
- isWeakSet
- isMap
- isWeakMap
- isStream
- isURLSearchParams