@small-tech/required
v1.0.3
Published
Add required argument checking to your functions.
Downloads
10
Readme
@small-tech/required
Fail-fast on missing required arguments in JavaScript using default values that throw.
Install
npm i @small-tech/required
Use
const required = require('@small-tech/required')
function foo (puppy = required('puppy')) {
// It’s safe to use puppy from here on.
}
// Output: Error: Missing argument (puppy).
foo()
Features
- Throws errors on missing required arguments.
- 100% code coverage ;P
- Yes, you could just write this yourself.
Like this? Fund us!
Small Technology Foundation is a tiny, independent not-for-profit.
We exist in part thanks to patronage by people like you. If you share our vision and want to support our work, please become a patron or donate to us today and help us continue to exist.
Copyright
© 2020 Aral Balkan, Small Technology Foundation.