pick.value-type()

The pick.value-type() or map.pick-value-type() function picks the properties with values of $types.

// Sass.
@use 'sass:list';
@use 'sass:map';

// The `pick.value-type()` or `map.pick-value-type()` function.
@function value-type($map, $types...) {
  $result: ();
  @each $type in $types {
    @if list.index(
      bool calculation color function list map null number string,
      $type
    )
    {
      @each $key, $value in $map {
        @if type-of($value) ==
          $type or
          (not $type and type-of($type) == type-of($value))
        {
          $result: map.deep-merge(
            $result,
            (
              $key: $value,
            )
          );
        }
      }
    }
  }
  @return $result;
}

Parameters

$map

A map from which properties with values of a certain $types are picked.

$types...

The bool, calculation, color, function, list, map, null, number or string types of the property values to pick from $map.

Return

The return value is a copy of $map with values associated with $types.

Examples

// Use.
@use '@angular-package/sass/map';

// Examples.

Last updated