Skip to main content
Module

x/lazy/lib/lazy.ts>Lazy#elementAtOrDefault

A linq-like lazy-evaluation enumerable/iteration library that aims to support deno, node & browser
Latest
method Lazy.prototype.elementAtOrDefault
import { Lazy } from "https://deno.land/x/lazy@v1.7.3/lib/lazy.ts";

Returns the element at the given index of the iterable, or the given default value if out of range.

Parameters

index: number

The index of the element to get.

defaultValue: TElement

The default value to use if the index was out of range.

Returns

TElement

The element at the given index.

Returns the element at the given index of the iterable, or the given default value if out of range.

Parameters

index: number

The index of the element to get.

defaultValue: TDefault

The default value to use if the index was out of range.

Returns

TElement | TDefault

The element at the given index.