Commit 5cea9df7483c8eadbe82003ae98e7bd65ad305ac
add feed.pull.type
Matt McKegg committed on 6/17/2017, 12:59:40 PMParent: 69e982a06262f72e77dcba72ded0074c435d8a2d
Files changed
feed/pull/type.js | added |
feed/pull/type.js | ||
---|---|---|
@@ -1,0 +1,20 @@ | ||
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: typeof opts.lt === 'object' ? opts.lt.timestamp : opts.lt | |
15 … | + }) | |
16 … | + | |
17 … | + return api.sbot.pull.messagesByType(opts) | |
18 … | + } | |
19 … | + }) | |
20 … | +} |
Built with git-ssb-web