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

https://github.com/aleclarson/asserttypes

Throw a TypeError if a property is not its expected type(s)
https://github.com/aleclarson/asserttypes

Last synced: 12 months ago
JSON representation

Throw a TypeError if a property is not its expected type(s)

Awesome Lists containing this project

README

          

# assertTypes v2.0.2 ![stable](https://img.shields.io/badge/stability-stable-4EBA0F.svg?style=flat)

Calls [`assertType`](https://github.com/aleclarson/assertType) on each key-value pair in an `Object`.

Does **not** support nested types.

```coffee
const assertTypes = require('assertTypes');

const types = {
foo: Number,
bar: String,
};

assertTypes(obj, types);
```