mirror of
https://github.com/honojs/hono.git
synced 2024-11-27 16:06:24 +01:00
perf(utils): use | 0
instead of Math.floor
(#3605)
This commit is contained in:
parent
8d775dcdf5
commit
e9830c6ba1
@ -162,7 +162,7 @@ const _serialize = (name: string, value: string, opt: CookieOptions = {}): strin
|
|||||||
'Cookies Max-Age SHOULD NOT be greater than 400 days (34560000 seconds) in duration.'
|
'Cookies Max-Age SHOULD NOT be greater than 400 days (34560000 seconds) in duration.'
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
cookie += `; Max-Age=${Math.floor(opt.maxAge)}`
|
cookie += `; Max-Age=${opt.maxAge | 0}`
|
||||||
}
|
}
|
||||||
|
|
||||||
if (opt.domain && opt.prefix !== 'host') {
|
if (opt.domain && opt.prefix !== 'host') {
|
||||||
|
@ -74,7 +74,7 @@ export const verify = async (
|
|||||||
if (!isTokenHeader(header)) {
|
if (!isTokenHeader(header)) {
|
||||||
throw new JwtHeaderInvalid(header)
|
throw new JwtHeaderInvalid(header)
|
||||||
}
|
}
|
||||||
const now = Math.floor(Date.now() / 1000)
|
const now = (Date.now() / 1000) | 0
|
||||||
if (payload.nbf && payload.nbf > now) {
|
if (payload.nbf && payload.nbf > now) {
|
||||||
throw new JwtTokenNotBefore(token)
|
throw new JwtTokenNotBefore(token)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user