Skip to content

Instantly share code, notes, and snippets.

@alexmccabe
Last active August 29, 2015 14:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alexmccabe/c3ad39254057c5e90909 to your computer and use it in GitHub Desktop.
Save alexmccabe/c3ad39254057c5e90909 to your computer and use it in GitHub Desktop.
/**
* Checking whether a number has the correct unit
* @var $number [number] The number (with the unit) that you want to check against. E.g 35px
* @var $unit [string] The unit that you need to know exists. E.g 'px'
* @return [boolean]
*/
@function check-unit($number, $unit) {
@if $number != '' and unit($number) == $unit {
@return true;
} @else {
@return false;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment