split files names out for logs

This commit is contained in:
karl.hudgell 2022-06-18 10:07:51 +01:00
parent 2df901b47e
commit a2f3a9ee69

View File

@ -1,12 +1,16 @@
function checkFileName(urls) {
let urlList = []
let urlObj = {
"fileName": "",
"urlList": []
}
urls.forEach(url => {
let cut = url.match(/([^\/]*$)/mg);
if (cut[0] !== '') {
urlList.push(url)
urlObj.fileName = cut[0].replace('.html', '')
urlObj.urlList.push(url)
}
});
return urlList
return urlObj
}
module.exports = { checkFileName }