diff options
author | Sam Potts <me@sampotts.me> | 2018-01-14 23:15:33 +1100 |
---|---|---|
committer | Sam Potts <me@sampotts.me> | 2018-01-14 23:15:33 +1100 |
commit | 22e8892993b995f50c15d49558081e1271ac6bca (patch) | |
tree | 5e2fa1d2a5476b7746743509727a613921a5cc4e /src/js/utils.js | |
parent | cfc86bcb7cc4be3608a08132aaf4946a63594559 (diff) | |
download | plyr-22e8892993b995f50c15d49558081e1271ac6bca.tar.lz plyr-22e8892993b995f50c15d49558081e1271ac6bca.tar.xz plyr-22e8892993b995f50c15d49558081e1271ac6bca.zip |
Code tweaks
Diffstat (limited to 'src/js/utils.js')
-rw-r--r-- | src/js/utils.js | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/js/utils.js b/src/js/utils.js index 930d3e9f..1b64fc8d 100644 --- a/src/js/utils.js +++ b/src/js/utils.js @@ -50,6 +50,9 @@ const utils = { track(input) { return this.instanceof(input, TextTrack) || (!this.nullOrUndefined(input) && this.string(input.kind)); }, + url(input) { + return !this.nullOrUndefined(input) && /(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-/]))?/.test(input); + }, nullOrUndefined(input) { return input === null || typeof input === 'undefined'; }, |