# iftype

> Check types

Latest version **4.0.9** (published 2019-08-02) · MIT license · 0 weekly downloads

## Install

```sh
npm install iftype
pnpm add iftype
yarn add iftype
bun add iftype
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 4.0.9 |
| Published | 2019-08-02 |
| First published | 2015-09-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=8 |
| Dependencies | 0 |
| Unpacked size | 46.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Taka Okunishi |
| Maintainers | okunishinishi |
| Keywords | type, check |

## Links

- npm: https://www.npmjs.com/package/iftype
- Repository: https://github.com/okunishinishi/node-iftype
- Homepage: https://github.com/okunishinishi/node-iftype#readme
- Issues: https://github.com/okunishinishi/node-iftype/issues
- npm.io page: https://npm.io/package/iftype

## Alternatives

- [@openai/codex-sdk](https://npm.io/package/@openai/codex-sdk.md) — 731.4K weekly downloads
- [babel-plugin-transform-react-jsx](https://npm.io/package/babel-plugin-transform-react-jsx.md) — 565.0K weekly downloads
- [babel-helper-remove-or-void](https://npm.io/package/babel-helper-remove-or-void.md) — 508.5K weekly downloads
- [@pnpm/store-controller-types](https://npm.io/package/@pnpm/store-controller-types.md) — 186.9K weekly downloads
- [react-native-signature-canvas](https://npm.io/package/react-native-signature-canvas.md) — 155.6K weekly downloads

## Recent versions

- 4.0.9 (latest) — 2019-08-02
- 4.0.7 — 2019-07-22
- 4.0.5 — 2019-07-04
- 4.0.4 — 2019-07-04
- 4.0.2 — 2019-02-23
- 4.0.1 — 2019-02-23
- 4.0.0 — 2019-02-23
- 3.0.2 — 2016-09-11
- 3.0.1 — 2016-09-11
- 3.0.0 — 2016-07-30
- 2.0.4 — 2016-02-24
- 2.0.3 — 2016-02-24
- 2.0.2 — 2016-02-20
- 2.0.1 — 2015-12-10
- 2.0.0 — 2015-12-10
- … 3 more at https://npm.io/package/iftype/versions

## README

iftype
==========

<!---
This file is generated by ape-tmpl. Do not update manually.
--->

<!-- Badge Start -->
<a name="badges"></a>

[![Build Status][bd_travis_shield_url]][bd_travis_url]
[![npm Version][bd_npm_shield_url]][bd_npm_url]
[![JS Standard][bd_standard_shield_url]][bd_standard_url]

[bd_repo_url]: https://github.com/okunishinishi/node-iftype
[bd_travis_url]: http://travis-ci.org/okunishinishi/node-iftype
[bd_travis_shield_url]: http://img.shields.io/travis/okunishinishi/node-iftype.svg?style=flat
[bd_travis_com_url]: http://travis-ci.com/okunishinishi/node-iftype
[bd_travis_com_shield_url]: https://api.travis-ci.com/okunishinishi/node-iftype.svg?token=
[bd_license_url]: https://github.com/okunishinishi/node-iftype/blob/master/LICENSE
[bd_codeclimate_url]: http://codeclimate.com/github/okunishinishi/node-iftype
[bd_codeclimate_shield_url]: http://img.shields.io/codeclimate/github/okunishinishi/node-iftype.svg?style=flat
[bd_codeclimate_coverage_shield_url]: http://img.shields.io/codeclimate/coverage/github/okunishinishi/node-iftype.svg?style=flat
[bd_gemnasium_url]: https://gemnasium.com/okunishinishi/node-iftype
[bd_gemnasium_shield_url]: https://gemnasium.com/okunishinishi/node-iftype.svg
[bd_npm_url]: http://www.npmjs.org/package/iftype
[bd_npm_shield_url]: http://img.shields.io/npm/v/iftype.svg?style=flat
[bd_standard_url]: http://standardjs.com/
[bd_standard_shield_url]: https://img.shields.io/badge/code%20style-standard-brightgreen.svg

<!-- Badge End -->


<!-- Description Start -->
<a name="description"></a>

Check types

<!-- Description End -->


<!-- Overview Start -->
<a name="overview"></a>



<!-- Overview End -->


<!-- Sections Start -->
<a name="sections"></a>

<!-- Section from "doc/guides/01.Installation.md.hbs" Start -->

<a name="section-doc-guides-01-installation-md"></a>

Installation
-----

```bash
$ npm install iftype --save
```


<!-- Section from "doc/guides/01.Installation.md.hbs" End -->

<!-- Section from "doc/guides/02.Usage.md.hbs" Start -->

<a name="section-doc-guides-02-usage-md"></a>

Usage
---------

```javascript
'use strict'

const iftype = require('iftype')

function CustomType(){
}

//----------------------------
// Check if type is 'string'
//----------------------------
iftype(123).is('string') // => false
iftype(function foo(){}).is('string') // => false
iftype(new CustomType()).is('string') // => false
iftype(["foo", "bar"]).is('string') // => false
iftype("bar").is('string') // => true
iftype(null).is('string') // => false
iftype(undefined).is('string') // => false


//----------------------------
// Check if type is 'number'
//----------------------------
iftype(123).is('number') // => true
iftype(function foo(){}).is('number') // => false
iftype(new CustomType()).is('number') // => false
iftype(["foo", "bar"]).is('number') // => false
iftype("bar").is('number') // => false
iftype(null).is('number') // => false
iftype(undefined).is('number') // => false


//----------------------------
// Check if type is 'object'
//----------------------------
iftype(123).is('object') // => false
iftype(function foo(){}).is('object') // => false
iftype(new CustomType()).is('object') // => true
iftype(["foo", "bar"]).is('object') // => true
iftype("bar").is('object') // => false
iftype(null).is('object') // => false
iftype(undefined).is('object') // => false


//----------------------------
// Check if type is 'array'
//----------------------------
iftype(123).is('array') // => false
iftype(function foo(){}).is('array') // => false
iftype(new CustomType()).is('array') // => false
iftype(["foo", "bar"]).is('array') // => true
iftype("bar").is('array') // => false
iftype(null).is('array') // => false
iftype(undefined).is('array') // => false


//----------------------------
// Check if type is 'function'
//----------------------------
iftype(123).is('function') // => false
iftype(function foo(){}).is('function') // => true
iftype(new CustomType()).is('function') // => false
iftype(["foo", "bar"]).is('function') // => false
iftype("bar").is('function') // => false
iftype(null).is('function') // => false
iftype(undefined).is('function') // => false


//----------------------------
// Check if type is CustomType
//----------------------------
iftype(123).is(CustomType) // => false
iftype(function foo(){}).is(CustomType) // => false
iftype(new CustomType()).is(CustomType) // => true
iftype(["foo", "bar"]).is(CustomType) // => false
iftype("bar").is(CustomType) // => false
iftype(null).is(CustomType) // => false
iftype(undefined).is(CustomType) // => false



```


<!-- Section from "doc/guides/02.Usage.md.hbs" End -->

<!-- Section from "doc/guides/03.API.md.hbs" Start -->

<a name="section-doc-guides-03-api-md"></a>

API
----

| Signature | Description |
| --- | --- |
| iftype(val).is(type) | Check if type match. |
| iftype(val).isString() | Check if string. |
| iftype(val).isNumber() | Check if number. |
| iftype(val).isObject() | Check if object. |
| iftype(val).isArray() | Check if array. |
| iftype.is(type, val) | Check if type match. |
| iftype.isString(val) | Check if string. |
| iftype.isNumber(val) | Check if number. |
| iftype.isObject(val) | Check if object. |
| iftype.isArray(val) | Check if array. |

<!-- Section from "doc/guides/03.API.md.hbs" End -->


<!-- Sections Start -->


<!-- LICENSE Start -->
<a name="license"></a>

License
-------
This software is released under the [MIT License](https://github.com/okunishinishi/node-iftype/blob/master/LICENSE).

<!-- LICENSE End -->


<!-- Links Start -->
<a name="links"></a>

Links
------



<!-- Links End -->

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