The comparison.compare() function returns a bool indicating the result of the comparison.
// Sass.@use'sass:list';@use'sass:map';@use'sass:math';@use'sass:meta';// Modules.@use'../string';@use'greater';@use'less';// Functions.@use'../meta/meta.of-type.function'as*;@use'comparison.equal.function'as*;// The `comparison.compare()` function.@functioncompare($value,$operator,$operand){$not:if(string.index($operator,'!'),true,false);$check-type: null;// List length.@ifstring.index($operator,'(,)'){$operator:string.replace($operator,first,'(,)','');$check-type:meta.type-of($value) == list or meta.type-of($value) == map;$value:if($check-type,list.length($value),$value);// Map length.}@else ifstring.index($operator,'(:)'){// @deprecated$operator:string.replace($operator,first,'(:)','');$check-type:meta.type-of($value) == map;$value:if($check-type,list.length($value),$value);// Type of.}@else ifstring.index($operator,':')==1{$operator:string.replace($operator,first,':','');$value:meta.type-of($value);$operand:if(not$operand,meta.type-of($operand),$operand);}// Remove not.$operator:string.replace($operator,first,'!','');// Use the function depending on the given operator.$function:map.get(('===':meta.get-function(compatible,$module:math),'~=':meta.get-function(index,$module:string),'==':meta.get-function(equal),'=':meta.get-function(equal),'>':meta.get-function(than,$module:greater),'>=':(meta.get-function(than,$module:greater),meta.get-function(equal),),'<':meta.get-function(than,$module:less),'<=':(meta.get-function(than,$module:less),meta.get-function(equal),),),$operator);// Call the functions to compare.$result:();@each$functionin$function{$comparison-result:meta.call($function,$value,$operand);$result:list.append($result,if(meta.type-of($comparison-result)==number,true,$comparison-result));}// Check whether the result contains true.$result: if(list.index($result,true),true,false);// Check the type for list and map length.$result: if(meta.type-of($check-type)==bool,$check-typeand$result,$result);// Returns comparison result.@returnif($not,not$result,$result);}