git ssb

7+

dinoworm ๐Ÿ› / patchcore



Tree: 8ab7e949190c9ca82f10914e29aae9de082158cb

Files: 8ab7e949190c9ca82f10914e29aae9de082158cb / feed / pull / type.js

750 bytesRaw
1const nest = require('depnest')
2const extend = require('xtend')
3const pull = require('pull-stream')
4
5exports.gives = nest('feed.pull.type')
6exports.needs = nest({
7 'sbot.pull.messagesByType': 'first',
8 'message.sync.isBlocked': 'first'
9})
10
11exports.create = function (api) {
12 return nest('feed.pull.type', (type) => {
13 if (typeof type !== 'string') throw new Error('a type must be specified')
14
15 return function (opts) {
16 opts = extend(opts, {
17 type,
18 // handle last item passed in as lt
19 lt: opts.lt && typeof opts.lt === 'object' ? opts.lt.timestamp : opts.lt
20 })
21
22 return pull(
23 api.sbot.pull.messagesByType(opts),
24 pull.filter(msg => !api.message.sync.isBlocked(msg))
25 )
26 }
27 })
28}
29

Built with git-ssb-web