@charset "UTF-8";

// @description
// * has-res-unit function.
// * This function checks if the provided argument has resolution 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/has-res-unit

// @dependencies:
// * - meta.type-of (SASS function).
// * - list.index (SASS function).
// * - math.unit (SASS function).
// * - Error.throw (function).

// @param {number} $val
// * The number to check for resolution units.

// @throws {string}
// * Throws an error if @param is not a number.

// @example
// * .example {
// *   content: has-res-unit(12dpi);
// * }

// @output
// * .example {
// *   content: true;
// * }

// @return {boolean} - Returns true if the argument has one of the
// * resolution units, otherwise false.

@use "sass:meta";
@use "sass:list";
@use "sass:math";
@use "../../development-utils/toggle-error-message" as Error;

@function has-res-unit($value) {
    @if meta.type-of($value) != number {
        @return Error.throw("The parameter of has-res-unit function must be in a number type.");
    }

    $resolution-units: (dpi, dpcm, dppx) !default;
    $flag: true;

    @if not list.index($resolution-units, math.unit($value)) {
        $flag: false;
    }

    @return $flag;
}
