Enforce required parameters or options in ES6.
Based on An Easier Way to Enforce Required Parameters in ES6.
npm install throw-if-missing
const x = require('throw-if-missing')
const login = ({ username = x`username`, password = x`password` } = {}) => {}
login({ username: 'C-3PO' }) // ==> Error: Missing password
WTFPL – Do What the F*ck You Want to Public License.
Made with ❤️ by @MarkTiedemann.