UNPKG

sequency

Version:

Functional sequences for processing iterable data in JavaScript

13 lines (12 loc) 518 B
import Sequence from "./Sequence"; export declare class Single { /** * Returns the single element of the sequence or throws error if the sequence has more than * one element or none at all. If a `predicate` is passed returns the single element matching * the predicate or throws an error if more or less than one element match the predicate. * * @param {(value: T) => boolean} predicate * @returns {T} */ single<T>(this: Sequence<T>, predicate?: (value: T) => boolean): T; }