# throw-if-missing

> Enforce required parameters or options in ES6.

Latest version **1.1.0** (published 2016-12-02) · WTFPL license · 0 weekly downloads

## Install

```sh
npm install throw-if-missing
pnpm add throw-if-missing
yarn add throw-if-missing
bun add throw-if-missing
```

## 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 | 2016-12-02 |
| First published | 2016-06-17 |
| Weekly downloads | 0 |
| License | WTFPL |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 12 |
| Author | Mark Tiedemann |
| Maintainers | marktiedemann |
| Keywords | throw, if, missing, required, parameters, enforce, default, es6 |

## Links

- npm: https://www.npmjs.com/package/throw-if-missing
- Repository: https://github.com/MarkTiedemann/throw-if-missing
- Issues: https://github.com/MarkTiedemann/throw-if-missing/issues
- npm.io page: https://npm.io/package/throw-if-missing

## Alternatives

- [update-check](https://npm.io/package/update-check.md) — 4.0M weekly downloads
- [react-native-onesignal](https://npm.io/package/react-native-onesignal.md) — 134.5K weekly downloads
- [react-redux-toastr](https://npm.io/package/react-redux-toastr.md) — 33.7K weekly downloads
- [@nocobase/plugin-notification-manager](https://npm.io/package/@nocobase/plugin-notification-manager.md) — 2.0K weekly downloads
- [react-simple-toasts](https://npm.io/package/react-simple-toasts.md) — 1.9K weekly downloads

## Recent versions

- 1.1.0 (latest) — 2016-12-02
- 1.0.1 — 2016-06-17
- 1.0.0 — 2016-06-17

## README

# throw-if-missing

**Enforce required parameters or options in ES6.**

Based on [An Easier Way to Enforce Required Parameters in ES6](https://gist.github.com/MarkTiedemann/17ebf5b38b5b7566478de7f623e1defd).

## Installation

```
npm install throw-if-missing
```

## Quickstart

```js
const x = require('throw-if-missing')

const login = ({ username = x`username`, password = x`password` } = {}) => {}

login({ username: 'C-3PO' }) // ==> Error: Missing password
```

## License

[WTFPL](http://www.wtfpl.net/) – Do What the F*ck You Want to Public License.

Made with :heart: by [@MarkTiedemann](https://twitter.com/MarkTiedemannDE).

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