Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface IEnumerable<T>

A sequence.

template

T Type of the items.

Type parameters

  • T

Hierarchy

Implemented by

Index

Properties

canReset

canReset: boolean

Gets if that sequence can be resetted or not.

current

current: IteratorResult<T>

Gets the current iterator result.

index

index: number

Gets the current zero based index.

Methods

__@iterator

  • __@iterator(): Iterator<T>
  • Returns Iterator<T>

abs

  • Handles current items as numbers and returns their absolute values.

    Parameters

    • Optional handleAsInt: boolean

    Returns IEnumerable<number>

    The new sequence.

aggregate

  • aggregate<TAccumulate, TResult>(func: function, seed?: TAccumulate, resultSelector?: function): TResult
  • Applies an accumulator function over that sequence. If specified 'seed' is used as the initial accumulator value, and (if specified) the 'resultSelector' is used to select the result value.

    template

    TAccumulate The type of the accumulator value.

    template

    TResult The result type.

    Type parameters

    • TAccumulate

    • TResult

    Parameters

    • func: function

      An accumulator function to be invoked on each element.

        • (accumulator: TAccumulate, item: T): TAccumulate
        • Parameters

          • accumulator: TAccumulate
          • item: T

          Returns TAccumulate

    • Optional seed: TAccumulate
    • Optional resultSelector: function
        • (accumulator: TAccumulate): TResult
        • Parameters

          • accumulator: TAccumulate

          Returns TResult

    Returns TResult

    The final value.

all

  • Checks if all elements of that sequence satisfy a condition or not.

    Parameters

    Returns boolean

    All elements satisfy the condition or not.

any

  • Checks if at least one element of that sequence satisfies a condition or not.

    Parameters

    • Optional predicate: Predicate<T>

      The condition.

    Returns boolean

    One element satisfies the condition or not.

append

appendArray

arcCos

  • Handles current items as numbers and calculates the arc cosine for each item.

    Parameters

    • Optional handleAsInt: boolean

    Returns IEnumerable<number>

    The new sequence.

arcCosH

  • Handles current items as numbers and calculates the arc hyperbolic cosine for each item.

    Parameters

    • Optional handleAsInt: boolean

    Returns IEnumerable<number>

    The new sequence.

arcSin

  • Handles current items as numbers and calculates the arc sine for each item.

    Parameters

    • Optional handleAsInt: boolean

    Returns IEnumerable<number>

    The new sequence.

arcSinH

  • Handles current items as numbers and calculates the arc hyperbolic sine for each item.

    Parameters

    • Optional handleAsInt: boolean

    Returns IEnumerable<number>

    The new sequence.

arcTan

  • Handles current items as numbers and calculates the arc tangent for each item.

    Parameters

    • Optional handleAsInt: boolean

    Returns IEnumerable<number>

    The new sequence.

arcTanH

  • Handles current items as numbers and calculates the arc hyperbolic tangent for each item.

    Parameters

    • Optional handleAsInt: boolean

    Returns IEnumerable<number>

    The new sequence.

assert

  • Asserts that all elements of that sequence meet a given condition, otherwise an error is throw at first fail.

    chainable
    throws

    One element failed.

    Parameters

    Returns this

assertAll

  • Asserts that all elements of that sequence meet a given condition, otherwise an error is throw at the end.

    chainable
    throws

    At least one element failed.

    Parameters

    Returns this

async

  • async(action: AsyncAction<T>, previousValue?: any): Promise<any>
  • Runs an async action for each item of that sequence.

    Parameters

    Returns Promise<any>

    The promise.

average

  • average(selector?: Selector<T, number>): number | symbol
  • Calculates the average of the items of that sequence.

    Parameters

    • Optional selector: Selector<T, number>

    Returns number | symbol

    The average or IS_EMPTY if sequence is empty.

cast

  • Returns a "casted" version of that sequence.

    template

    U The target type.

    throws

    Target type is not supported

    Type parameters

    • U

    Parameters

    • Optional type: string

    Returns IEnumerable<U>

    The "casted" sequence.

ceil

  • Handles current items as float values and returns the smallest value greater than or equal to them.

    Returns IEnumerable<number>

    The new sequence.

chunk

  • Splits the given sequence into chunks of the given size.

    Parameters

    • Optional size: number

    Returns IEnumerable<IEnumerable<T>>

    The sequence of chunks.

clone

  • Clones that sequence multiply times.

    template

    U The type of the target sequences.

    Type parameters

    • U

    Parameters

    • Optional count: number
    • Optional itemSelector: Selector<T, U>

    Returns IEnumerable<IEnumerable<U>>

    The sequence of sequences.

concat

  • Concats the items of that sequences with other ones to a new sequence.

    memberof

    IEnumerable<T|U> The concated sequence.

    Type parameters

    • U

    Parameters

    • Rest ...args: Sequence<U>[]

      The other sequences.

    Returns IEnumerable<T | U>

concatArray

  • Concats the items of that sequences with other ones to a new sequence.

    memberof

    IEnumerable<T|U> The concated sequence.

    Type parameters

    • U

    Parameters

    • sequences: ArrayLike<Sequence<U>>

      The other sequences.

    Returns IEnumerable<T | U>

consume

  • consume(): this
  • Completely consumes the given sequence. This method uses immediate execution, and doesn't store any data during execution.

    chainable

    Returns this

contains

  • Checks if that sequence contains an item.

    template

    U Type of the item to search for.

    Type parameters

    • U

    Parameters

    • item: U

      The item to search for.

    • Optional comparer: EqualityComparer<T, U> | true

    Returns boolean

    Sequence contains item or not.

cos

  • Handles current items as numbers and calculates the cosine for each item.

    Parameters

    • Optional handleAsInt: boolean

    Returns IEnumerable<number>

    The new sequence.

cosH

  • Handles current items as numbers and calculates the hyperbolic cosine for each item.

    Parameters

    • Optional handleAsInt: boolean

    Returns IEnumerable<number>

    The new sequence.

count

  • Counts the elements of that sequence.

    Parameters

    Returns number

    The number of (matching) items.

defaultArrayIfEmpty

defaultIfEmpty

  • defaultIfEmpty(...defaultItems: Array<T>): IEnumerable<T>
  • Returns the items of that sequence or a default item list if that sequence is empty.

    Parameters

    • Rest ...defaultItems: Array<T>

      The default items.

    Returns IEnumerable<T>

    The (new) sequence.

defaultSequenceIfEmpty

  • Returns the items of that sequence or a default item list if that sequence is empty.

    Parameters

    • defaultSequence: Sequence<T>

      The default items.

    Returns IEnumerable<T>

    The (new) sequence.

distinct

distinctBy

  • Removes duplicate entries from that sequence by using a selector.

    Type parameters

    • U

    Parameters

    Returns IEnumerable<T>

    The new sequence.

each

eachAll

elementAt

  • elementAt(index: number): T
  • Returns an element at a specific index.

    throws

    Element not found.

    Parameters

    • index: number

      The zero based index.

    Returns T

    The element.

elementAtOrDefault

  • elementAtOrDefault<U>(index: number, defaultValue?: U): T | U
  • Returns an element at a specific index.

    template

    U Type of the default value.

    throws

    Element not found.

    Type parameters

    • U

    Parameters

    • index: number

      The zero based index

    • Optional defaultValue: U

    Returns T | U

    The element.

except

exp

  • Handles current items as numbers and calculates e (the base of natural logarithms) raised to each value.

    Parameters

    • Optional handleAsInt: boolean

    Returns IEnumerable<number>

    The new sequence.

first

  • Returns the first element of that sequence.

    throws

    Element not found.

    Parameters

    Returns T

    The first element.

firstOrDefault

  • firstOrDefault<U>(predicateOrDefaultValue?: Predicate<T> | T, defaultValue?: U): T | U
  • Tries to return the first element.

    template

    U Type of the default value.

    Type parameters

    • U

    Parameters

    • Optional predicateOrDefaultValue: Predicate<T> | T
    • Optional defaultValue: U

    Returns T | U

    The item or the default value.

flatten

  • Returns a flattened sequence that contains the concatenation of all the nested sequences elements.

    Type parameters

    • U

    Returns IEnumerable<U>

    The flatten items.

floor

  • Handles current items as float values and return the greatest value less than or equal to them.

    Returns IEnumerable<number>

    The new sequence.

forAll

  • Invokes a function for each element of that sequence and continues even if an error is thrown. All occurred errors will be thrown at the end.

    throws

    At least on error was thrown while the execution.

    chainable

    Parameters

    Returns this

forEach

  • Invokes a function for each element of that sequence.

    chainable

    Parameters

    Returns this

groupBy

  • Groups the items of that sequence by a key.

    template

    TKey Type of the keys.

    Type parameters

    • TKey

    Parameters

    Returns IEnumerable<IGrouping<TKey, T>>

    The grouped items.

groupJoin

  • groupJoin<TInner, TOuterKey, TInnerKey, TResult>(inner: Sequence<TInner>, outerKeySelector?: Selector<T, TOuterKey>, innerKeySelector?: Selector<TInner, TInnerKey>, resultSelector?: function, keyEqualityComparer?: EqualityComparer<TOuterKey, TInnerKey> | true): IEnumerable<TResult>
  • Correlates the elements of that sequence and another based on matching keys and groups them.

    Type parameters

    • TInner

    • TOuterKey

    • TInnerKey

    • TResult

    Parameters

    • inner: Sequence<TInner>

      The other sequence.

    • Optional outerKeySelector: Selector<T, TOuterKey>
    • Optional innerKeySelector: Selector<TInner, TInnerKey>
    • Optional resultSelector: function
        • Parameters

          Returns TResult

    • Optional keyEqualityComparer: EqualityComparer<TOuterKey, TInnerKey> | true

    Returns IEnumerable<TResult>

    The new sequence.

indexOf

  • Returns the zero based index of the first occurrence of an item.

    template

    U Type of the item to search for.

    Type parameters

    • U

    Parameters

    • item: U

      The item to search for.

    • Optional comparer: EqualityComparer<T, U> | true

    Returns number

    The index or -1 if not found.

intersect

intersperse

  • intersperse<U>(...separators: U[]): IEnumerable<T | U>
  • Returns all elements of the collection separated by the given separator(s).

    Type parameters

    • U

    Parameters

    • Rest ...separators: U[]

    Returns IEnumerable<T | U>

    The new sequence.

intersperseArray

  • Returns all elements of the collection separated by the given separator(s).

    Type parameters

    • U

    Parameters

    • separators: Sequence<U>

      The separators.

    Returns IEnumerable<T | U>

    The new sequence.

isEmpty

  • isEmpty(): boolean
  • Checks if that sequence is empty or not by using the length() method.

    Returns boolean

    Is Empty or not.

join

  • join<TInner, TOuterKey, TInnerKey, TResult>(inner: Sequence<TInner>, outerKeySelector?: Selector<T, TOuterKey>, innerKeySelector?: Selector<TInner, TInnerKey>, resultSelector?: function, keyEqualityComparer?: EqualityComparer<TOuterKey, TInnerKey> | true): IEnumerable<TResult>
  • Correlates the elements of that sequence and another based on matching keys.

    Type parameters

    • TInner

    • TOuterKey

    • TInnerKey

    • TResult

    Parameters

    • inner: Sequence<TInner>

      The other sequence.

    • Optional outerKeySelector: Selector<T, TOuterKey>
    • Optional innerKeySelector: Selector<TInner, TInnerKey>
    • Optional resultSelector: function
        • (outer: T, inner: TInner): TResult
        • Parameters

          • outer: T
          • inner: TInner

          Returns TResult

    • Optional keyEqualityComparer: EqualityComparer<TOuterKey, TInnerKey> | true

    Returns IEnumerable<TResult>

    The new sequence.

joinToString

  • joinToString(separator?: any): string
  • Joins the items of that sequence to one string.

    Parameters

    • Optional separator: any

    Returns string

    The items as string.

last

  • Returns the last element of that sequence.

    throws

    Element not found.

    Parameters

    Returns T

    The last element.

lastIndexOf

  • Returns the zero based index of the last occurrence of an item.

    template

    U Type of the item to search for.

    Type parameters

    • U

    Parameters

    • item: U

      The item to search for.

    • Optional comparer: EqualityComparer<T, U> | true

    Returns number

    The index or -1 if not found.

lastOrDefault

  • lastOrDefault<U>(predicateOrDefaultValue?: Predicate<T> | T, defaultValue?: U): T | U
  • Tries to return the last element.

    template

    U Type of the default value.

    Type parameters

    • U

    Parameters

    • Optional predicateOrDefaultValue: Predicate<T> | T
    • Optional defaultValue: U

    Returns T | U

    The item or the default value.

length

  • length(): number
  • Returns the length of the underlying collection. If the underlying object does NOT contain a 'length' property, like a generator, it will behave the same way as 'count' method.

    Returns number

    The length.

log

  • log(base?: number, handleAsInt?: boolean): IEnumerable<number>
  • Handles current items as numbers and calculates the logarithm of them.

    Parameters

    • Optional base: number
    • Optional handleAsInt: boolean

    Returns IEnumerable<number>

    The new sequence.

makeResettable

  • Returns a resettable version of that sequence.

    Returns IEnumerable<T>

    The resettable version of that sequence.

max

  • Returns the maximum item of that sequence.

    Type parameters

    • U

    Parameters

    Returns T | symbol

    The item or IS_EMPTY if that sequence is empty.

min

  • Returns the minimum item of that sequence.

    Type parameters

    • U

    Parameters

    Returns T | symbol

    The item or IS_EMPTY if that sequence is empty.

next

  • next(value?: any): IteratorResult<T>
  • Parameters

    • Optional value: any

    Returns IteratorResult<T>

noNAN

  • Removes all values that are no valid numbers.

    Parameters

    • Optional checkForInt: boolean

    Returns IEnumerable<T>

    The filtered sequence.

not

  • Filters the items of that sequence based on a given predicate and returns those items that do not match the predicate.

    Parameters

    Returns IEnumerable<T>

    The filtered sequence.

notEmpty

ofType

  • Filters items of specific type.

    template

    U The type of the target sequence.

    Type parameters

    • U

    Parameters

    • type: string

      The type.

    Returns IEnumerable<U>

    The filtered sequence.

order

  • Sorts the elements of that sequence in ascending order by using the values itself as keys.

    Parameters

    Returns IOrderedEnumerable<T>

    The new sequence.

orderBy

  • Sorts the elements of that sequence in ascending order.

    Type parameters

    • U

    Parameters

    Returns IOrderedEnumerable<T>

    The new sequence.

orderByDescending

  • Sorts the elements of that sequence in descending order.

    Type parameters

    • U

    Parameters

    Returns IOrderedEnumerable<T>

    The new sequence.

orderDescending

  • Sorts the elements of that sequence in descending order by using the values as keys.

    Parameters

    Returns IOrderedEnumerable<T>

    The new sequence.

pipe

  • Executes the given action on each element in the source sequence and yields it.

    Parameters

    Returns IEnumerable<T>

    The new sequence.

pow

  • pow(exponent?: number, handleAsInt?: boolean): IEnumerable<number>
  • Handles current items as base numbers and take them to a specific power.

    Parameters

    • Optional exponent: number
    • Optional handleAsInt: boolean

    Returns IEnumerable<number>

    The new sequence.

prepend

  • Prepends the itms of other sequences to the ones of that sequence.

    memberof

    IEnumerable<T|U> The concated sequence.

    Type parameters

    • U

    Parameters

    • Rest ...args: Sequence<T | U>[]

      The other sequences.

    Returns IEnumerable<T | U>

prependArray

  • Prepends the itms of other sequences to the ones of that sequence.

    memberof

    IEnumerable<T|U> The concated sequence.

    Type parameters

    • U

    Parameters

    • sequences: ArrayLike<Sequence<T | U>>

      The other sequences.

    Returns IEnumerable<T | U>

product

  • product(seed?: T): T | symbol
  • Calculates the product of that sequence.

    Parameters

    • Optional seed: T

    Returns T | symbol

    The product or IS_EMPTY if that sequence is empty.

pushTo

  • pushTo(stack: Stack<T>): this
  • Pushes the elements of that sequence to an array or stack-like object.

    Parameters

    • stack: Stack<T>

      The array or stack.

    Returns this

rand

  • Randomizes the order of that sequence.

    Parameters

    • Optional sortValueProvider: function

      A custom function that provides a random sort value.

        • (): any
        • Returns any

    Returns IOrderedEnumerable<T>

    The new sequence.

reset

  • reset(): this
  • Returns that sequence.

    throws

    Not supported

    Returns this

Optional return

  • return(value?: any): IteratorResult<T>
  • Parameters

    • Optional value: any

    Returns IteratorResult<T>

reverse

root

  • root(power?: number, handleAsInt?: boolean): IEnumerable<number>
  • Handles current items as numbers and calculates the n-th root for each item.

    Parameters

    • Optional power: number
    • Optional handleAsInt: boolean

    Returns IEnumerable<number>

    The new sequence.

round

  • Handles current items as float values and return their nearest values.

    Returns IEnumerable<number>

    The new sequence.

select

  • Projects the items of that sequence to new values / objects.

    template

    U The type of the new items.

    Type parameters

    • U

    Parameters

    Returns IEnumerable<U>

    The new sequence.

selectMany

  • Projects the items of that sequence to new sequences that are flatten to a single sequence.

    template

    U Type of the items of the result sequences.

    Type parameters

    • U

    Parameters

    Returns IEnumerable<U>

    The new, flatten sequence.

sequenceEqual

  • Checks if that sequence is equal to another.

    template

    U Type of the items of the other sequence.

    Type parameters

    • U

    Parameters

    Returns boolean

    Both are equal or not.

shuffle

sin

  • Handles current items as numbers and calculates the sine for each item.

    Parameters

    • Optional handleAsInt: boolean

    Returns IEnumerable<number>

    The new sequence.

sinH

  • Handles current items as numbers and calculates the hyperbolic sine for each item.

    Parameters

    • Optional handleAsInt: boolean

    Returns IEnumerable<number>

    The new sequence.

single

  • Returns the one and only element of that sequence.

    throws

    Element not found or sequence contains for than one (matching) element.

    Parameters

    Returns T

    The single element.

singleOrDefault

  • singleOrDefault<U>(predicateOrDefaultValue?: Predicate<T> | T, defaultValue?: U): T | U
  • Tries to return the one and only element.

    template

    U Type of the default value.

    throws

    Sequence contains for than one (matching) element.

    Type parameters

    • U

    Parameters

    • Optional predicateOrDefaultValue: Predicate<T> | T
    • Optional defaultValue: U

    Returns T | U

    The item or the default value.

skip

  • Skips a maximum number of items.

    Parameters

    • Optional count: number

    Returns IEnumerable<T>

    The new sequence.

skipLast

skipWhile

sqrt

  • Handles current items as numbers and calculates square root for each item.

    Parameters

    • Optional handleAsInt: boolean

    Returns IEnumerable<number>

    The new sequence.

sum

  • sum(seed?: T): T | symbol
  • Calculates the sum of that sequence.

    Parameters

    • Optional seed: T

    Returns T | symbol

    The sum or IS_EMPTY if that sequence is empty.

take

  • Takes a maximum number of items.

    Parameters

    • Optional count: number

    Returns IEnumerable<T>

    The new sequence.

takeWhile

tan

  • Handles current items as numbers and calculates the tangent for each item.

    Parameters

    • Optional handleAsInt: boolean

    Returns IEnumerable<number>

    The new sequence.

tanH

  • Handles current items as numbers and calculates the hyperbolic tangent for each item.

    Parameters

    • Optional handleAsInt: boolean

    Returns IEnumerable<number>

    The new sequence.

Optional throw

  • throw(e?: any): IteratorResult<T>
  • Parameters

    • Optional e: any

    Returns IteratorResult<T>

toArray

  • toArray(): Array<T>
  • Creates a new array from the items of that sequence.

    Returns Array<T>

    The sequence as array.

toLookup

  • Converts that sequence to a lookup object.

    template

    TKey Type of the keys.

    template

    U Type of the result object.

    Type parameters

    • TKey: PropertyKey

    • U

    Parameters

    Returns U

    U The lookup object

toObject

  • toObject<TResult, TKey>(keySelector?: function): TResult
  • Wraps the items of that sequence to an object.

    template

    TResult Type of the result.

    template

    TKey Type of the keys.

    Type parameters

    • TResult

    • TKey: PropertyKey

    Parameters

    • Optional keySelector: function
        • (item: T, index: number): TKey
        • Parameters

          • item: T
          • index: number

          Returns TKey

    Returns TResult

    TResult The new object.

trace

  • Traces the elements of that sequence.

    Parameters

    Returns IEnumerable<T>

    The new, piped sequence.

union

where

  • Filters the items of that sequence.

    Parameters

    • predicate: Predicate<T>

      The predicate to use.

    Returns IEnumerable<T>

    The filtered sequence.

zip

  • Applies a specified function to the corresponding elements of that sequence and another, producing a sequence of the results.

    template

    U Type of the other sequence.

    template

    TResult The result type.

    Type parameters

    • U

    • TResult

    Parameters

    • second: Sequence<U>

      The other sequence.

    • resultSelector: ZipSelector<T, U, TResult>

      The selector for the result item.

    Returns IEnumerable<TResult>

    The "zipped" sequence.

Generated using TypeDoc