@use 'sass:math';
@use 'sass:meta';
@use '../get-numeric/get-numeric.scss' as *;

/**
 * Strips the unit of a given value.
 *
 * @param    {string|number}    $value    The number or pseudo-number string to to remove unit from.
 *
 * @return   {?number}          The unitless number.
 */
@function strip-unit($value) {
	$value: get-numeric($value);

	@if ($value == null) {
		@return null;
	}

	@if (math.is-unitless($value)) {
		@return $value;
	}

	@return math.div($value, ($value * 0 + 1));
}
