JSPM

throw-if-missing

1.1.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 351
  • Score
    100M100P100Q98488F
  • License WTFPL

Enforce required parameters or options in ES6.

Package Exports

  • throw-if-missing

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (throw-if-missing) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

throw-if-missing

Enforce required parameters or options in ES6.

Based on An Easier Way to Enforce Required Parameters in ES6.

Installation

npm install throw-if-missing

Quickstart

const x = require('throw-if-missing')

const login = ({ username = x`username`, password = x`password` } = {}) => {}

login({ username: 'C-3PO' }) // ==> Error: Missing password

License

WTFPL – Do What the F*ck You Want to Public License.

Made with ❤️ by @MarkTiedemann.