X-Git-Url: http://git.indexdata.com/?p=mkws-moved-to-github.git;a=blobdiff_plain;f=src%2Fmkws-handlebars.js;fp=src%2Fmkws-handlebars.js;h=605282f641b4e5ca05078ad5ecc6c99087f9c863;hp=999c1385244f9f06ed4bd195513d6649c22208b7;hb=23a53ae3377c472e7fa3f8184b7312aa33c256a9;hpb=95921674a9bcdbb9e656297b8f6a7ce48e9ac47e diff --git a/src/mkws-handlebars.js b/src/mkws-handlebars.js index 999c138..605282f 100644 --- a/src/mkws-handlebars.js +++ b/src/mkws-handlebars.js @@ -12,8 +12,10 @@ Handlebars.registerHelper('mkws-paragraphs', function(obj, count) { var acc = []; // For some reason, Handlebars provides the value - // {"hash":{},"data":{}} for undefined parameters - if (count.hasOwnProperty('hash') || count == 0 || count > obj.length) { + // {"hash":{},"data":{}} for parameters that are not provided. So we + // have to be prepared for actual numbers, explicitly undefined + // values and this dumb magic value. + if (count === undefined || count.hasOwnProperty('hash') || count == 0 || count > obj.length) { count = obj.length; }