mirror of https://github.com/thumbsup/thumbsup
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17 lines
326 B
JavaScript
17 lines
326 B
JavaScript
/*
|
|
Execute the child block N times
|
|
Usage:
|
|
{{#times 10}}
|
|
<p>Lorem ipsum</p>
|
|
{{/times}}
|
|
*/
|
|
module.exports = function (n, block) {
|
|
let accum = ''
|
|
const data = require('handlebars').createFrame({})
|
|
for (let i = 0; i < n; ++i) {
|
|
data.index = i
|
|
accum += block.fn(this, { data })
|
|
}
|
|
return accum
|
|
}
|