contains
Block helper that renders the block if collection has the given value, using strict equality (===) for comparison, otherwise the inverse block is rendered (if specified). If a startIndex is specified and is negative, it is used as the offset from the end of the collection.
Params
collection{Array|Object|String}: The collection to iterate over.value{any}: The value to check for.[startIndex=0]{Number}: Optionally define the starting index.options{Object}: Handlebars provided options object.
Example
{{ assign 'array' (JSONparse '["a", "b", "c", "d"]') }}
{{#contains array "d"}}
This will be rendered.
{{else}}
This will not be rendered.
{{/contains}}
Was this article helpful to you?