lib/boilerplate.view.js
function generate( arr, comment, _indent ) {
    try {
        const indent = typeof _indent !== "undefined" ? _indent : "  ";
        if ( arr.length === 0 ) return "";
        let out = '';
        if ( comment && comment.length > 0 ) {
            let
                len = comment.length + 3,
                dashes = '';
            while ( len-- > 0 ) dashes += "-";
            out += `${indent}//${dashes}\n${indent}// ${comment}.\n`;
        }
        arr.forEach( function ( line ) {
            if ( Array.isArray( line ) ) {
                out += generate( line, null, `  ${indent}` );
            } else {
                out += `${indent}${line}\n`;
            }
        } );
        return out;
    } catch ( ex ) {
        throw ex + "\n...in generate: " + JSON.stringify( comment );
    }
}
function generate( arr, comment, _indent ) {
    try {
        const indent = typeof _indent !== "undefined" ? _indent : "  ";
        if ( arr.length === 0 ) return "";
        let out = '';
        if ( comment && comment.length > 0 ) {
            let
                len = comment.length + 3,
                dashes = '';
            while ( len-- > 0 ) dashes += "-";
            out += `${indent}//${dashes}\n${indent}// ${comment}.\n`;
        }
        arr.forEach( function ( line ) {
            if ( Array.isArray( line ) ) {
                out += generate( line, null, `  ${indent}` );
            } else {
                out += `${indent}${line}\n`;
            }
        } );
        return out;
    } catch ( ex ) {
        throw ex + "\n...in generate: " + JSON.stringify( comment );
    }
}
function generate ( arr , comment , _indent ) { try { const indent = typeof _indent !== "undefined" ? _indent : "  " ; if ( arr . length === 0 ) return "" ; let out = '' ; if ( comment && comment . length > 0 ) { let len = comment . length + 3 , dashes = '' ; while ( len -- > 0 ) dashes += "-" ; out += ` ${ indent } ${ dashes } \n ${ indent } ${ comment } \n ` ; } arr . forEach ( function ( line ) { if ( Array . isArray ( line ) ) { out += generate ( line , null , ` ${ indent } ` ) ; } else { out += ` ${ indent } ${ line } \n ` ; } } ) ; return out ; } catch ( ex ) { throw ex + "\n...in generate: " + JSON . stringify ( comment ) ; } }
Return the code from an array and an identation.
The code is preceded by a comment.

@param {array} arr - Array of strings and/or arrays.
@param {string} comment - Heading comment. Optional.
@param {string} _indent - Indetation before each line.

@returns {string} Readable Javascript code.
Return the code from an array and an identation . The code is preceded by a comment .