////
/// @group helpers
////

/// Shortcut for getting the first item from a list
/// @link http://hugogiraudel.com/2013/08/08/advanced-sass-list-functions/#selecting-values-from-list
/// @since 0.1.0
@function first($list) {
  @return nth($list, 1);
}

/// Shortcut for getting the last item from a list
/// @link http://hugogiraudel.com/2013/08/08/advanced-sass-list-functions/#selecting-values-from-list
/// @since 0.1.0
@function last($list) {
  @return nth($list, length($list));
}

/// Returns last index of `$value` in `$list`.
///
/// @ignore Documentation: http://at-import.github.io/SassyLists/documentation/#function-sl-last-index
///
/// @param {List} $list  - list to search
/// @param {*}    $value - value to be searched for
///
/// @example
/// sl-last-index(a b a, a)
/// // 3
///
/// @example
/// sl-last-index(a b a, z)
/// // null
///
/// @return {Number | Null}
///
/// @since 0.1.0
@function last-index($list, $value) {
  @for $i from length($list) through 1 {
    @if nth($list, $i) == $value {
      @return $i;
    }
  }

  @return null;
}
