# instance-of

> Use Instance Of by type name

Latest version **1.1.0** (published 2020-02-08) · MIT license · 0 weekly downloads

## Install

```sh
npm install instance-of
pnpm add instance-of
yarn add instance-of
bun add instance-of
```

## 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 | 1.1.0 |
| Published | 2020-02-08 |
| First published | 2014-02-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 3.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Rob Halff |
| Maintainers | rhalff |
| Keywords | instanceof, instance, type, validation, validate |

## Links

- npm: https://www.npmjs.com/package/instance-of
- Repository: https://github.com/rhalff/instance-of
- Homepage: https://github.com/rhalff/instance-of#readme
- Issues: https://github.com/rhalff/instance-of/issues
- npm.io page: https://npm.io/package/instance-of

## Alternatives

- [vest](https://npm.io/package/vest.md) — 50.1K weekly downloads
- [@regle/core](https://npm.io/package/@regle/core.md) — 47.0K weekly downloads
- [typeof-arguments](https://npm.io/package/typeof-arguments.md) — 12.5K weekly downloads
- [@lokalise/projects-engine-contracts](https://npm.io/package/@lokalise/projects-engine-contracts.md) — 978 weekly downloads
- [@osjwnpm/nam-laboriosam-quibusdam](https://npm.io/package/@osjwnpm/nam-laboriosam-quibusdam.md) — 70 weekly downloads

## Recent versions

- 1.1.0 (latest) — 2020-02-08
- 1.0.5 — 2014-03-28
- 1.0.4 — 2014-02-11
- 1.0.2 — 2014-02-11
- 1.0.1 — 2014-02-11
- 1.0.0 — 2014-02-11

## README

[![browser support](https://ci.testling.com/rhalff/instance-of.png)](https://ci.testling.com/rhalff/instance-of)

## Instance Of
===================================

Usage:

```javascript
var InstanceOf = require('instance-of');

// example objects.
var Stream = require('stream'),
  Util = require('util'),
  Actor = require('chix-flow').Actor,
  stream = new Stream();

function report(obj, type) {
  if(InstanceOf(obj, type)) {
    console.log('YES! is a', type);
  } else {
    console.log('Nope! not a', type);
  }
}

report(stream, 'Stream');
report(Util, 'Object');
report(Util, 'object');
report(true, 'boolean');
report(false, 'boolean');
report(100, 'number');
report("string", 'number');
report(new Array(), 'array');
report(new Array(), 'Array');
report("string", 'string');
report(new Actor(), 'Actor');
report(new Actor(), 'Handler');

YES! is a Stream
YES! is a Object
YES! is a object
YES! is a boolean
YES! is a boolean
YES! is a number
Nope! not a number
YES! is a array
YES! is a Array
YES! is a string
YES! is a Actor
YES! is a Handler

```

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