Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "utils/every-by/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 everyBy

  • Tests whether all elements in a collection pass 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 non-truthy return value.

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

    Parameters

    • collection: Collection

      input collection

    • predicate: Predicate

      test function

    • Optional thisArg: any

      execution context

    Returns boolean

    boolean indicating whether all elements pass a test

    Example

    function isPositive( v ) {
        return ( v > 0 );
    }
    
    var arr = [ 1, 2, 3, 4 ];
    
    var bool = everyBy( arr, isPositive );
    // returns true