immutable.js
function processArguments(props, args, defaults) {

    debug('processArguments',props,args,defaults);

    values = Object.assign({}, defaults);
    let properties = Object.getOwnPropertyNames(values);

    // First execute any single-arg functions to create dynamic defaults
    for (property of properties) {
        let value = values[property];
        if (typeof value === 'function' && value.length === 0) 
            values[property] = value();
    }

    // Then expand a single argument that is an object into a set of values
    if (args.length === 1 && typeof args[0] === 'object') {
        Object.assign(values, args[0]);
    } else {
    // Or assign arguments to properties in order
        for (i = 0; i < Math.min(args.length, props.length); i++)
            values[props[i]] = args[i];
    }

    debug('processArguments returns',values);
    return values;
}
function processArguments(props, args, defaults) {

    debug('processArguments',props,args,defaults);

    values = Object.assign({}, defaults);
    let properties = Object.getOwnPropertyNames(values);

    // First execute any single-arg functions to create dynamic defaults
    for (property of properties) {
        let value = values[property];
        if (typeof value === 'function' && value.length === 0) 
            values[property] = value();
    }

    // Then expand a single argument that is an object into a set of values
    if (args.length === 1 && typeof args[0] === 'object') {
        Object.assign(values, args[0]);
    } else {
    // Or assign arguments to properties in order
        for (i = 0; i < Math.min(args.length, props.length); i++)
            values[props[i]] = args[i];
    }

    debug('processArguments returns',values);
    return values;
}
function processArguments ( props , args , defaults ) { debug ( 'processArguments' , props , args , defaults ) ; values = Object . assign ( { } , defaults ) ; let properties = Object . getOwnPropertyNames ( values ) ; // First execute any single-arg functions to create dynamic defaults for ( property of properties ) { let value = values [ property ] ; if ( typeof value === 'function' && value . length === 0 ) values [ property ] = value ( ) ; } // Then expand a single argument that is an object into a set of values if ( args . length === 1 && typeof args [ 0 ] === 'object' ) { Object . assign ( values , args [ 0 ] ) ; } else { // Or assign arguments to properties in order for ( i = 0 ; i < Math . min ( args . length , props . length ) ; i ++ ) values [ props [ i ] ] = args [ i ] ; } debug ( 'processArguments returns' , values ) ; return values ; }
Handle case where we have a single argument containing an object.

Basically, merge properties in args[0] into defaults, iff we have a single argument and it is an object.
Handle case where we have a single argument containing an object .