Files: cc048d2d98e1cd95038b14d5816dd19931a7b0fa / sources / values.js
493 bytesRaw
1 | |
2 | var abortCb = require('../util/abort-cb') |
3 | |
4 | module.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 | cb(i >= array.length || null, array[i++]) |
19 | } |
20 | } |
21 | |
22 |
Built with git-ssb-web