@charset "UTF-8";

// @description
// * is-angle function.
// * This module provides a function to check if the argument has angle units.

// @access public

// @version 1.5.0

// @author Khaled Mohamed

// @license MIT

// @repository: https://github.com/Black-Axis/sass-pire

// @namespace type-checks

// @module type-checks/is-angle

// @dependencies:
// * - meta.type-of (SASS function).
// * - list.index (SASS function).
// * - math.unit (SASS function).
// * - var.$angle-units (variable).
// * - Error.throw (function).

// @param {number} $val
// * A number to check if it has angle units or not.

// @throw {string}
// * You must pass an argument with number type to the
// * is-angle function.

// @example
// * .example {
// *   content: is-angle(12deg);
// * }

// @output
// * .example {
// *   content: true;
// * }

// @returns {boolean} - True if it has one of the angle units,
// * false if not.

@use "sass:meta";
@use "sass:list";
@use "sass:math";
@use "../../abstract/global-variables" as var;
@use "../../development-utils/toggle-error-message" as Error;

@function is-angle($value) {
    @if meta.type-of($value) != number {
        @return Error.throw("The parameter of is-angle function must be in a number type.");
    }

    $flag: true;
    $get-unit: math.unit($value);

    @if not list.index(var.$angle-units, $get-unit) {
        $flag: false;
    }

    @return $flag;
}
