xs.flatMap((x) => x == null ? [] : [x])

ではダメですか?

Reply to this note

Please Login to reply.

Discussion

ダメではないですが、それだったら`.filter(isNotNull)`の方が素直なのでそちらを選びます。