function createLoadFilesFunction(cfg) {
    const loadResources = cfg.modern && cfg.modern.files ? createLoadFiles(cfg.modern.files) : '';
    if (!cfg.legacy || cfg.legacy.length === 0) {
        return loadResources;
    }
    function reduceFn(all, current, i) {
        return `${all}${i !== 0 ? ' else ' : ''}if (${current.test}) {
      ${createLoadFiles(current.files)}
    }`;
    }
    const loadLegacyResources = cfg.legacy.reduce(reduceFn, '');
    return `${loadLegacyResources} else {
      ${loadResources}
    }`;
}
/**
 * Creates js code which loads the correct resources, uses runtime feature detection
 * of legacy resources are configured to load the appropriate resources.
 */
Creates js code which loads the correct resources, uses runtime feature detection
of legacy resources are configured to load the appropriate resources.
Creates js code which loads the correct resources uses runtime feature detection of legacy resources are configured to load the appropriate resources .
function createLoadFilesFunction(cfg) {
    const loadResources = cfg.modern && cfg.modern.files ? createLoadFiles(cfg.modern.files) : '';
    if (!cfg.legacy || cfg.legacy.length === 0) {
        return loadResources;
    }
    function reduceFn(all, current, i) {
        return `${all}${i !== 0 ? ' else ' : ''}if (${current.test}) {
      ${createLoadFiles(current.files)}
    }`;
    }
    const loadLegacyResources = cfg.legacy.reduce(reduceFn, '');
    return `${loadLegacyResources} else {
      ${loadResources}
    }`;
}
function createLoadFilesFunction ( cfg ) { const loadResources = cfg . modern && cfg . modern . files ? createLoadFiles ( cfg . modern . files ) : '' ; if ( ! cfg . legacy || cfg . legacy . length === 0 ) { return loadResources ; } function reduceFn ( all , current , i ) { return ` ${ all } ${ i !== 0 ? ' else ' : '' } ${ current . test } ${ createLoadFiles ( current . files ) } ` ; } const loadLegacyResources = cfg . legacy . reduce ( reduceFn , '' ) ; return ` ${ loadLegacyResources } ${ loadResources } ` ; }
Creates js code which loads the correct resources, uses runtime feature detection
 of legacy resources are configured to load the appropriate resources.
Creates js code which loads the correct resources uses runtime feature detection of legacy resources are configured to load the appropriate resources .