{{#includes myArray 'apple'}}
There is an apple!
{{/includes}}
{{#includes myArray 'apple' 'orange'}}
There is an apple and an orange!
{{/includes}}
{ | |
includes: function (array, ...args) { | |
const argumentsLength = args.length - 1; | |
const options = args[argumentsLength]; | |
for (let i = 0; i < argumentsLength; i += 1) { | |
const item = args[i]; | |
if (array.includes(item) === false) { | |
return options.inverse(this); | |
} | |
} | |
return options.fn(this); | |
}, | |
} |