mirror of
https://github.com/qier222/YesPlayMusic.git
synced 2024-11-25 09:41:49 +08:00
18 lines
382 B
JavaScript
18 lines
382 B
JavaScript
module.exports = {
|
|
toBoolean(val) {
|
|
if (typeof val === 'boolean') return val
|
|
if (val === '') return val
|
|
return val === 'true' || val == '1'
|
|
},
|
|
cookieToJson(cookie) {
|
|
if (!cookie) return {}
|
|
let cookieArr = cookie.split(';')
|
|
let obj = {}
|
|
cookieArr.forEach((i) => {
|
|
let arr = i.split('=')
|
|
obj[arr[0]] = arr[1]
|
|
})
|
|
return obj
|
|
},
|
|
}
|