Next Perpendicular Moonlanding
    Have ideas to improve npm?Join in the discussion! »

    @small-tech/required

    1.0.3 • Public • Published

    @small-tech/required

    Fail-fast on missing required arguments in JavaScript using default values that throw.

    Read the blog post.

    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.

    License

    MIT

    Install

    npm i @small-tech/required

    DownloadsWeekly Downloads

    6

    Version

    1.0.3

    License

    MIT

    Unpacked Size

    4.8 kB

    Total Files

    7

    Last publish

    Collaborators

    • avatar