git ssb

2+

Dominic / pull-stream



Tree: 4030fd72088498cc22acca950c4a1bb121937cc0

Files: 4030fd72088498cc22acca950c4a1bb121937cc0 / sources / values.js

480 bytesRaw
1var abortCb = require('../util/abort-cb')
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