UNPKG
pull-stream
Version:
latest (3.7.0)
3.7.0
3.6.14
3.6.13
3.6.12
3.6.11
3.6.10
3.6.9
3.6.8
3.6.7
3.6.6
3.6.5
3.6.4
3.6.3
3.6.2
3.6.1
3.6.0
3.5.0
3.4.5
3.4.4
3.4.3
3.4.2
3.4.0
3.3.3
3.3.2
3.3.1
3.3.0
3.2.3
3.2.2
3.2.1
3.2.0
3.1.0
3.0.1
3.0.0
2.28.4
2.28.3
2.28.2
2.28.1
2.27.0
2.26.1
2.26.0
2.25.0
2.24.1
2.24.0
2.23.1
2.23.0
2.22.2
2.22.0
2.21.0
2.20.1
2.20.0
2.19.0
2.18.3
2.18.2
2.18.1
2.18.0
2.17.1
2.16.2
2.16.1
2.16.0
2.15.1
2.15.0
2.14.1
2.14.0
2.13.0
2.12.0
2.11.0
2.10.2
2.10.1
2.10.0
2.9.2
2.9.1
2.9.0
2.8.0
2.7.0
2.6.0
2.5.1
2.5.0
2.4.0
2.3.0
2.2.0
2.1.0
2.0.0
0.0.4
0.0.3
0.0.2
0.0.1
0.0.0
minimal pull stream
pull-stream.github.io
pull-stream/pull-stream
pull-stream
/
sources
/
count.js
14 lines
(10 loc)
•
216 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
10
11
12
13
14
'use strict'
module
.
exports
=
function
count
(
max
) {
var
i =
0
; max = max ||
Infinity
return
function
(
end, cb
) {
if
(end)
return
cb &&
cb
(end)
if
(i > max)
return
cb
(
true
)
cb
(
null
, i++) } }