pub fn selectattr(
state: &State<'_, '_>,
value: Value,
attr: Cow<'_, str>,
test_name: Option<Cow<'_, str>>,
args: Rest<Value>,
) -> Result<Vec<Value>, Error>
Expand description
Creates a new sequence of values of which an attribute passes a test.
This functions like select
but it will test an attribute of the
object itself:
{{ users|selectattr("is_active") }} -> all users where x.is_active is true
{{ users|selectattr("id", "even") }} -> returns all users with an even id