Commit 35240726 authored by SeeBenj's avatar SeeBenj

Merge branch 'updateOHURL' into 'develop'

Promis fix for opening hours converter

See merge request !153
parents 19e61019 14d49f19
Pipeline #76373443 passed with stages
in 11 minutes and 17 seconds
......@@ -913,21 +913,19 @@ function getSourceAsDom(url) {
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
*/
export default function isURL(url){
export default async function isURL(url) {
const UrlRegex = new RegExp('^(?:(?:(?:https?|ftp):)?\\/\\/)(?:(?:[1-9]\\d?' +
'|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[1-9]' +
'\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z0-9\u00a1-\uffff][a-z0-9\u00a1-\uffff_-]' +
'{0,62})?[a-z0-9\u00a1-\uffff]\\.)+(?:[a-z\u00a1-\uffff]{2,}\\.?))', 'gm');
let output = '';
if(url !== '') {
if (url !== '') {
const input = url + '';
if (input.match(UrlRegex)) {
const fetched = getSourceAsDom(input);
fetched.then((result) =>{
output = handelShemaOrg(result);
});
const fetched = await getSourceAsDom(input);
output = handelShemaOrg(fetched);
} else if (input.match(/[0-9]/g)) {
output = convert(input);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment