git ssb

3+

cel / ssb-npm-registry



Tree: d2f2697f296dd39aed6a8b63c6d04a736a7db5b3

Files: d2f2697f296dd39aed6a8b63c6d04a736a7db5b3 / node_modules / pull-stream / sources / values.js

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

Built with git-ssb-web