// Returns last index of $value in $list // ------------------------------------------------------------------------------- // @documentation http://sassylists.com/documentation/#last-index // ------------------------------------------------------------------------------- // @example last-index(a b c a, a) => 4 // @example last-index(a b c, z) => null // ------------------------------------------------------------------------------- // @param $list [List] : list // @param $value [Literal] : value to be searched for // ------------------------------------------------------------------------------- // @return [Number] | null @function last-index($list, $value) { @for $i from length($list) * -1 through -1 { $i: abs($i); @if nth($list, $i) == $value { @return $i; } } @return null; }