@octod/typeguards
Version:
Everyday use typeguards for your JavaScript and TypeScript codebase
55 lines (34 loc) • 1.18 kB
Markdown
typeguards
==========
Everyday use typeguards for your JavaScript and TypeScript codebase
This library grants you a list of typeguards functions to check if certain data are of a certain type
```bash
npm i @octod/typeguards
yarn add @octod/typeguards
```
You can read docs [here](./docs/README.md), just remember to run your `npm run docs` script.
```typescript
// maybe-a-hello-world.ts
export default function maybeAnHelloWorld() {
console.log('hello world');
}
// app.ts
import * as guards from 'typeguards';
import maybeAnHelloWorld from './maybe-a-hello-world';
if (guards.isFunction(maybeAnHelloWorld)) {
maybeAnHelloWorld(); // logs hello world
}
```
Every contribution is really welcome!
If you feel that something can be improved or should be fixed, feel free to open an issue with the feature or the bug found.
If you want to fork and open a pull request (adding features or fixes), feel free to do it. Remember only to use the `dev` branch as a base.
Read the [contributing guidelines](./CONTRIBUTING.md)
# 📃 Licence
Read the [licence](./LICENCE)