hyper/lib/utils/url-command.js
Philippe Potvin b2f67c73e4 Fix url interpretation (#1259)
* Fix url interpretation

* update regex
2016-12-17 14:17:58 -08:00

17 lines
422 B
JavaScript

import * as regex from './url-regex';
export default function isUrlCommand(shell, data) {
const matcher = regex[shell]; // eslint-disable-line import/namespace
if (undefined === matcher || !data) {
return null;
}
const match = data.match(matcher);
const urlRegex = /((?:https?:\/\/)(?:[-a-z0-9]+\.)*[-a-z0-9]+.*)/;
if (match && urlRegex.test(match[2])) {
return `${match[2]}`;
}
return null;
}