Nameless Package Manager

    @bemoje/is-args-defined

    1.0.1 • Public • Published

    @bemoje/is-args-defined

    Returns whether or not the passed arguments are defined - ie. not undefined

    Version

    NPM version

    Travis CI

    dependencies

    Dependencies

    dependencies

    Stats

    NPM downloads Forks

    Donate

    Buy Me A Beer donate button PayPal donate button

    Installation

    npm install @bemoje/is-args-defined
    npm install --save @bemoje/is-args-defined
    npm install --save-dev @bemoje/is-args-defined

    Usage

    import isArgsDefined from '@bemoje/is-args-defined'
    
    // require arguments for multiple parameters
    function add(a, b) {
    	if (!isArgsDefined(a, b)) {
    		throw new Error('lol')
    	}
    
    	return a + b
    }
    
    // require arguments for single parameter
    function add_safe(a, b) {
    	if (!isArgsDefined(a)) {
    		throw new Error('lol')
    	}
    
    	if (!isArgsDefined(b)) {
    		return a
    	}
    
    	return a + b
    }

    Benchmark

    84800 nanoseconds

    Tests

    Uses Jest to test module functionality. Run tests to get coverage details.

    npm run test

    API

    isArgsDefined

    Returns

    whether or not the passed arguments are defined - ie. not undefined

    Returns

    boolean boolean

    Install

    npm i @bemoje/is-args-defined

    DownloadsWeekly Downloads

    4

    Version

    1.0.1

    License

    MIT

    Unpacked Size

    7.45 kB

    Total Files

    5

    Last publish

    Collaborators

    • bemoje