Files: 6513733df7f7dc3466f8504069f1c20414ee1cdf / feed / pull / type.js
586 bytesRaw
1 | const nest = require('depnest') |
2 | const extend = require('xtend') |
3 | |
4 | exports.gives = nest('feed.pull.type') |
5 | exports.needs = nest('sbot.pull.messagesByType', 'first') |
6 | exports.create = function (api) { |
7 | return nest('feed.pull.type', (type) => { |
8 | if (typeof type !== 'string') throw new Error('a type must be specified') |
9 | |
10 | return function (opts) { |
11 | opts = extend(opts, { |
12 | type, |
13 | // handle last item passed in as lt |
14 | lt: opts.lt && typeof opts.lt === 'object' ? opts.lt.timestamp : opts.lt |
15 | }) |
16 | |
17 | return api.sbot.pull.messagesByType(opts) |
18 | } |
19 | }) |
20 | } |
21 |
Built with git-ssb-web