use ??.
This commit is contained in:
1 parent
ab5cb8610b
commit
edce7c4cc7
15 files changed
+30
-29
No files matched your search
+2
-2
@@ -5,11 +5,11 @@ import { Code } from "./types"
|
||||
const http = axios.create({ baseURL: "https://judge0api.hyyz.izhai.net" })
|
||||
|
||||
function encode(str: string) {
|
||||
return btoa(unescape(encodeURIComponent(str || "")))
|
||||
return btoa(unescape(encodeURIComponent(str ?? "")))
|
||||
}
|
||||
|
||||
function decode(bytes: string) {
|
||||
let escaped = escape(atob(bytes || ""))
|
||||
let escaped = escape(atob(bytes ?? ""))
|
||||
try {
|
||||
return decodeURIComponent(escaped)
|
||||
} catch (e) {
|
||||
|
||||
Reference in new issue
Block a user