select
get a subset of values from a dict or list
(any xs, list keys, any notFound) -> any
Given a list or dict xs
, returns a collection of the same type, only containing elements at given keys
.
If any key is not present in xs
, notFound
is included in the result instead.
Returns nil
if xs
is nil
or keys
is nil
Throws an error if xs
is a list and a key cannot be cast to long.
Throws an error if xs
is a dict and a key cannot be cast to string.
Parameters
Name | Type | Description |
---|---|---|
xs |
dict or list | The dict or list to access |
keys |
list | The keys or indexes to extract |
notFound |
any |
The value to return in case a key is not present in xs |