Skip to content

Instantly share code, notes, and snippets.

@mturjak
Created February 16, 2014 23:41
Show Gist options
  • Select an option

  • Save mturjak/9042283 to your computer and use it in GitHub Desktop.

Select an option

Save mturjak/9042283 to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
// ----
// Sass (v3.3.0.rc.4)
// Compass (v1.0.0.alpha.18)
// ----
//recursive match function
@function recumatch($l, $a){
@each $e in $l {
@if type-of($e) != 'list' {
@if $e == $a { @return true; }
}
@else {
@if recumatch($e, $a) { @return true; }
}
}
@return false;
}
test {
//multidimensional list:
$list: (('a', ('f', 'b')), 'c'), 'd';
test1: recumatch($list, 'b');
test2: recumatch($list, 'g');
}
test {
test1: true;
test2: false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment