diff options
author | Danielh112 <Daniel@sbgsportssoftware.com> | 2020-08-18 11:29:25 +0100 |
---|---|---|
committer | Danielh112 <Daniel@sbgsportssoftware.com> | 2020-08-18 11:29:25 +0100 |
commit | f7e9ee56d2ed5447f59e5548f005fabdab2f0a72 (patch) | |
tree | a16300fa62e68b3310ae96e36dba65981f0024ef /src/js/utils/is.js | |
parent | 22af7f16ea4a4269321d29242d63ec23718c92da (diff) | |
parent | 423b7b276f1572eb666de32094a9aacd32e87d18 (diff) | |
download | plyr-f7e9ee56d2ed5447f59e5548f005fabdab2f0a72.tar.lz plyr-f7e9ee56d2ed5447f59e5548f005fabdab2f0a72.tar.xz plyr-f7e9ee56d2ed5447f59e5548f005fabdab2f0a72.zip |
Fix merge conflicts
Diffstat (limited to 'src/js/utils/is.js')
-rw-r--r-- | src/js/utils/is.js | 80 |
1 files changed, 40 insertions, 40 deletions
diff --git a/src/js/utils/is.js b/src/js/utils/is.js index b005cd31..1cc33848 100644 --- a/src/js/utils/is.js +++ b/src/js/utils/is.js @@ -19,54 +19,54 @@ const isEvent = input => instanceOf(input, Event); const isKeyboardEvent = input => instanceOf(input, KeyboardEvent); const isCue = input => instanceOf(input, window.TextTrackCue) || instanceOf(input, window.VTTCue); const isTrack = input => instanceOf(input, TextTrack) || (!isNullOrUndefined(input) && isString(input.kind)); -const isPromise = input => instanceOf(input, Promise); +const isPromise = input => instanceOf(input, Promise) && isFunction(input.then); const isEmpty = input => - isNullOrUndefined(input) || - ((isString(input) || isArray(input) || isNodeList(input)) && !input.length) || - (isObject(input) && !Object.keys(input).length); + isNullOrUndefined(input) || + ((isString(input) || isArray(input) || isNodeList(input)) && !input.length) || + (isObject(input) && !Object.keys(input).length); const isUrl = input => { - // Accept a URL object - if (instanceOf(input, window.URL)) { - return true; - } + // Accept a URL object + if (instanceOf(input, window.URL)) { + return true; + } - // Must be string from here - if (!isString(input)) { - return false; - } + // Must be string from here + if (!isString(input)) { + return false; + } - // Add the protocol if required - let string = input; - if (!input.startsWith('http://') || !input.startsWith('https://')) { - string = `http://${input}`; - } + // Add the protocol if required + let string = input; + if (!input.startsWith('http://') || !input.startsWith('https://')) { + string = `http://${input}`; + } - try { - return !isEmpty(new URL(string).hostname); - } catch (e) { - return false; - } + try { + return !isEmpty(new URL(string).hostname); + } catch (e) { + return false; + } }; export default { - nullOrUndefined: isNullOrUndefined, - object: isObject, - number: isNumber, - string: isString, - boolean: isBoolean, - function: isFunction, - array: isArray, - weakMap: isWeakMap, - nodeList: isNodeList, - element: isElement, - textNode: isTextNode, - event: isEvent, - keyboardEvent: isKeyboardEvent, - cue: isCue, - track: isTrack, - promise: isPromise, - url: isUrl, - empty: isEmpty, + nullOrUndefined: isNullOrUndefined, + object: isObject, + number: isNumber, + string: isString, + boolean: isBoolean, + function: isFunction, + array: isArray, + weakMap: isWeakMap, + nodeList: isNodeList, + element: isElement, + textNode: isTextNode, + event: isEvent, + keyboardEvent: isKeyboardEvent, + cue: isCue, + track: isTrack, + promise: isPromise, + url: isUrl, + empty: isEmpty, }; |