Skip to content

taufik-nurrohman/is

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Conditional Utility

I like to group all type checking tasks into helper functions like this to be used internally. This has the advantage in case of code minification.

These functions are very inspired by PHP which already has standard functions such as is_array(), is_object(), is_string(), etc.

Usage

CommonJS

const {isString} = require('@taufik-nurrohman/is');

console.log(isString('false'));

ECMAScript

import {isString} from '@taufik-nurrohman/is';

console.log(isString('false'));

Methods

isArray(any)

isBoolean(any)

isDefined(any)

isFloat(number)

isFunction(any)

isInstance(object, constructor, exact = false)

isInteger(number)

isNull(any)

isNumber(any)

isNumeric(string)

isObject(any, isPlain = true)

isScalar(any)

isSet(any)

isString(any)

isVoid(any)