Commit 1c0ca68774c4b8604b4acc3288982a21f90f8401
fix opts.lt checks for handling null
Matt McKegg committed on 6/20/2017, 4:07:17 PMParent: 0d3b80da14418f18ae57d77bec6e296174e20590
Files changed
feed/pull/channel.js | changed |
feed/pull/mentions.js | changed |
feed/pull/private.js | changed |
feed/pull/profile.js | changed |
feed/pull/public.js | changed |
feed/pull/type.js | changed |
feed/pull/channel.js | ||
---|---|---|
@@ -11,9 +11,9 @@ | ||
11 | 11 … | if (typeof channel !== 'string') throw new Error('a channel name be specified') |
12 | 12 … | |
13 | 13 … | return function (opts) { |
14 | 14 … | // handle last item passed in as lt |
15 | - var lt = typeof opts.lt === 'object' | |
15 … | + var lt = (opts.lt && typeof opts.lt === 'object') | |
16 | 16 … | ? opts.lt.value.timestamp |
17 | 17 … | : opts.lt |
18 | 18 … | |
19 | 19 … | delete opts.lt |
feed/pull/mentions.js | ||
---|---|---|
@@ -21,9 +21,9 @@ | ||
21 | 21 … | var take = opts.limit |
22 | 22 … | opts.limit = 5000 |
23 | 23 … | |
24 | 24 … | // handle last item passed in as lt |
25 | - opts.lt = typeof opts.lt === 'object' | |
25 … | + var lt = (opts.lt && typeof opts.lt === 'object') | |
26 | 26 … | ? opts.lt.timestamp |
27 | 27 … | : opts.lt |
28 | 28 … | |
29 | 29 … | var stream = pull( |
feed/pull/private.js | ||
---|---|---|
@@ -10,9 +10,9 @@ | ||
10 | 10 … | |
11 | 11 … | exports.create = function (api) { |
12 | 12 … | return nest('feed.pull.private', function (opts) { |
13 | 13 … | // handle last item passed in as lt |
14 | - var lt = typeof opts.lt === 'object' | |
14 … | + var lt = (opts.lt && typeof opts.lt === 'object') | |
15 | 15 … | ? opts.lt.timestamp |
16 | 16 … | : opts.lt |
17 | 17 … | delete opts.lt |
18 | 18 … |
feed/pull/profile.js | ||
---|---|---|
@@ -7,9 +7,9 @@ | ||
7 | 7 … | return nest('feed.pull.profile', (id) => { |
8 | 8 … | // handle last item passed in as lt |
9 | 9 … | return function (opts) { |
10 | 10 … | opts = extend(opts, { |
11 | - id, lt: typeof opts.lt === 'object' ? opts.lt.value.sequence : opts.lt | |
11 … | + id, lt: (opts.lt && typeof opts.lt === 'object') ? opts.lt.value.sequence : opts.lt | |
12 | 12 … | }) |
13 | 13 … | return api.sbot.pull.userFeed(opts) |
14 | 14 … | } |
15 | 15 … | }) |
feed/pull/public.js | ||
---|---|---|
@@ -4,9 +4,9 @@ | ||
4 | 4 … | exports.needs = nest('sbot.pull.feed', 'first') |
5 | 5 … | exports.create = function (api) { |
6 | 6 … | return nest('feed.pull.public', (opts) => { |
7 | 7 … | // handle last item passed in as lt |
8 | - opts.lt = typeof opts.lt === 'object' | |
8 … | + opts.lt = (opts.lt && typeof opts.lt === 'object') | |
9 | 9 … | ? opts.lt.value.timestamp |
10 | 10 … | : opts.lt |
11 | 11 … | return api.sbot.pull.feed(opts) |
12 | 12 … | }) |
feed/pull/type.js | ||
---|---|---|
@@ -10,9 +10,9 @@ | ||
10 | 10 … | return function (opts) { |
11 | 11 … | opts = extend(opts, { |
12 | 12 … | type, |
13 | 13 … | // handle last item passed in as lt |
14 | - lt: typeof opts.lt === 'object' ? opts.lt.timestamp : opts.lt | |
14 … | + lt: opts.lt && typeof opts.lt === 'object' ? opts.lt.timestamp : opts.lt | |
15 | 15 … | }) |
16 | 16 … | |
17 | 17 … | return api.sbot.pull.messagesByType(opts) |
18 | 18 … | } |
Built with git-ssb-web