git ssb

7+

dinoworm 🐛 / patchcore



Commit 1c0ca68774c4b8604b4acc3288982a21f90f8401

fix opts.lt checks for handling null

Matt McKegg committed on 6/20/2017, 4:07:17 PM
Parent: 0d3b80da14418f18ae57d77bec6e296174e20590

Files changed

feed/pull/channel.jschanged
feed/pull/mentions.jschanged
feed/pull/private.jschanged
feed/pull/profile.jschanged
feed/pull/public.jschanged
feed/pull/type.jschanged
feed/pull/channel.jsView
@@ -11,9 +11,9 @@
1111 if (typeof channel !== 'string') throw new Error('a channel name be specified')
1212
1313 return function (opts) {
1414 // handle last item passed in as lt
15- var lt = typeof opts.lt === 'object'
15 + var lt = (opts.lt && typeof opts.lt === 'object')
1616 ? opts.lt.value.timestamp
1717 : opts.lt
1818
1919 delete opts.lt
feed/pull/mentions.jsView
@@ -21,9 +21,9 @@
2121 var take = opts.limit
2222 opts.limit = 5000
2323
2424 // handle last item passed in as lt
25- opts.lt = typeof opts.lt === 'object'
25 + var lt = (opts.lt && typeof opts.lt === 'object')
2626 ? opts.lt.timestamp
2727 : opts.lt
2828
2929 var stream = pull(
feed/pull/private.jsView
@@ -10,9 +10,9 @@
1010
1111 exports.create = function (api) {
1212 return nest('feed.pull.private', function (opts) {
1313 // handle last item passed in as lt
14- var lt = typeof opts.lt === 'object'
14 + var lt = (opts.lt && typeof opts.lt === 'object')
1515 ? opts.lt.timestamp
1616 : opts.lt
1717 delete opts.lt
1818
feed/pull/profile.jsView
@@ -7,9 +7,9 @@
77 return nest('feed.pull.profile', (id) => {
88 // handle last item passed in as lt
99 return function (opts) {
1010 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
1212 })
1313 return api.sbot.pull.userFeed(opts)
1414 }
1515 })
feed/pull/public.jsView
@@ -4,9 +4,9 @@
44 exports.needs = nest('sbot.pull.feed', 'first')
55 exports.create = function (api) {
66 return nest('feed.pull.public', (opts) => {
77 // handle last item passed in as lt
8- opts.lt = typeof opts.lt === 'object'
8 + opts.lt = (opts.lt && typeof opts.lt === 'object')
99 ? opts.lt.value.timestamp
1010 : opts.lt
1111 return api.sbot.pull.feed(opts)
1212 })
feed/pull/type.jsView
@@ -10,9 +10,9 @@
1010 return function (opts) {
1111 opts = extend(opts, {
1212 type,
1313 // 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
1515 })
1616
1717 return api.sbot.pull.messagesByType(opts)
1818 }

Built with git-ssb-web