git ssb

3+

cel / ssb-npm-registry



Tree: 4f27567900a7b5b821bccc74e95bfc96c8233159

Files: 4f27567900a7b5b821bccc74e95bfc96c8233159 / 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