Options
All
  • Public
  • Public/Protected
  • All
Menu

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

Index

Type aliases

Functions

Type aliases

Binary

Binary<T, U>: (this: U, value: T, 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 parameters

  • T

  • U

Type declaration

    • (this: U, value: T, index: number): boolean
    • Parameters

      • this: U
      • value: T
      • index: number

      Returns boolean

Nullary

Nullary<U>: (this: U) => boolean

Checks whether an element in a collection passes a test.

returns

boolean indicating whether an element in a collection passes a test

Type parameters

  • U

Type declaration

    • (this: U): boolean
    • Parameters

      • this: U

      Returns boolean

Predicate

Predicate<T, U>: Nullary<U> | Unary<T, U> | Binary<T, U> | Ternary<T, U>

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 parameters

  • T

  • U

Ternary

Ternary<T, U>: (this: U, value: T, index: number, collection: Collection<T>) => 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 parameters

  • T

  • U

Type declaration

    • (this: U, value: T, index: number, collection: Collection<T>): boolean
    • Parameters

      • this: U
      • value: T
      • index: number
      • collection: Collection<T>

      Returns boolean

Unary

Unary<T, U>: (this: U, value: T) => 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 parameters

  • T

  • U

Type declaration

    • (this: U, value: T): boolean
    • Parameters

      • this: U
      • value: T

      Returns boolean

Functions

noneBy

  • Tests whether all elements in a collection fail 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 true.

    Type parameters

    • T

    • U

    Parameters

    • collection: Collection<T>

      input collection

    • predicate: Predicate<T, U>

      test function

    • Optional thisArg: ThisParameterType<Predicate<T, U>>

      execution context

    Returns boolean

    boolean indicating whether all elements fail a test

    Example

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