SU-SWS/decanter

View on GitHub
core/src/scss/utilities/functions/type-checks/_is-direction-or-angle.scss

Summary

Maintainability
Test Coverage

///
/// Validates whether something is a direction or an angle
///
/// @name is-direction-or-angle
///
/// @param {Integer} $value - the value to type check
///
/// @group mixin
@function is-direction-or-angle($value) {
  $is-direction: index((to top, to top right, to right top, to right, to bottom right, to right bottom, to bottom, to bottom left, to left bottom, to left, to left top, to top left), $value);
  $is-angle: type-of($value) == 'number' and index('deg' 'grad' 'turn' 'rad', unit($value));

  @return $is-direction or $is-angle;
}