// Utility functions

// strip()
//
// Converts any typed variable to a regular integer
//
// $number: 	The value you want to unify

@function strip ($number) {
	@return $number / ($number * 0 + 1);
}

// em()
//
// Converts a target value to em's, based on a context
//
// $target: 	The target integer
// $context: 	Base for conversion, defaults to $doc-em-factor

@function em ($target, $context: $base-font-size) {
	$context: strip($context);
	$target: strip($target);
	
	@return ($target/$context)*1em;
}

// rem()
//
// Converts a target value to rem's
//
// $target: 	The target integer
// $context: 	Base for conversion, defaults to $doc-em-factor

@function rem ($target, $context: $base-font-size) {
	$context: strip($context);
	$target: strip($target);
	
	@return ($target/$context)*1rem;
}

// tint()
//
// Add percentage of white to a color
// Taken from Bourbon source
//
// $color:      The base HEX color
// $percent:    Amount of white mix into $color, in %

@function tint ($color, $percent) {
	@return mix(white, $color, $percent);
}

// shade()
//
// Add percentage of black to a color
// Taken from Bourbon source
//
// $color:      The base HEX color
// $percent:    Amount of black mix into $color, in %

@function shade ($color, $percent) {
	@return mix(black, $color, $percent);
}
