# throw-error

> Throws something if it’s an Error; otherwise returns it.

Latest version **1.0.0** (published 2018-04-10) · MIT license · 0 weekly downloads

## Install

```sh
npm install throw-error
pnpm add throw-error
yarn add throw-error
bun add throw-error
```

## 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.0.0 |
| Published | 2018-04-10 |
| First published | 2018-04-10 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=6.0.0 |
| Dependencies | 1 |
| Unpacked size | 2.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | John Lamansky |
| Maintainers | lamansky |
| Keywords | throw, error |

## Links

- npm: https://www.npmjs.com/package/throw-error
- Repository: https://github.com/lamansky/throw-error
- Issues: https://github.com/lamansky/throw-error/issues
- npm.io page: https://npm.io/package/throw-error

## Dependencies (1)

- [is-instance-of](https://npm.io/package/is-instance-of.md) ^1.0.1

## Recent versions

- 1.0.0 (latest) — 2018-04-10

## README

# throw-error

Throws something if it’s an Error; otherwise returns it.

## Installation

Requires [Node.js](https://nodejs.org/) 6.0.0 or above.

```bash
npm i throw-error
```

## API

The module exports a single function.

### Parameter

`x` (any): A value which may or may not be an Error object.

### Return Value

Returns `x` only if it isn’t an Error.

## Example

```javascript
const throwError = require('throw-error')

throwError('not an error') // 'not an error'
throwError(new Error()) // Uncaught Error
```

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