History

Sanity-check decaffeinate class CookiesStore

Simon Legner committed 2 years ago

Commit c1a424f1 parent c595b2b1 file · +2 −12Browse files

Unified · Split

assets/javascripts/lib/cookies_store.js+2−12
@@ -1,13 +1,3 @@
1−// TODO: This file was created by bulk-decaffeinate.
2−// Sanity-check the conversion and remove this comment.
3−/*
4− * decaffeinate suggestions:
5− * DS101: Remove unnecessary use of Array.from
6− * DS102: Remove unnecessary code created because of implicit returns
7− * DS206: Consider reworking classes to avoid initClass
8− * DS207: Consider shorter variations of null checks
9− * Full docs: https://github.com/decaffeinate/decaffeinate/blob/main/docs/suggestions.md
10− */
111 // Intentionally called CookiesStore instead of CookieStore
122 // Calling it CookieStore causes issues when the Experimental Web Platform features flag is enabled in Chrome
133 // Related issue: https://github.com/freeCodeCamp/devdocs/issues/932
@@ -53,7 +43,7 @@ class CookiesStore { · 39 unmodified lines
5343
5444 reset() {
5545 try {
56− for (var cookie of Array.from(document.cookie.split(/;\s?/))) {
46+ for (var cookie of document.cookie.split(/;\s?/)) {
5747 Cookies.expire(cookie.split("=")[0]);
5848 }
5949 return;
@@ -62,7 +52,7 @@ class CookiesStore { · 2 unmodified lines
6252
6353 dump() {
6454 const result = {};
65− for (var cookie of Array.from(document.cookie.split(/;\s?/))) {
55+ for (var cookie of document.cookie.split(/;\s?/)) {
6656 if (cookie[0] !== "_") {
6757 cookie = cookie.split("=");
6858 result[cookie[0]] = cookie[1];