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