You are here

function sassy_compass___compass_nth in Sassy 7.3

Same name and namespace in other branches
  1. 7.2 extensions/compass/functions/lists.inc \sassy_compass___compass_nth()
1 string reference to 'sassy_compass___compass_nth'
sassy_compass__first_value_of in sassy_compass/functions/lists.inc

File

sassy_compass/functions/lists.inc, line 42

Code

function sassy_compass___compass_nth() {
  $args = func_get_args();
  $place = array_pop($args);
  $list = array();
  foreach ($args as $arg) {
    $list = array_merge($list, sassy_compass__list($arg));
  }
  if ($place == 'first') {
    $place = 0;
  }
  if ($place == 'last') {
    $place = count($list) - 1;
  }
  if (isset($list[$place])) {
    return current(SassScriptLexer::$instance
      ->lex($list[$place], new SassContext()));
  }
  return new SassBoolean(false);
}