Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "utils/some/docs/types/index.d"

Index

Functions

Functions

Export assignment some

  • some(collection: Collection, n: number): boolean
  • Tests whether a collection contains at least n elements which are truthy.

    Notes

    • The function immediately returns upon finding n truthy elements.
    • If provided an empty collection, the function returns false.
    throws

    second argument must be a positive integer

    Parameters

    • collection: Collection

      input collection

    • n: number

      number of elements

    Returns boolean

    boolean indicating whether a collection contains at least n elements which are truthy

    Example

    var arr = [ 0, 0, 1, 2, 3 ];
    
    var bool = some( arr, 3 );
    // returns true