Array.$includeIf()

Method $includeIf(item, condition)
Description Use $includeIf() to add an item into an array, but only if the condition is true. (The item is removed otherwise).

Example