diff options
Diffstat (limited to 'src/js/utils')
-rw-r--r-- | src/js/utils/elements.js | 7 | ||||
-rw-r--r-- | src/js/utils/events.js | 7 | ||||
-rw-r--r-- | src/js/utils/is.js | 5 | ||||
-rw-r--r-- | src/js/utils/strings.js | 5 |
4 files changed, 18 insertions, 6 deletions
diff --git a/src/js/utils/elements.js b/src/js/utils/elements.js index 2d314ed8..19e98f6f 100644 --- a/src/js/utils/elements.js +++ b/src/js/utils/elements.js @@ -218,7 +218,12 @@ export function matches(element, selector) { return Array.from(document.querySelectorAll(selector)).includes(this); } - const matches = prototype.matches || prototype.webkitMatchesSelector || prototype.mozMatchesSelector || prototype.msMatchesSelector || match; + const matches = + prototype.matches || + prototype.webkitMatchesSelector || + prototype.mozMatchesSelector || + prototype.msMatchesSelector || + match; return matches.call(element, selector); } diff --git a/src/js/utils/events.js b/src/js/utils/events.js index 9009d1cc..9f734f04 100644 --- a/src/js/utils/events.js +++ b/src/js/utils/events.js @@ -113,7 +113,8 @@ export function unbindListeners() { } // Run method when / if player is ready -export function ready () { - return new Promise(resolve => this.ready ? setTimeout(resolve, 0) : on.call(this, this.elements.container, 'ready', resolve)) - .then(() => {}); +export function ready() { + return new Promise( + resolve => (this.ready ? setTimeout(resolve, 0) : on.call(this, this.elements.container, 'ready', resolve)), + ).then(() => {}); } diff --git a/src/js/utils/is.js b/src/js/utils/is.js index d34d3aed..cb2c07c6 100644 --- a/src/js/utils/is.js +++ b/src/js/utils/is.js @@ -47,7 +47,10 @@ const is = { return instanceOf(input, TextTrack) || (!is.nullOrUndefined(input) && is.string(input.kind)); }, url(input) { - return !is.nullOrUndefined(input) && /(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-/]))?/.test(input); + return ( + !is.nullOrUndefined(input) && + /(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-/]))?/.test(input) + ); }, nullOrUndefined(input) { return input === null || typeof input === 'undefined'; diff --git a/src/js/utils/strings.js b/src/js/utils/strings.js index 8ca14ff8..c872498c 100644 --- a/src/js/utils/strings.js +++ b/src/js/utils/strings.js @@ -29,7 +29,10 @@ export function getPercentage(current, max) { // Replace all occurances of a string in a string export function replaceAll(input = '', find = '', replace = '') { - return input.replace(new RegExp(find.toString().replace(/([.*+?^=!:${}()|[\]/\\])/g, '\\$1'), 'g'), replace.toString()); + return input.replace( + new RegExp(find.toString().replace(/([.*+?^=!:${}()|[\]/\\])/g, '\\$1'), 'g'), + replace.toString(), + ); } // Convert to title case |