Basic filter function. Argument: array of objects