@js-utilities/typecheck
TypeScript icon, indicating that this package has built-in type declarations

0.1.6 • Public • Published

Type checking library

npm version Build Status

A set of super-simple type checkers. Each checker returns boolean value. Most checkers are typescript type predicates.

Installation

npm i -S @js-utilities/typecheck

Usage example

import { isCallable } from "@js-utilities/typecheck";

const a: unknown = global.value;

if (isCallable(a)) a();

Available checkers:

Checker Return type
isCallable boolean
isFunction value is Function
isArrowFunction boolean
isArray<T> value is T[]
isObject<T> value is T
isBoolean value is boolean
isUndefined value is undefined
isNumber value is number
isString value is string
isSymbol value is symbol
isNull value is null
isMap<T, U> value is Map<T, U>
isSet<T> value is Set<T>
isWeakSet<T> value is WeakSet<T>
isWeakMap<T, U> value is WeakMap<T, U>
isPromise<T> value is Promise<T>

License

MIT License

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.1.6
    263
    • latest

Version History

Package Sidebar

Install

npm i @js-utilities/typecheck

Weekly Downloads

264

Version

0.1.6

License

MIT

Unpacked Size

20.4 kB

Total Files

12

Last publish

Collaborators

  • shapovalov_v