@use "sass:math";

@use "../tokens/base";

@function to-em($size, $font-size: base.$font-size) {
  @if $size == 0 {
    @return 0;
  }

  @return math.div($size, $font-size) * 1em;
}

@function to-rem($size, $base: base.$font-size) {
  @if $size == 0 {
    @return 0;
  }

  @return math.div($size, $base) * 1rem;
}

/// Strip units from any number
/// @param {Number} $number - Number to strip units from
/// @return {Number}
///
@function strip-units($number) {
  @return math.div($number, $number * 0 + 1);
}
