lookup(inputMap, key, default) retrieves the value associated with key in inputMap. If the key does not exist, default is returned.
Signature
Example
Look up environment-specific database URLs from a map, falling back to a local development URL:development (or any unknown environment), the fallback postgres://localhost/app_dev is used.
Notes
lookupalso works on objects, looking up attribute values by name.- If you need a hard failure when a key is missing (rather than a fallback), access the map directly with bracket notation:
map[key]. defaultmust be compatible with the map’s value type.