projects
/
mkws-moved-to-github.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
94a3083
)
Simplify handling of optional count argument.
author
Mike Taylor
<mike@indexdata.com>
Thu, 29 May 2014 15:14:49 +0000
(16:14 +0100)
committer
Mike Taylor
<mike@indexdata.com>
Thu, 29 May 2014 15:14:49 +0000
(16:14 +0100)
src/mkws-handlebars.js
patch
|
blob
|
history
diff --git
a/src/mkws-handlebars.js
b/src/mkws-handlebars.js
index
537779e
..
999c138
100644
(file)
--- a/
src/mkws-handlebars.js
+++ b/
src/mkws-handlebars.js
@@
-13,8
+13,9
@@
Handlebars.registerHelper('mkws-paragraphs', function(obj, count) {
// For some reason, Handlebars provides the value
// {"hash":{},"data":{}} for undefined parameters
- if (count.hasOwnProperty('hash')) count = undefined;
- if (!count || count > obj.length) count = obj.length;
+ if (count.hasOwnProperty('hash') || count == 0 || count > obj.length) {
+ count = obj.length;
+ }
for (var i = 0; i < count; i++) {
acc.push('<p>', obj[i].replace(/\[[0-9,]+\]/g, ''), '</p>');