returns the position of the first item that meets the value in an array
331405
function(o,value,fn){
       if(this.isArray(o)){
        return this._anyArray(o,value,fn);
      }
      if(this.isObject(o)){
        return this._anyObject(o,value,fn);
      }
    }
122243
function ( obj, start, offset ) {
		var result = [],
		    i      = start - 1,
		    nth    = start + offset,
		    max    = obj.length;

		if ( max > 0 ) {
			while ( ++i < nth && i < max ) {
				result.push( obj[i] );
			}
		}

		return result;
	}
76876
public static <T> T getFirst(T array[]){
        return array!=null && array.length>0 ? array[0] : null;
    }
551189
function firstResult(items, fn) {
	for (const item of items) {
		if (!item) {
			continue;
		}

		const result = fn(item);
		if (result) {
			return result;
		}
	}
	return undefined;
}
1134203
def positionIf(pred, seq):
    
    for i,e in enumerate(seq):
        if pred(e):
            return i
    return -1
680916
def first(self):
        
        self.params['limit'] = 1
        result = self.all()
        return result.items[0] if result.total > 0 else None
1282420
public static <T> T getFirst(T[] objectArray)
    {
        if (ArrayIterate.notEmpty(objectArray))
        {
            return objectArray[0];
        }
        return null;
    }
149378
function findPositions(getInner, getOuter, thingsToMeasure) {
        var tablePositions = [];

        // Skip the first item in the array = no left (LTR), right (RTL) or top bars
        for (var i = 1; i < thingsToMeasure.length; i++) {
          // Get the element from the details
          var item = thingsToMeasure[i].element;

          // We need to zero index this again
          tablePositions.push(getInner(i - 1, item));
        }

        var lastTableLineToMake = thingsToMeasure[thingsToMeasure.length - 1];
        tablePositions.push(getOuter(thingsToMeasure.length - 1, lastTableLineToMake.element));

        return tablePositions;
      }
731843
function(ary, item, i, l) {
        if (ary.indexOf) return ary.indexOf(item)
        for (i = 0, l = ary.length; i < l; i++) if (ary[i] === item) return i
        return -1
    }
125268
function () {
    // Grab the items
    var items = this.items;

    // Find the most negative x and y
    var minX = Infinity,
        minY = Infinity;
    items.forEach(function (item) {
      var coords = item;
      minX = Math.min(minX, coords.x);
      minY = Math.min(minY, coords.y);
    });

    // Offset each item by -minX, -minY; effectively resetting to 0, 0
    items.forEach(function (item) {
      var coords = item;
      coords.x -= minX;
      coords.y -= minY;
    });
  }
932916
def first(self):
        """"""
        page = self.get_page(num_elements=1)
        data = self.extract_data(page)
        if data:
            return data[0]
52669
public Integer getFirstPosition(String key) {
        int position = -1;
        String processedKey = processKey(key);

        if (this.values.containsKey(processedKey) == true) {
            position = this.order.indexOf(processedKey);
        }
        return position;
    }
938934
public static Object findFirstIn(Object obj, Object[] arr) {
		for (Object o : arr) {
			if (obj.equals(o)) {
				return o;
			}
		}
		return null;
	}
1335032
function binaryIndexBy (getValue, item, array) {
    var
      value = item,
      low = 0,
      high = array.length,
      mid, elem;

    while (low < high) {
      // divide by two and floor
      mid = low + high >>> 1;
      elem = getValue(array[mid]);

      if (elem < value) {
        low = mid + 1;
      } else {
        high = mid;
      }
    }

    return high;
  }
125646
function findFirst(arr, obj, config) {
    var fn = _createIteratorFn(obj, config);
    return _findFirst(arr, fn);
}
105541
function firstOrDefault(arr, filter) {
    for (const item of arr) {
        if (filter(item))
            return item;
    }
    return null;
}
808991
public static function first($value)
    {

        if (is_array($value) && $value) {
            reset($value);
            return current($value);
        }

        if (!$value) {
            return null;
        }

        if (is_string($value)) {
            return $value[0];
        }

        if (!is_object($value)) {
            return null;
        }

        if ($value instanceof ArrayAccess && isset($value[0])) {
            return $value[0];
        }

        if (!$value instanceof Traversable) {
            return null;
        }

        foreach ($value as $key=>$item) {
            return $item;
        }

        return null;

    }