method Enumerable.prototype.first
Enumerable.prototype.first(): Promise<T>

Get the first item in the sequence.

Consumes the enumeration and returns the first element.

Examples

Get first item

import { range } from "jsr:@j50n/proc";

const first = await range({ from: 5, to: 10 }).first;
// 5

Return Type

Promise<T>

Throws

RangeError if the sequence is empty.

Usage

import { Enumerable } from ".";