UNPKG

@toolisticon/ssl-hostinfo-prometheus-exporter

Version:

[![License](https://img.shields.io/github/license/mashape/apistatus.svg)](LICENSE) [![CI](https://github.com/toolisticon/ssl-hostinfo-prometheus-exporter/actions/workflows/build.yml/badge.svg)](https://github.com/toolisticon/ssl-hostinfo-prometheus-export

30 lines (27 loc) 526 B
function extractHostnameAndPort (url) { const urlParts = url.split(':'); if (urlParts.length > 1) { return { domain: urlParts[0], port: urlParts[1] }; } else { return { domain: url, port: '443' }; } } function extractHostnamesAndPort (urlList) { const result = []; if (urlList) { urlList.forEach(url => { result.push(extractHostnameAndPort(url)); }); } return result; } module.exports = exports = { extractHostnameAndPort, extractHostnamesAndPort };