( self: Socket )
| 239 | * @category combinators |
| 240 | */ |
| 241 | export const toChannel = <IE>( |
| 242 | self: Socket |
| 243 | ): Channel.Channel< |
| 244 | Chunk.Chunk<Uint8Array>, |
| 245 | Chunk.Chunk<Uint8Array | string | CloseEvent>, |
| 246 | SocketError | IE, |
| 247 | IE, |
| 248 | void, |
| 249 | unknown |
| 250 | > => { |
| 251 | const encoder = new TextEncoder() |
| 252 | return toChannelMap(self, (data) => typeof data === "string" ? encoder.encode(data) : data) |
| 253 | } |
| 254 | |
| 255 | /** |
| 256 | * @since 1.0.0 |
no test coverage detected