Swap-Aggregator-Subgraph/node_modules/pull-stream/sources/count.js
Richa-iitr d211083153 Revert "Revert "added handler""
This reverts commit c36ee8c5ca.
2022-07-03 07:30:05 +05:30

14 lines
216 B
JavaScript

'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++)
}
}