0
0
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:
EdamAmex 2024-11-03 07:50:10 +09:00 committed by GitHub
parent 8d775dcdf5
commit e9830c6ba1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 2 deletions

View File

@ -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.'
)
}
cookie += `; Max-Age=${Math.floor(opt.maxAge)}`
cookie += `; Max-Age=${opt.maxAge | 0}`
}
if (opt.domain && opt.prefix !== 'host') {

View File

@ -74,7 +74,7 @@ export const verify = async (
if (!isTokenHeader(header)) {
throw new JwtHeaderInvalid(header)
}
const now = Math.floor(Date.now() / 1000)
const now = (Date.now() / 1000) | 0
if (payload.nbf && payload.nbf > now) {
throw new JwtTokenNotBefore(token)
}