aboutsummaryrefslogtreecommitdiffstats
path: root/src/js
diff options
context:
space:
mode:
authorAlbin Larsson <mail@albinlarsson.com>2018-06-15 12:48:37 +0200
committerAlbin Larsson <mail@albinlarsson.com>2018-06-15 15:57:10 +0200
commit88735e314646a2aaf0cf38935dcf11eff8290ebd (patch)
treecbd4af8a5daf15e9cdb5a00480c599da14faa195 /src/js
parentc373ed72d78a221c03190e93f1e49d78c1e2b93f (diff)
downloadplyr-88735e314646a2aaf0cf38935dcf11eff8290ebd.tar.lz
plyr-88735e314646a2aaf0cf38935dcf11eff8290ebd.tar.xz
plyr-88735e314646a2aaf0cf38935dcf11eff8290ebd.zip
Replace switch in controls.updateSetting with condition
Diffstat (limited to 'src/js')
-rw-r--r--src/js/controls.js41
1 files changed, 18 insertions, 23 deletions
diff --git a/src/js/controls.js b/src/js/controls.js
index f091555f..efb718fe 100644
--- a/src/js/controls.js
+++ b/src/js/controls.js
@@ -724,32 +724,27 @@ const controls = {
let value = null;
let list = container;
- switch (setting) {
- case 'captions':
- value = this.currentTrack;
- break;
-
- default:
- value = !is.empty(input) ? input : this[setting];
-
- // Get default
- if (is.empty(value)) {
- value = this.config[setting].default;
- }
+ if (setting === 'captions') {
+ value = this.currentTrack;
+ } else {
+ value = !is.empty(input) ? input : this[setting];
- // Unsupported value
- if (!is.empty(this.options[setting]) && !this.options[setting].includes(value)) {
- this.debug.warn(`Unsupported value of '${value}' for ${setting}`);
- return;
- }
+ // Get default
+ if (is.empty(value)) {
+ value = this.config[setting].default;
+ }
- // Disabled value
- if (!this.config[setting].options.includes(value)) {
- this.debug.warn(`Disabled value of '${value}' for ${setting}`);
- return;
- }
+ // Unsupported value
+ if (!is.empty(this.options[setting]) && !this.options[setting].includes(value)) {
+ this.debug.warn(`Unsupported value of '${value}' for ${setting}`);
+ return;
+ }
- break;
+ // Disabled value
+ if (!this.config[setting].options.includes(value)) {
+ this.debug.warn(`Disabled value of '${value}' for ${setting}`);
+ return;
+ }
}
// Get the list if we need to