tm-is
v0.2.0
Published
JavaScript basic 'is' functions.
Downloads
12
Maintainers
Readme
tm-is
JavaScript basic 'is' functions for Node.
Installation
npm i tm-is
Description
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.
Functions
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.
Examples
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