default-args

    1.0.1 • Public • Published

    default-args

    Version CodeFactor Snyk Vulnerabilities for GitHub Repo bundlephobia

    Downloads Node LICENSE

    A simple function for providing defaults to an options to argument. No dependencies, tiny amount of code.

    Usage

    import defaults from 'default-args';
    
    function helloWorld(options) {
        options = defaults({
            foo: true,
            bar: {
                a: 1,
                b: 2,
            },
        }, options);
    
        // do something with options
    }

    Installation

    NPM

    npm install default-args
    

    Yarn

    yarn add default-args
    

    CDN

    <script type="text/javascript" src="https://unpkg.com/default-args/"></script>
    

    Packages

    File Module Type Transpiled Source Maps
    dist/default-args.esm.mjs esm No No
    dist/default-args.cjs.js cjs Yes Yes
    dist/default-args.esm.js esm Yes Yes
    dist/default-args.js umd Yes Yes

    License

    The code is available under the MIT license.

    Contributing

    We are open to contributions, see CONTRIBUTING.md for more info.

    Install

    npm i default-args

    DownloadsWeekly Downloads

    3

    Version

    1.0.1

    License

    MIT

    Unpacked Size

    25.8 kB

    Total Files

    10

    Last publish

    Collaborators

    • vitim