From 1b20bebbe5490a8053021d0ffc5590019b5ee73a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Mendon=C3=A7a=20Fran=C3=A7a?= Date: Tue, 12 Sep 2023 19:47:57 +0000 Subject: [PATCH] Apply decaffeinate suggestions to CSRFToken --- lib/assets/javascripts/turbograft/csrf_token.js | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/lib/assets/javascripts/turbograft/csrf_token.js b/lib/assets/javascripts/turbograft/csrf_token.js index 55f0763..6321f4b 100644 --- a/lib/assets/javascripts/turbograft/csrf_token.js +++ b/lib/assets/javascripts/turbograft/csrf_token.js @@ -1,12 +1,6 @@ -/* - * decaffeinate suggestions: - * DS102: Remove unnecessary code created because of implicit returns - * DS207: Consider shorter variations of null checks - * Full docs: https://github.com/decaffeinate/decaffeinate/blob/main/docs/suggestions.md - */ window.CSRFToken = class CSRFToken { static get(doc) { - if (doc == null) { doc = document; } + if (!doc) { doc = document; } const tag = doc.querySelector('meta[name="csrf-token"]'); const object = { @@ -23,7 +17,7 @@ window.CSRFToken = class CSRFToken { static update(latest) { const current = this.get(); if ((current.token != null) && (latest != null) && (current.token !== latest)) { - return current.node.setAttribute('content', latest); + current.node.setAttribute('content', latest); } } };