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.
thumbsup/src/website/helpers/join.js

16 lines
375 B
JavaScript

/*
Render elements of an array joined by a separator
Usage:
{{#join list ","}}
{{.}}
{{/join}}
*/
module.exports = function (array, separator, options) {
const data = require('handlebars').createFrame({})
const blocks = array.map((item, index) => {
data.index = index
return options.fn(item, {data: data})
})
return blocks.join(separator)
}