Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "singleOrNull"

Index

Functions

Functions

singleOrNull

  • singleOrNull<T>(this: Sequence<T>, predicate?: undefined | function): T | null
  • Returns the single element of the sequence or null 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 null if more or less than one element match the predicate.

    Type parameters

    • T

    Parameters

    • this: Sequence<T>
    • Optional predicate: undefined | function

    Returns T | null