# @js-utilities/typecheck

> Utility library for javascript type checking.

Latest version **0.1.6** (published 2021-11-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install @js-utilities/typecheck
pnpm add @js-utilities/typecheck
yarn add @js-utilities/typecheck
bun add @js-utilities/typecheck
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.6 |
| Published | 2021-11-07 |
| First published | 2019-07-05 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 20 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | Vitalii Shapovalov |
| Maintainers | shapovalov_v |
| Keywords | type checking, type predicates, isCallable, isFunction, isArrowFunction, isArray, isObject, isBoolean, isUndefined, isNumber, isString, isSymbol, isNull, isMap, isSet, isWeakSet, isWeakMap |

## Links

- npm: https://www.npmjs.com/package/@js-utilities/typecheck
- Repository: https://github.com/vitalishapovalov/Typecheck
- Homepage: https://github.com/vitalishapovalov/Typecheck#readme
- Issues: https://github.com/vitalishapovalov/Typecheck/issues
- npm.io page: https://npm.io/package/@js-utilities/typecheck

## Alternatives

- [@mce/gif](https://npm.io/package/@mce/gif.md) — 2.6K weekly downloads
- [cleanse](https://npm.io/package/cleanse.md) — 173 weekly downloads
- [str](https://npm.io/package/str.md) — 127 weekly downloads
- [naming](https://npm.io/package/naming.md) — 95 weekly downloads
- [tap-telco-api](https://npm.io/package/tap-telco-api.md) — 19 weekly downloads

## Recent versions

- 0.1.6 (latest) — 2021-11-07
- 0.1.5 — 2021-11-07
- 0.1.4 — 2019-10-25
- 0.1.3 — 2019-07-14
- 0.1.2 — 2019-07-05
- 0.1.1 — 2019-07-05

## README

# Type checking library

[![npm version](https://badge.fury.io/js/%40js-utilities%2Ftypecheck.svg)](https://badge.fury.io/js/%40js-utilities%2Ftypecheck)
[![Build Status](https://travis-ci.org/vitalishapovalov/Typecheck.svg?branch=master)](https://travis-ci.org/vitalishapovalov/Typecheck)

A set of super-simple type checkers. Each checker returns `boolean` value. Most checkers are typescript [type predicates](https://www.typescriptlang.org/docs/handbook/advanced-types.html#using-type-predicates).

## Installation

```bash
npm i -S @js-utilities/typecheck
```

## Usage example

```typescript
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](https://github.com/vitalishapovalov/Typecheck/blob/master/LICENSE)

---
_Source: https://npm.io/package/@js-utilities/typecheck · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
