src/yake/tasks.js
function normalizeArguments()
{
    const a = arguments;

    if (debug) debugLog(`normalizeArguments: arguments:${util.inspect(arguments)}`);
    if (debug) debugLog(`normalizeArguments: a0: ${a[0]} a1:${a[1]} a2:${a[2]} a3:${a[3]}`);
    if (debug) debugLog(`normalizeArguments: a0: ${typeof a[0]} a1:${typeof a[1]} a2:${typeof a[2]} a3:${typeof a[3]}`);
    if (debug)
    {
        debugLog(`normalizeArguments:`
        + ` a0: ${typeof a[0]} a1:${typeof a[1]} a2:${Array.isArray(a[2])} a3:${typeof a[3]}`);
    }

    let args = {
        name : '',
        description : '',
        prereqs : [],
        /* eslint-disable no-empty-function */
        action : function action() {},
        /* eslint-enable no-empty-function */

    };

    if ((a.length === 4)
        && (typeof a[3] === 'function')
        && (Array.isArray(a[2]))
        && (typeof a[1] === 'string')
        && (typeof a[0] === 'string'))
    {
        // all 4 arguments provided and of the correct type
        args.name = a[0];
        args.description = a[1];
        args.prereqs = a[2];
        args.action = a[3];
    }
    else if ((a.length === 3)
        && (typeof a[2] === 'function')
        && (Array.isArray(a[1]))
        && (typeof a[0] === 'string'))
    {
        // only 3 arguments types string, array, function
        args.name = a[0];
        args.prereqs = a[1];
        args.action = a[2];
    }
    else if ((a.length === 3)
        && (typeof a[2] === 'function')
        && (typeof a[1] === 'string')
        && (typeof a[0] === 'string'))
    {
        // only 3 arguments types string string, function
        args.name = a[0];
        args.description = a[1];
        args.action = a[2];
    }
    else if ((a.length === 2)
        && (typeof a[1] === 'function')
        && (typeof a[0] === 'string'))
    {
        // only 2 arguments - they must be -  types string, function
        args.name = a[0];
        args.action = a[1];
    }
    else
    {
        args = undefined;
    }

    return args;
}
function normalizeArguments()
{
    const a = arguments;

    if (debug) debugLog(`normalizeArguments: arguments:${util.inspect(arguments)}`);
    if (debug) debugLog(`normalizeArguments: a0: ${a[0]} a1:${a[1]} a2:${a[2]} a3:${a[3]}`);
    if (debug) debugLog(`normalizeArguments: a0: ${typeof a[0]} a1:${typeof a[1]} a2:${typeof a[2]} a3:${typeof a[3]}`);
    if (debug)
    {
        debugLog(`normalizeArguments:`
        + ` a0: ${typeof a[0]} a1:${typeof a[1]} a2:${Array.isArray(a[2])} a3:${typeof a[3]}`);
    }

    let args = {
        name : '',
        description : '',
        prereqs : [],
        /* eslint-disable no-empty-function */
        action : function action() {},
        /* eslint-enable no-empty-function */

    };

    if ((a.length === 4)
        && (typeof a[3] === 'function')
        && (Array.isArray(a[2]))
        && (typeof a[1] === 'string')
        && (typeof a[0] === 'string'))
    {
        // all 4 arguments provided and of the correct type
        args.name = a[0];
        args.description = a[1];
        args.prereqs = a[2];
        args.action = a[3];
    }
    else if ((a.length === 3)
        && (typeof a[2] === 'function')
        && (Array.isArray(a[1]))
        && (typeof a[0] === 'string'))
    {
        // only 3 arguments types string, array, function
        args.name = a[0];
        args.prereqs = a[1];
        args.action = a[2];
    }
    else if ((a.length === 3)
        && (typeof a[2] === 'function')
        && (typeof a[1] === 'string')
        && (typeof a[0] === 'string'))
    {
        // only 3 arguments types string string, function
        args.name = a[0];
        args.description = a[1];
        args.action = a[2];
    }
    else if ((a.length === 2)
        && (typeof a[1] === 'function')
        && (typeof a[0] === 'string'))
    {
        // only 2 arguments - they must be -  types string, function
        args.name = a[0];
        args.action = a[1];
    }
    else
    {
        args = undefined;
    }

    return args;
}
function normalizeArguments ( ) { const a = arguments ; if ( debug ) debugLog ( ` ${ util . inspect ( arguments ) } ` ) ; if ( debug ) debugLog ( ` ${ a [ 0 ] } ${ a [ 1 ] } ${ a [ 2 ] } ${ a [ 3 ] } ` ) ; if ( debug ) debugLog ( ` ${ typeof a [ 0 ] } ${ typeof a [ 1 ] } ${ typeof a [ 2 ] } ${ typeof a [ 3 ] } ` ) ; if ( debug ) { debugLog ( ` ` + ` ${ typeof a [ 0 ] } ${ typeof a [ 1 ] } ${ Array . isArray ( a [ 2 ] ) } ${ typeof a [ 3 ] } ` ) ; } let args = { name : '' , description : '' , prereqs : [ ] , /* eslint-disable no-empty-function */ action : function action ( ) { } , /* eslint-enable no-empty-function */ } ; if ( ( a . length === 4 ) && ( typeof a [ 3 ] === 'function' ) && ( Array . isArray ( a [ 2 ] ) ) && ( typeof a [ 1 ] === 'string' ) && ( typeof a [ 0 ] === 'string' ) ) { // all 4 arguments provided and of the correct type args . name = a [ 0 ] ; args . description = a [ 1 ] ; args . prereqs = a [ 2 ] ; args . action = a [ 3 ] ; } else if ( ( a . length === 3 ) && ( typeof a [ 2 ] === 'function' ) && ( Array . isArray ( a [ 1 ] ) ) && ( typeof a [ 0 ] === 'string' ) ) { // only 3 arguments types string, array, function args . name = a [ 0 ] ; args . prereqs = a [ 1 ] ; args . action = a [ 2 ] ; } else if ( ( a . length === 3 ) && ( typeof a [ 2 ] === 'function' ) && ( typeof a [ 1 ] === 'string' ) && ( typeof a [ 0 ] === 'string' ) ) { // only 3 arguments types string string, function args . name = a [ 0 ] ; args . description = a [ 1 ] ; args . action = a [ 2 ] ; } else if ( ( a . length === 2 ) && ( typeof a [ 1 ] === 'function' ) && ( typeof a [ 0 ] === 'string' ) ) { // only 2 arguments - they must be -  types string, function args . name = a [ 0 ] ; args . action = a [ 1 ] ; } else { args = undefined ; } return args ; }
Normalize the arguments passed into the task definition function.
Inside a yakefile tasks are defined with a call like ...

jake.task('name', 'description', ['prerequisite1', ...], function action(){})

The name and action are manditory while the other two - description and [prerequisistes]
are optional.

This function goes through the process of determining which form was given and returns
an object literal with all 4 values provided.

@param {string}              name            Manditory
@param {string}              description     Optional
@param {array of strings}    prerequisistes  Optional
@param {function}            action          Manditory

@return {object}             with keys name, description, prerequisites, action
Normalize the arguments passed into the task definition function . Inside a yakefile tasks are defined with a call like ...