@charset "UTF-8";

// @description
// * in-to-px function.
// * This function converts a value with inches unit into pixels.

// @access public

// @version 1.4.1

// @author Khaled Mohamed

// @license MIT

// @repository: https://github.com/Black-Axis/sass-pire

// @namespace converters

// @module converters/in-to-px

// @dependencies:
// * - meta.type-of (SASS function).
// * - math.unit (SASS function).
// * - LibFunc.cut-unit (function).
// * - Error.throw (function).

// @param {Number} $inches-val
// * The value in inches unit to convert.

// @throw {Exception}
// * Throws exceptions if the provided parameter is not a number, doesn't
// * have a unit, or doesn't have an inches unit.

// @example
// * .example {
// *   content: in-to-px(12in);
// * }

// @output
// * .example {
// *   content: 1152px;
// * }

// @return {Number} - Returns the converted value in pixels.

@use "sass:meta";
@use "sass:math";
@use "../../functions/global/cut-unit" as LibFunc;
@use "../../development-utils/toggle-error-message" as Error;

@function in-to-px($inches-val) {
    @if meta.type-of($inches-val) != number {
        @return Error.throw("The parameter of in-to-px function must be in a number type.");
    }

    @if $inches-val == 0 {
        @return 0;
    }

    // stylelint-disable-next-line length-zero-no-unit
    @if $inches-val == 0in {
        @return Error.throw("The parameter does not need a unit if it equals to zero.");
    }

    @if math.unit($inches-val) != in {
        @return Error.throw("The in-to-px function accepts argument with inch unit only.");
    }

    $actual-number: LibFunc.cut-unit($inches-val);

    @return $actual-number * 96px;
}
