Skip to main content
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:
For development (or any unknown environment), the fallback postgres://localhost/app_dev is used.

Notes

  • lookup also 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].
  • default must be compatible with the map’s value type.