def nth(list, n)
      assert_type n, :Number, :n
      Sass::Script::Value::List.assert_valid_index(list, n)

      index = n.to_i > 0 ? n.to_i - 1 : n.to_i
      list.to_a[index]
    end
def nth(list, n)
      assert_type n, :Number, :n
      Sass::Script::Value::List.assert_valid_index(list, n)

      index = n.to_i > 0 ? n.to_i - 1 : n.to_i
      list.to_a[index]
    end
Gets the nth item in a list.

 Note that unlike some languages, the first item in a Sass list is number
 1, the second number 2, and so forth.

 This can return the nth pair in a map as well.

 Negative index values address elements in reverse order, starting with the last element in
 the list.

 @example
   nth(10px 20px 30px, 1) => 10px
   nth((Helvetica, Arial, sans-serif), 3) => sans-serif
   nth((width: 10px, length: 20px), 2) => length, 20px
 @overload nth($list, $n)
   @param $list [Sass::Script::Value::Base]
   @param $n [Sass::Script::Value::Number] The index of the item to get.
     Negative indices count from the end of the list.
 @return [Sass::Script::Value::Base]
 @raise [ArgumentError] if `$n` isn't an integer between 1 and the length
   of `$list`