# arc-is

> Simple is() function for typechecking

Latest version **2.1.0** (published 2025-10-22) · ISC license · 0 weekly downloads

## Install

```sh
npm install arc-is
pnpm add arc-is
yarn add arc-is
bun add arc-is
```

## Health

**Score 60/100 (C)** — status: stable.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 2.1.0 |
| Published | 2025-10-22 |
| First published | 2016-05-12 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 14.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Ian Reid |
| Maintainers | anyuzer |
| Keywords | typechecking |

## Links

- npm: https://www.npmjs.com/package/arc-is
- Repository: https://anyuzer@github.com/anyuzer/arc-is
- Homepage: https://github.com/anyuzer/arc-is#readme
- Issues: https://github.com/anyuzer/arc-is/issues
- npm.io page: https://npm.io/package/arc-is

## Recent versions

- 2.1.0 (latest) — 2025-10-22
- 2.0.0 — 2022-11-04
- 1.0.8 — 2022-03-07
- 1.0.7 — 2022-03-07
- 1.0.6 — 2020-08-20
- 1.0.5 — 2016-10-03
- 1.0.4 — 2016-10-03
- 1.0.3 — 2016-06-17
- 1.0.2 — 2016-05-16
- 1.0.1 — 2016-05-16
- 1.0.0 — 2016-05-12

## README

# arc-is 

A simple, efficient but comprehensive typechecking suite

In addition to native typechecking, it provides reliable behavior for:  
* [ES6 new globally available constructor types] (http://www.ecma-international.org/ecma-262/6.0/#sec-constructor-properties-of-the-global-object)  
* ES6 style classes  
* ES6 extended classes (including native subclasses)  
* NaN, Infinity, Null, Undefined  

## Install

```
$ npm install --save arc-is
```

## Usage
```js
var is = require('arc-is');
is(someUnknownVariable [,returnObjectType]); 
```

**Params**

* `someUnknownVariable` is the variable you want to typecheck.
* `returnObjectType` is optional and tells the function if you want it to return a complex type (non native) if available. If false, is() will always return a lowercase string, otherwise it will return a case sensitive string.


**Examples**
```js
var simpleObj = {};
is(simpleObj); //Returns 'object'
is(simpleObj,true); //Returns 'Object'

var es6global = new Map;
is(es6global); //Returns 'map'
is(es6global,true); //Returns 'Map'

class MyClass{ toString(){ return '[object '+this.constructor.name+']'; } }
is(new MyClass); //Returns 'object'
is(new MyClass,true); //Returns 'MyClass';

class MyArray extends Array{ return '[object '+this.constructor.name+']'; } }
is(new MyArray); //Returns 'array'
is(new MyArray,true); //Returns 'MyArray'
```

## Caveats
* It is far more efficient to not check for a complexType
* If a class does not overwrite the toString() method, it will return the parent's toString() which will likely be Object
* This goes for natively extended globally available classes such as the Error subclasses (ie. TypeError), as these do not overwrite the toString() method, they return the parent's toString() which is Error
* For is() to return the appropriate class name, toString must return the name in the format of '[object $NAME]' which is standard for all native classes

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