JavaScript basic 'is' functions for Node.
npm i tm-is
Module provides a bunch of functions which return true or false. All functions support zero or more arguments. If several arguments passed, all of them should meet function conditions. Conditions for each function described in the Functions section.
E.g.
isObject({}); // true
isObject({}, {}); // true
isObject({}, 'str'); // false, since not all arguments are objects.
isEmpty
: Returns true if passed argument is null, empty string or undefined.isObject
/isObj
: Returns true if passed argument is an object except null.isFunction
/isFunc
: Returns true if passed argument is a function.isUndefined
/isUndef
: Returns true if passed argument is undefined.isEqualArrays
/isEqArr
: Returns true if passed arguments are equal arrays.
const { isObject, isFunction } = require('tm-is');
console.log(isObject({})); // true
console.log(isObject(null)); // false
console.log(isObject('string')); // false
console.log(isFunction('null')); // false
console.log(isFunction('string')); // false
console.log(isFunction(() => { })); // true