UNPKG

@krowdy-ui/views

Version:

React components that implement Google's Material Design.

13 lines (11 loc) 551 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports["default"] = isExternalURL; function isExternalURL(string) { if (process.env.NODE_ENV !== 'production') if (typeof string !== 'string') { throw new Error('Krowdy-UI: isExternalURL(string) expects a string argument.'); } return new RegExp('^(https?:\\/\\/)?' + '((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|' + '((\\d{1,3}\\.){3}\\d{1,3}))' + '(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*' + '(\\?[;&a-z\\d%_.~+=-]*)?' + '(\\#[-a-z\\d_]*)?$', 'i').test(string); }