
Security News
Axios Maintainer Confirms Social Engineering Attack Behind npm Compromise
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.
@ezzylabs/type-check
Advanced tools
@ezzylabs/type-checkDynamic type checking utilities for JavaScript.
The @ezzylabs/types package provides various functions for checking and ensuring dynamic types of JavaScript values.
Using NPM:
npm i @ezzylabs/types
import { ensureArray, ensureFunction } from '@ezzylabs/types'
function map (arr, fn) {
ensureArray(arr)
ensureFunction(fn)
return arr.map(fn)
}
isNull(v)Checks whether v is null.
import { isNull } from '@ezzylabs/types'
isNull(null) === true
isUndefined(v)Checks whether v is undefined.
import { isUndefined } from '@ezzylabs/types'
isUndefined() === true
isUndefined(undefined) === true
isBoolean(v)Checks whether v is either true or false.
import { isBoolean } from '@ezzylabs/types'
isBoolean(true) === true
isBoolean(false) === true
isInteger(v)Checks whether v is an integer using Number.isSafeInteger.
import { isInteger } from '@ezzylabs/types'
isInteger(1) === true
isInteger(0.1) === false
isInteger(NaN) === false
isInteger(Infinity) === false
isNumber(v)Checks whether v is a number, excluding infinite values.
import { isNumber } from '@ezzylabs/types'
isNumber(1) === true
isNumber(NaN) === false
isNumber(Infinity) === false
isString(v)Checks whether v is a string, excluding String object.
import { isString } from '@ezzylabs/types'
isString('') === true
isArray(v)Checks whether v is an array using Array.isArray.
import { isArray } from '@ezzylabs/types'
isArray([]) === true
isFunction(v)Checks whether v is a function.
import { isFunction } from '@ezzylabs/types'
isFunction(() => null) === true
isObject(v)Checks whether v is a non-null object or a function.
import { isObject } from '@ezzylabs/types'
isObject({}) === true
isObject([]) === true
isObject(() => null) === true
isObject(null) === false
isObject('') === false
isSymbol(v)Checks whether v is a Symbol.
import { isSymbol } from '@ezzylabs/types'
isSymbol(Symbol('test')) === true
isIterable(v)Checks whether v is iterable, e.g. implements the iterable protocol
import { isIterable } from '@ezzylabs/types'
isIterable('') === true
isIterable([]) === true
isIterable({}) === false
isPromise(v)Checks whether v is promise-like, e.g. implements then method.
import { isPromise } from '@ezzylabs/types'
isPromise(Promise.resolve()) === true
isPromise({ then: () => null }) === true
ensure*(v)Additionally, every is* function has a ensure* counterpart, which throw TypeError exceptions if v is not a correct type.
import { ensureIterable } from '@ezzylabs/types'
ensureIterable(null) // throws TypeError('Expected iterable but got null')
typeOf(v)Similarly to typeof operator, returns the type of v. It handles several special cases:
import { typeOf } from '@ezzylabs/types'
typeOf(null) === 'null'
typeOf(NaN) === 'NaN'
typeOf(Infinity) === 'infinity'
FAQs
Dynamic type checking utilities for JavaScript
We found that @ezzylabs/type-check demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.