/** * Helpers function * * @author splitfire - http://splitfire.fr * @version 1.0 * */ /** * Check is value is not empty or is type of : optionnal * @param mixed value * @param string type optionnal * @return boolean true */ @function isNotEmpty($str, $type:false) { $checkType : true; @if($type != false and type-of($type) == string) { $checkType : (type-of($str) == $type); } @return($str != "" and $str != 0 and $str != false and $checkType); } /** * Check if device exists and return device * @param string device * @return string|boolean */ @function device($device) { $device: unquote($device); @if(isNotEmpty($device)) { @each $breakpoints in $breakpoints-config { $breakpoint-name : nth($breakpoints,1); @if($device == $breakpoint-name) { @return $breakpoints; } } } @warn '#{$device} does not exist '; @return false; }