Skip to content

Instantly share code, notes, and snippets.

@patelprashant
Created November 12, 2013 04:19
Show Gist options
  • Select an option

  • Save patelprashant/7425418 to your computer and use it in GitHub Desktop.

Select an option

Save patelprashant/7425418 to your computer and use it in GitHub Desktop.
// To simulate associative arrays
// Source: http://hugogiraudel.com/2013/08/12/sass-functions/#mapping
@function match($haystack, $needle) {
@each $item in $haystack {
$index: index($item, $needle);
@if $index {
$return: if($index == 1, 2, $index);
@return nth($item, $return);
}
}
@return false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment