aboutsummaryrefslogtreecommitdiffstats
path: root/src/js/utils/is.js
diff options
context:
space:
mode:
authorSam Potts <sam@potts.es>2020-04-24 00:22:39 +1000
committerGitHub <noreply@github.com>2020-04-24 00:22:39 +1000
commit68137aa789b195b26d4306eaebc7fee2f8eb3374 (patch)
tree8c38683d043fdfbe8b1dcb385a446de4df7396a1 /src/js/utils/is.js
parentdbe618c644a525b196466b7254274cc9bde76275 (diff)
parent2458eaa11b5c2805bcf1e5349ab900485bac325f (diff)
downloadplyr-68137aa789b195b26d4306eaebc7fee2f8eb3374.tar.lz
plyr-68137aa789b195b26d4306eaebc7fee2f8eb3374.tar.xz
plyr-68137aa789b195b26d4306eaebc7fee2f8eb3374.zip
Merge pull request #1770 from sampotts/css-variables
Allow customization via CSS Custom Properties
Diffstat (limited to 'src/js/utils/is.js')
-rw-r--r--src/js/utils/is.js78
1 files changed, 39 insertions, 39 deletions
diff --git a/src/js/utils/is.js b/src/js/utils/is.js
index 24f176cc..1cc33848 100644
--- a/src/js/utils/is.js
+++ b/src/js/utils/is.js
@@ -22,51 +22,51 @@ const isTrack = input => instanceOf(input, TextTrack) || (!isNullOrUndefined(inp
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,
};