git ssb

2+

Dominic / pull-stream



Tree: 7aa21412f6c0bd6b84022d67ff8e51711eddb510

Files: 7aa21412f6c0bd6b84022d67ff8e51711eddb510 / values.js

478 bytesRaw
1var abortCb = require('./util/abortCb')
2
3module.exports = function values (array, onAbort) {
4 if(!array)
5 return function (abort, cb) {
6 if(abort) return abortCb(cb, abort, onAbort)
7 return cb(true)
8 }
9 if(!Array.isArray(array))
10 array = Object.keys(array).map(function (k) {
11 return array[k]
12 })
13 var i = 0
14 return function (abort, cb) {
15 if(abort)
16 return abortCb(cb, abort, onAbort)
17 cb(i >= array.length || null, array[i++])
18 }
19}
20
21

Built with git-ssb-web