accept limit = 0 to signify "no limit"

This commit is contained in:
Sacha Greif 2014-12-10 10:52:03 +09:00
parent 97804989a3
commit 035d5c51c9

View file

@ -20,8 +20,8 @@ getPostsParameters = function (terms) {
// extend sort to sort posts by _id to break ties
deepExtend(true, parameters, {options: {sort: {_id: -1}}});
// if there is a limit and it's not null, add it too
if (typeof terms.limit !== 'undefined' && !!terms.limit)
// if there is a limit, add it too (note: limit=0 means "no limit")
if (typeof terms.limit !== 'undefined')
_.extend(parameters.options, {limit: parseInt(terms.limit)});
// hide future scheduled posts unless "showFuture" is set to true or postedAt is already defined