@use 'sass:map';
@use 'spacings';
/*****************************************************************************
Size Functions
******************************************************************************/

// Returns the specified size.
// @param {String} $size The spacing size.
// @returns {String} The specified size.
@function get-size($size: d) {
  @if map.has-key(spacings.$spacings, $size) {
    @return calc(2 * map.get(spacings.$spacings, $size));
  } @else {
    @return $size;
  }
}

// A custom for-loop to control visibility. The loop can be used to iterate over
// every size defined.
@mixin for-each-size {
  @each $key, $value in spacings.$spacings {
    @content($key, get-size($key));
  }
}
