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

refactor(helper/html): Prefer Array.isArray over instanceof Array (#3601)

This commit is contained in:
TATSUNO “Taz” Yasuhiro 2024-11-01 10:14:44 +09:00 committed by GitHub
parent 4dd8b2b435
commit c88ead6d72
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -17,8 +17,9 @@ export const html = (
for (let i = 0, len = strings.length - 1; i < len; i++) {
buffer[0] += strings[i]
const children =
values[i] instanceof Array ? (values[i] as Array<unknown>).flat(Infinity) : [values[i]]
const children = Array.isArray(values[i])
? (values[i] as Array<unknown>).flat(Infinity)
: [values[i]]
for (let i = 0, len = children.length; i < len; i++) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const child = children[i] as any