}) => { const fnName = element.toLowerCase() .replace(/^[#.]*/, '') files.forEach((filename) => { const fileUrl = baseUrl + '/' + filename if (/.js$/.test(filename)) { $.ajax({ dataType: 'script', cache: true, url: fileUrl }).done(() => { global[fnName](element) }) } if (/.css$/.test(filename)) { $('<link />', { rel: 'stylesheet', type: 'text/css', href: fileUrl }).appendTo('head') } }) }