aboutsummaryrefslogtreecommitdiffstats
path: root/actioncable
diff options
context:
space:
mode:
authorRyan Castner <audiolion@users.noreply.github.com>2019-03-09 14:55:54 -0500
committerGitHub <noreply@github.com>2019-03-09 14:55:54 -0500
commit9333f86adba465fc1cac0fce9a1399f609781f23 (patch)
tree40c2b420e58fe15d8ef83de1514300b1161f11b1 /actioncable
parentc7ca85ef31587e6ca02440a3cc0a8c4524c9a4d7 (diff)
downloadrails-9333f86adba465fc1cac0fce9a1399f609781f23.tar.gz
rails-9333f86adba465fc1cac0fce9a1399f609781f23.tar.bz2
rails-9333f86adba465fc1cac0fce9a1399f609781f23.zip
address pr feedback
change if statement to ternary, use const for consistency, add spacing after ternary expression
Diffstat (limited to 'actioncable')
-rw-r--r--actioncable/app/javascript/action_cable/index.js8
1 files changed, 2 insertions, 6 deletions
diff --git a/actioncable/app/javascript/action_cable/index.js b/actioncable/app/javascript/action_cable/index.js
index 1fd391a2c9..e9892ee821 100644
--- a/actioncable/app/javascript/action_cable/index.js
+++ b/actioncable/app/javascript/action_cable/index.js
@@ -30,12 +30,8 @@ export function getConfig(name) {
}
export function createWebSocketURL(url) {
- let webSocketURL
- if (typeof url === 'function') {
- webSocketURL = url()
- } else {
- webSocketURL = url
- }
+ const webSocketURL = typeof url === 'function' ? url() : url;
+
if (webSocketURL && !/^wss?:/i.test(webSocketURL)) {
const a = document.createElement("a")
a.href = webSocketURL