Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "utils/any-by-right/docs/types/index.d"

Index

Type aliases

Functions

Type aliases

Binary

Binary: (value: any, index: number) => boolean

Checks whether an element in a collection passes a test.

param

collection value

param

collection index

returns

boolean indicating whether an element in a collection passes a test

Type declaration

    • (value: any, index: number): boolean
    • Parameters

      • value: any
      • index: number

      Returns boolean

Nullary

Nullary: () => boolean

Checks whether an element in a collection passes a test.

returns

boolean indicating whether an element in a collection passes a test

Type declaration

    • (): boolean
    • Returns boolean

Predicate

Predicate: Nullary | Unary | Binary | Ternary

Checks whether an element in a collection passes a test.

param

collection value

param

collection index

param

input collection

returns

boolean indicating whether an element in a collection passes a test

Ternary

Ternary: (value: any, index: number, collection: Collection) => boolean

Checks whether an element in a collection passes a test.

param

collection value

param

collection index

param

input collection

returns

boolean indicating whether an element in a collection passes a test

Type declaration

    • (value: any, index: number, collection: Collection): boolean
    • Parameters

      Returns boolean

Unary

Unary: (value: any) => boolean

Checks whether an element in a collection passes a test.

param

collection value

returns

boolean indicating whether an element in a collection passes a test

Type declaration

    • (value: any): boolean
    • Parameters

      • value: any

      Returns boolean

Functions

Export assignment anyByRight

  • Tests whether at least one element in a collection passes a test implemented by a predicate function.

    Notes

    • The predicate function is provided three arguments:

      • value: collection value
      • index: collection index
      • collection: the input collection
    • The function immediately returns upon encountering a truthy return value.

    • If provided an empty collection, the function returns false.

    Parameters

    • collection: Collection

      input collection

    • predicate: Predicate

      test function

    • Optional thisArg: any

      execution context

    Returns boolean

    boolean indicating whether at least one element passes a test

    Example

    function isNegative( v ) {
        return ( v < 0 );
    }
    
    var arr = [ -1, 1, 2, 3, 4 ];
    
    var bool = anyByRight( arr, isNegative );
    // returns true