Skip to content
This repository has been archived by the owner on Jan 18, 2024. It is now read-only.

Commit

Permalink
Merge pull request #5 from dada909090/deepsource-fix-da232828
Browse files Browse the repository at this point in the history
Replace `if-else` with ternary operator
  • Loading branch information
dada878 authored May 18, 2022
2 parents a00c999 + 2fc9e25 commit acf830c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
6 changes: 1 addition & 5 deletions scripts/lib/base64.js
Original file line number Diff line number Diff line change
Expand Up @@ -365,11 +365,7 @@ export function encode (str, asciiOnly) {
if (notString) {
return encodeFromBytes(str);
} else {
if (!asciiOnly && /[^\x00-\x7F]/.test(str)) {
return utf8Base64Encode(str);
} else {
return btoa(str);
}
return !asciiOnly && /[^\x00-\x7F]/.test(str) ? utf8Base64Encode(str) : btoa(str);
}
};

Expand Down
4 changes: 2 additions & 2 deletions scripts/mainMenu/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ export function AdminMenu(player) {
break;
};
case (1): {
let isData = function (key) { if (enables.getData(key) == 1) { return false } else return true; };
let boolCvt = function (key) { if (key) return 0; else return 1; }; //奇怪的bug,暫時修改
let isData = function (key) { return enables.getData(key) == 1 ? false : true; };
let boolCvt = function (key) { return key ? 0 : 1; }; //奇怪的bug,暫時修改
let fm = new ui.ModalFormData();
fm.title("開關功能");
let enableList = [];
Expand Down

0 comments on commit acf830c

Please sign in to comment.