0
0
mirror of https://github.com/honojs/hono.git synced 2024-11-21 10:08:58 +01:00

refactor: remove useless spread (#3600)

* refactor: remove useless spread

* refactor: remove useless spread fallback

* refactor(adapter/lambda-edge): remove unneeded ternary operators

* refactor: remove useless fallback

---------

Co-authored-by: EdamAmex <121654029+EdamAme-x@users.noreply.github.com>
This commit is contained in:
TATSUNO “Taz” Yasuhiro 2024-11-01 10:30:49 +09:00 committed by GitHub
parent 1af7e58ae0
commit ae99d86d89
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 6 additions and 9 deletions

View File

@ -141,7 +141,7 @@ const createResult = async (res: Response): Promise<CloudFrontResult> => {
status: res.status.toString(),
headers: convertHeaders(res.headers),
body,
...(isBase64Encoded ? { bodyEncoding: 'base64' } : {}),
...(isBase64Encoded && { bodyEncoding: 'base64' }),
}
}

View File

@ -80,12 +80,8 @@ class ClientRequestImpl {
let methodUpperCase = this.method.toUpperCase()
const headerValues: Record<string, string> = {
...(args?.header ?? {}),
...(typeof opt?.headers === 'function'
? await opt.headers()
: opt?.headers
? opt.headers
: {}),
...args?.header,
...(typeof opt?.headers === 'function' ? await opt.headers() : opt?.headers),
}
if (args?.cookie) {
@ -201,7 +197,7 @@ export const hc = <T extends Hono<any, any, any>>(
const req = new ClientRequestImpl(url, method)
if (method) {
options ??= {}
const args = deepMerge<ClientRequestOptions>(options, { ...(opts.args[1] ?? {}) })
const args = deepMerge<ClientRequestOptions>(options, { ...opts.args[1] })
return req.fetch(opts.args[0], args)
}
return req

View File

@ -44,7 +44,8 @@ const createRenderer =
? jsx(
(props: any) => component(props, c),
{
...{ Layout, ...(props as any) },
Layout,
...(props as any),
},
children as any
)