https://github.com/vitalishapovalov/typecheck
Super-simple type checkers
https://github.com/vitalishapovalov/typecheck
type-predicates typechecking typescript utilities-js utilities-library
Last synced: 2 months ago
JSON representation
Super-simple type checkers
- Host: GitHub
- URL: https://github.com/vitalishapovalov/typecheck
- Owner: vitalishapovalov
- License: mit
- Created: 2019-10-24T18:01:07.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2023-03-05T11:48:37.000Z (almost 3 years ago)
- Last Synced: 2025-07-06T20:54:59.355Z (6 months ago)
- Topics: type-predicates, typechecking, typescript, utilities-js, utilities-library
- Language: TypeScript
- Size: 473 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Type checking library
[](https://badge.fury.io/js/%40js-utilities%2Ftypecheck)
[](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` | `value is T[]` |
| `isObject` | `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` | `value is Map` |
| `isSet` | `value is Set` |
| `isWeakSet` | `value is WeakSet` |
| `isWeakMap` | `value is WeakMap` |
| `isPromise` | `value is Promise` |
## License
[MIT License](https://github.com/vitalishapovalov/Typecheck/blob/master/LICENSE)