Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/itsjonq/is

💡 A tiny type checker for JavaScript
https://github.com/itsjonq/is

check check-type checker is javascript plain-object tiny type type-check type-checker types

Last synced: about 1 month ago
JSON representation

💡 A tiny type checker for JavaScript

Awesome Lists containing this project

README

        

# 💡 is

[![Build Status](https://travis-ci.org/ItsJonQ/is.svg?branch=master)](https://travis-ci.org/ItsJonQ/is)
[![codecov](https://codecov.io/gh/ItsJonQ/is/branch/master/graph/badge.svg)](https://codecov.io/gh/ItsJonQ/is)
[![Bundle size](https://badgen.net/bundlephobia/minzip/@itsjonq/is)](https://bundlephobia.com/result?p=@itsjonq/is)

> A tiny type checker

`is` is a simple sub 400B type checking library for JavaScript.

For a more feature-packed version, check out [@sindresorhus/is](https://github.com/sindresorhus/is).

## Table of Contents

- [Installation](#installation)
- [Usage](#usage)
- [Supported types](#supported-types)

## Installation

```
npm install @itsjonq/is
```

## Usage

```js
import is from '@itsjonq/is';

is.string('Hello');
// true

const fn = () => 'Nope';

is.string(fn);
// false
is.function(fn);
// true
is.object(fn);
// true
is.plainObject(fn);
// false
```

### Supported types

- `is.array`
- `is.blob`
- `is.boolean`
- `is.defined`
- `is.file`
- `is.function`
- `is.map`
- `is.null`
- `is.number`
- `is.object`
- `is.plainObject`
- `is.regExp`
- `is.string`
- `is.symbol`
- `is.undefined`
- `is.weakMap`