@name first
@kind function

@description
Gets the first element or first `n` elements of an array
if expression is provided, is returns as long the expression return truthy
490453
function first(array) {

  var n,
    getter,
    args;

  if(!isArray(array)) {
    return array;
  }

  args = Array.prototype.slice.call(arguments, 1);
  n = (isNumber(args[0])) ? args[0] : 1;
  getter = (!isNumber(args[0]))  ? args[0] : (!isNumber(args[1])) ? args[1] : undefined;

  return (args.length) ? getFirstMatches(array, n,(getter) ? $parse(getter) : getter) :
    array[0];
}
1130900
def first(self, n=1):
        
        res = self.obj[0:n]
        if len(res) is 1:
            res = res[0]
        return self._wrap(res)
338073
def first(n, it, constructor=list):
    
    return constructor(itertools.islice(it,n))
225274
function findByName(array, name) {
        if (array && array.length > 0) {
            for (var i = 0, len = array.length; i < len; i++) {
                var elem = array[i];
                if (elem.name == name) {
                    return elem;
                }
            }
        }
        return null;
    }
1265097
function(n) {
    var la = this.lookahead(n).type;
    switch (la) {
      case 'for':
        return this.bracketed;
      case '[':
        this.bracketed = true;
        return true;
      case ']':
        this.bracketed = false;
        return true;
      default:
        return ~selectorTokens.indexOf(la);
    }
  }
985763
function (elements, fn) {
            var _arr = [];
            if (vQ.isArrayLike(elements)) {
                for (var i = 0; i < elements.length; i++) {
                    var val1 = fn(elements[i], i);
                    if (val1 != null) {
                        _arr.push(val1);
                    }
                }
            } else {
                for (var key in elements) {
                    var val2 = fn(elements[key], key);
                    if (val2 != null) {
                        _arr.push(val2);
                    }
                }
            }
            return _arr;
        }
1160995
function() {

      let a = this['n'];
      let b = this['d'];
      let res = [];

      do {
        res.push(a / b | C_ZERO);
        let t = a % b;
        a = b;
        b = t;
      } while (a !== C_ONE);

      return res;
    }
1006869
private static <T> T firstOf(final List<T> list) {
        return list.isEmpty()? null: list.get(0);
    }
1114960
public function first() {
		$this->limit(1);
		$result = $this->find();
		return empty($result) ? null : $result[0];
	}
160622
function(array, maximumLength) {
    var currentNode = array.length - 2;
    var currentDepth;
    for (currentDepth = 1;
         (currentDepth < (maximumLength - 1)) && (currentNode > 1);
         currentDepth++) {
      currentNode =  first (array, currentNode - 1, 0);
    }

    return currentNode;
  }
625119
public static <E> E first(E[] array) {
        return new FirstElement<E>().apply(new ArrayIterator<>(array));
    }
1172181
function(x) {
            	var index = null, n = this.elements.length;
            	for (var i = 0; i < n; i++) {
            	    if (index === null && this.elements[i] == x) {
            		index = i + 1;
            	    }
            	}
            	return index;
                }
1120564
function() {
      var node = this.startNode(_ArrayExpression);
      var elems = [];

      this.expect('[');

      while (this.value !== ']') {
        if (this.value === ',') {
          this.next();
          elems[elems.length] = null;
          continue;
        }

        if (this.value === '...') {
          elems[elems.length] = this.parseSpreadElement();
        } else {
          elems[elems.length] = this.parseAssignmentExpression(true);
        }

        if (this.value !== ']') {
          this.expect(',');
        }
      }

      this.expect(']');

      node.elements = elems;
      return this.finishNode(node);
    }
561901
function firstToMaybe(first) {
  if(isFunction(first)) {
    return function(x) {
      const m = first(x)

      if(!isSameType(First, m)) {
        throw new TypeError('firstToMaybe: First returning function required')
      }

      return applyTransform(m)
    }
  }

  if(isSameType(First, first)) {
    return applyTransform(first)
  }

  throw new TypeError('firstToMaybe: First or First returning function required')
}
1001217
def get_first_of_element(element, sub, contype=None):
    
    content = element.xpath(sub)
    return list_or_empty(content, contype)
551189
function firstResult(items, fn) {
	for (const item of items) {
		if (!item) {
			continue;
		}

		const result = fn(item);
		if (result) {
			return result;
		}
	}
	return undefined;
}
967095
function first_in_statement(output) {
        var a = output.stack(), i = a.length, node = a[--i], p = a[--i];
        while (i > 0) {
            if (p instanceof AST_Statement && p.body === node)
                return true;
            if ((p instanceof AST_Seq           && p.car === node        ) ||
                (p instanceof AST_Call          && p.expression === node && !(p instanceof AST_New) ) ||
                (p instanceof AST_Dot           && p.expression === node ) ||
                (p instanceof AST_Sub           && p.expression === node ) ||
                (p instanceof AST_Conditional   && p.condition === node  ) ||
                (p instanceof AST_Binary        && p.left === node       ) ||
                (p instanceof AST_UnaryPostfix  && p.expression === node ))
            {
                node = p;
                p = a[--i];
            } else {
                return false;
            }
        }
    }