update: cookie 处理优化

This commit is contained in:
binaryify
2024-04-29 15:23:41 +08:00
parent 2bb5269dfa
commit 7b6e9d90e0
59 changed files with 78 additions and 84 deletions
+8
View File
@@ -14,6 +14,14 @@ module.exports = {
})
return obj
},
cookieObjToString(cookie) {
return Object.keys(cookie)
.map(
(key) =>
`${encodeURIComponent(key)}=${encodeURIComponent(cookie[key])}`,
)
.join('; ')
},
getRandom(num) {
var random = Math.floor(
(Math.random() + Math.floor(Math.random() * 9 + 1)) *