Options
All
  • Public
  • Public/Protected
  • All
Menu

Module Enumerable

A Format.Utils sub-module containing methods related to enumeration operations.

Index

Functions

Functions

compact

  • compact<T>(array: T[]): T[]
  • Removes "holes" (undefined elements) from the array making it compact/dense.

    Type parameters

    • T

      The type of elements in the array.

    Parameters

    • array: T[]

      An array instance.

    Returns T[]

    The same array instance without undefined elements.

takeWhile

  • takeWhile<T>(array: T[], predicate: function): T[]
  • Returns elements from a sequence as long as the specified condition is true.

    Type parameters

    • T

      The type of elements in the array.

    Parameters

    • array: T[]

      An array instance.

    • predicate: function

      A function to test each source element for a condition; the second parameter of the function represents the index of the source element.

        • (item: T, index?: number): boolean
        • Parameters

          • item: T

            A source element that is tested for a condition.

          • Optional index: number

            The index of the source element.

          Returns boolean

    Returns T[]

    A new array instance containing only items for which the predicate function returned true.

Generated using TypeDoc