# @distributed-systems/types

> Reliable & easy Js & ES Type detection

Latest version **3.0.0** (published 2025-10-28) · MIT license · 0 weekly downloads

## Install

```sh
npm install @distributed-systems/types
pnpm add @distributed-systems/types
yarn add @distributed-systems/types
bun add @distributed-systems/types
```

## Health

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

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

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 3.0.0 |
| Published | 2025-10-28 |
| First published | 2018-09-16 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 30.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Michael van der Weg |
| Maintainers | ee |
| Keywords | type, type-detection, es6 |

## Links

- npm: https://www.npmjs.com/package/@distributed-systems/types
- Repository: https://github.com/eventEmitter/ee-types
- Homepage: https://github.com/eventEmitter/ee-types#readme
- Issues: https://github.com/eventEmitter/ee-types/issues
- npm.io page: https://npm.io/package/@distributed-systems/types

## 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

- 3.0.0 (latest) — 2025-10-28
- 2.0.1 — 2020-01-09
- 2.0.0 — 2019-08-15
- 1.0.0 — 2018-09-16

## README

# types

Easy and reliable type detection with ES6+ support.



## Importing

```javascript
import types from '@distributed-systems/types';
```


## API

Be aware that the different object types like Maps, Promises and so on are not 
detected as objects but as their respective type. If you need to detect them as 
objects please use the `types.someObject()` method instead of the `types.object()`
method.

Explicitly test for a type.

```javascript
types.array([]) // true
```


Get the type of some variable

```javascript
types(/[a-z]+/gi) // regexp
``` 



## Supported Types

- string
- number
- boolean
- array
- intArray
- floatArray
- object
- function
- symbol
- date
- regexp
- error
- undefined
- buffer
- null
- arrayBuffer
- map
- weakMap
- set
- weakSet
- dataView
- float32Array
- float64Array
- int8Array
- int16Array
- int32Array
- uInt8Array
- uInt16Array
- uInt32Array
- uInt8ClampedArray
- generator
- promise
- someObject


#### Object Types

Since many of the types defined by javascript are just special 
objects that also can be treated as normal objects ee-types has 
a bunch of methods that allow you to handle that correctly.

For example, `Map` is an object, or a custom class where you 
define a getter that returns a specific name for your object:

```javascript
const X = class {
    get [Symbol.toStringTag]() {
        return 'AQL query';;
    }
};

console.log(Object.prototype.toString.call(new X()));
// prints: [object AQL Query]
```

##### Check for a classic object

```javascript
types.object({}); // true
types.object(new Map()); // false

// be aware that if you are not explicitly testing
// for an object any object will be treated as one
types({}) // 'object'
types(new Map()) // 'object'

```


##### Check any type of object

```javascript
types.someObject({}); // true
types.someObject(new Map()); // false
types(new Map()) // 'object'

```



## Examples


```javascript
var types = require('ee-types');


types.string('nope');                // true
types.strign(new String('yeah'));    // true


types(2) // number

types([]]) // array
types(new Array()]) // array
types(new Int8Array()]) // int8Array


types.promise(Promise.all()) // true
```

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