Skip to content

Commit

Permalink
fix: define to avoid hoisting
Browse files Browse the repository at this point in the history
  • Loading branch information
cakasuma committed Nov 24, 2020
1 parent 98d795f commit 61bad97
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion scripts/cookie.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@ function getCookie(name) {
const dc = document.cookie;
const prefix = name + "=";
let begin = dc.indexOf("; " + prefix);
let end = null
if (begin == -1) {
begin = dc.indexOf(prefix);
if (begin != 0) return null;
} else {
begin += 2;
let end = document.cookie.indexOf(";", begin);
end = document.cookie.indexOf(";", begin);
if (end == -1) {
end = dc.length;
}
Expand Down

0 comments on commit 61bad97

Please sign in to comment.