The function returns a new set with things that pass the test.

This function does not generate an event.




Argument Type Description
callback closure (required) Closure to execute on each value.

Explanation of the callback argument:

Iterable Arguments Description
set thing, Id Iterate over things in the set. Both thing and id are optional.

Return value

A new set with the things that pass the test. If no items passed the test, an empty set will be returned.


This code shows an example using filter():

users = set({name: 'Iris', age: 6}, {name: 'Sasha', age: 34});

 * Return all users with name 'Iris'.

users.filter(|user| ( == 'Iris'));

Return value in JSON format

        "age": 6,
        "name": "Iris"