@charset "UTF-8";

// @description
// * is-int function.
// * This module provides a function to check if the argument is
// * a integer number.

// @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-int

// @dependencies:
// * - meta.type-of (SASS function).
// * - math.round (SASS function).
// * - LibFunc.cut-unit (function).
// * - Error.throw (function).

// @param {number} $val
// * The number to check.

// @throw {string}
// * Throws an error if the argument is not a number.

// @return {boolean} - True if the number is an integer, false otherwise.

// @example
// * .example {
// *   content: is-int(12deg);
// * }

// @output
// * .example {
// *   content: true;
// * }

@use "sass:meta";
@use "sass:math";
@use "../../functions/global/cut-unit" as LibFunc;
@use "../../development-utils/toggle-error-message" as Error;

@function is-int($value) {
    @if meta.type-of($value) != number {
        @return Error.throw("The parameter of is-int function must be in a number type.");
    }

    $flag: false;
    $actual-number: LibFunc.cut-unit($value);

    @if math.round($actual-number) == $actual-number {
        $flag: true;
    }

    @return $flag;
}
