You are here

public static function SassExtentionsCompassFunctionsLists::nth_value_of in Sassy 7

File

phamlp/sass/extensions/compass/functions/lists.php, line 31

Class

SassExtentionsCompassFunctionsLists
Compass extension SassScript lists functions class. A collection of functions for use in SassSCript. @package PHamlP @subpackage Sass.extensions.compass.functions

Code

public static function nth_value_of($list, $n) {
  if ($list instanceof SassString) {
    $items = preg_split(self::SPACE_SEPARATOR, $list->value);
    return new SassString($items[$n
      ->toInt() - 1]);
  }
  else {
    return $list;
  }
}