get
get a value from a dict or list
(any xs, any key, any notFound) -> any
If xs
is a dict or list, returns xs[key]
if key
is present in xs
, returns notFound
otherwise.
Returns nil
if xs
is nil
or key
is nil
.
Throws an error if xs
is not a list or dict.
Parameters
Name | Type | Description |
---|---|---|
xs |
dict or list | The dict or list to access |
key |
string or long | The key or index to access |
notFound |
any |
The value to return in case key is not present in xs |