throw-if-missing

1.1.0 • Public • Published

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.

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.1.0
    500
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.1.0
    500
  • 1.0.1
    0
  • 1.0.0
    0

Package Sidebar

Install

npm i throw-if-missing

Weekly Downloads

500

Version

1.1.0

License

WTFPL

Last publish

Collaborators

  • marktiedemann