@use "sass:math";

@function remy($size) {

  // remove units
  $size: math.div($size, ($size * 0 + 1));

  // set 'rem'
  @return math.div($size, 16)+rem;
}

@function px($size) {

  // remove units
  $size: math.div($size, ($size * 0 + 1));

  // set 'px'
  @return ($size)+px;
}

@function number($string) {
  // Matrices
  $strings: '0' '1' '2' '3' '4' '5' '6' '7' '8' '9';
  $numbers: 0 1 2 3 4 5 6 7 8 9;

  // Result
  $result: 0;

  // Looping through all characters
  @for $i from 1 through str-length($string) {
    $character: str-slice($string, $i, $i);
    $index: index($strings, $character);

    @if not $index {
      @warn "Unknown character `#{$character}`.";
      @return false;
    }

    $number: nth($numbers, $index);
    $result: $result * 10 + $number;
  }

  @return $result;
}
