Skip to content

Commit d175d90

Browse files
committed
feat: default to id function
1 parent e8fb376 commit d175d90

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/create.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
import { AttachSink } from './types'
22
import { ProxyStream } from './ProxyStream'
33
import { Stream } from '@most/types'
4+
import { id } from '@most/prelude'
45

56
export function create<A = any>(): [AttachSink<A>, Stream<A>]
67
export function create<A, B>(f: (stream: Stream<A>) => B): [AttachSink<A>, B]
78

89
export function create<A, B = Stream<A>>(
9-
f?: (stream: Stream<A>) => B
10+
f: (stream: Stream<A>) => B = id as (stream: Stream<A>) => B
1011
): [AttachSink<A>, B] {
1112
const source = new ProxyStream()
1213

13-
return [source, f === void 0 ? (source as any) as B : f(source)]
14+
return [source, f(source)]
1415
}

0 commit comments

Comments
 (0)