map.retrieve()

The map.retrieve() function retrieves a value from $map by a $method get or pick with a $key.

// Functions.
@use 'map.get.function' as *;
@use 'map.pick.function' as *;

// The `map.retrieve()` function.
@function retrieve($method, $map, $key, $fallback: null) {
  @return if(
    $method == get,
    get($map, $key, $fallback),
    if($method == pick, pick($map, $key...), $map or $fallback)
  );
}
https://github.com/angular-package/sass/blob/main/map/_map.retrieve.function.scss

Parameters

$method

The method get(map.get()) or pick(map.pick()) used to retrieve the value.

$map

A map to get the value by using $method and $key.

$key

A key to get or pick the value from $map.

$fallback: null

The fallback value if returned is null.

Return

The return value is a retrieved value from $map or $fallback.

Examples

Last updated

Was this helpful?