handlebars-helpers
handlebars-helpers copied to clipboard
Array helper: concat
Hey, awesome project. I just wanted to ask if anyone besides me is interested in a concat
helper for arrays (and possibly other types as well, such as strings?). If so I would be interested in creating a PR for that.
Since I'm already using this helper myself, here is the code for it:
module.exports = function(arrayA, arrayB, options) {
if (Array.isArray(arrayA) && !Array.isArray(arrayB)) {
return arrayA;
} else if (Array.isArray(arrayA) && Array.isArray(arrayB)) {
return arrayA.concat(arrayB);
} else {
return [];
}
}
Thanks for the issue! A PR would be great and we can discuss any details in there.
Thanks!