Options
All
  • Public
  • Public/Protected
  • All
Menu

Defines abstract contract for collection with elements that allows iterations and transformations. Be aware that there is no any method for mutating container's content, so it is preferable that all high order functions that are passed into methods of the container are implemented as pure functions.

Type parameters

  • E

Hierarchy

  • Collection

Implemented by

Index

Methods

every

  • every(p: function): boolean
  • Tests whether all elements in the array pass the given predicate.

    Parameters

    • p: function

      predicate to check elements.

        • (e: E): boolean
        • Parameters

          • e: E

          Returns boolean

    Returns boolean

    true if for every element the predicate returns true.

filter

  • Filters elements of this container. Returns empty container if the predicates filters all elements in this container.

    Parameters

    • p: function

      filter predicate.

        • (e: E): boolean
        • Parameters

          • e: E

          Returns boolean

    Returns Collection<E>

    new container with elements for which p(element) === true.

find

  • find(p: function): E | undefined
  • Returns the value of the first element in the array that satisfies the provided predicate. Otherwise undefined is returned.

    Parameters

    • p: function

      predicate to check elements.

        • (e: E): boolean
        • Parameters

          • e: E

          Returns boolean

    Returns E | undefined

    first found element or undefined.

forEach

  • forEach(f: function): void
  • Executes given function for each element in this container.

    Parameters

    • f: function

      function to apply to each element.

        • (e: E): void
        • Parameters

          • e: E

          Returns void

    Returns void

iterator

map

  • Transforms every element of this container and returns new container with transformed elements. Returns empty container if this container is empty.

    Type parameters

    • T

    Parameters

    • f: function

      transformation function.

        • (e: E): T
        • Parameters

          • e: E

          Returns T

    Returns Collection<T>

    new container with transformed elements.

reduce

  • reduce<A>(r: function, initialValue: A): A
  • Reduces content of this container to some another type's instance.

    Type parameters

    • A

    Parameters

    • r: function

      reducer.

        • (accumulator: A, currentElement: E): A
        • Parameters

          • accumulator: A
          • currentElement: E

          Returns A

    • initialValue: A

      initial value of accumulator.

    Returns A

    result of reducing.

size

  • size(): number
  • Returns amount of elements in this container.

    Returns number

    amount of elements in this container.

some

  • some(p: function): boolean
  • Checks whether there is an element that passes given predicate.

    Parameters

    • p: function

      predicate to check elements.

        • (e: E): boolean
        • Parameters

          • e: E

          Returns boolean

    Returns boolean

    true if there is an element for which the predicate returns true.

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method

Generated using TypeDoc