@siderite/linqer-ts
    Preparing search index...

    Class default<T>

    wrapper class over iterable instances that exposes the methods usually found in .NET LINQ

    Type Parameters

    • T

    Implements

    • Iterable<T>
    Index

    Constructors

    • Do not use directly - use the static 'from' method

      Type Parameters

      • T

      Parameters

      • src: IterableType<T>

      Returns default<T>

    Properties

    _canSeek: boolean
    _count: (() => number) | null
    _generator: () => Iterator<T>
    _src: IterableType<T>
    _tryGetAt: ((index: number) => { value: T } | null) | null
    _useQuickSort: boolean
    _wasIterated: boolean

    Accessors

    • get length(): number

      Gets the number of items in the enumerable or throws an error if it needs to be enumerated to get it

      Returns number

    Methods

    • Internal

      Ensure there is an internal indexer function adequate for this enumerable This also determines if the enumerable can seek

      Returns void

    • the Enumerable instance exposes the same iterator as the wrapped iterable or generator function

      Returns Iterator<T>

      [symbol.iterator]

    • Applies an accumulator function over a sequence. The specified seed value is used as the initial accumulator value, and the specified function is used to select the result value. (equivalent to Javascript reduce)

      Type Parameters

      • TAcc

      Parameters

      Returns TAcc

      aggregate

    • Determines whether all elements of a sequence satisfy a condition.

      Parameters

      • condition: IFilter<T>

      Returns boolean

      true if all

    • Determines whether any element of a sequence exists or satisfies a condition.

      Parameters

      • condition: IFilter<T>

      Returns boolean

      true if any

    • Computes the average of a sequence of numeric values

      Returns number | undefined

      average

    • returns the index of a value in an ordered enumerable or false if not found WARNING: use the same comparer as the one used in the ordered enumerable. The algorithm assumes the enumerable is already sorted.

      Parameters

      • value: T
      • Optionalcomparer: IComparer<T> = ...

      Returns number | boolean

      search

    • Determines whether the Enumerable can seek (lookup an item by index)

      Returns boolean

    • Checks the elements of a sequence based on their type If type is a string, it will check based on typeof, else it will use instanceof. Throws if types are different.

      Parameters

      • type: any

      Returns default<T>

      cast

    • Concatenates two sequences by appending iterable to the existing one

      Parameters

      • iterable: IterableType<T>

      Returns default<T>

      concat

    • Determines whether a sequence contains a specified element. A custom function can be used to determine equality between elements.

      Parameters

      • item: T
      • OptionalequalityComparer: IEqualityComparer<T> = ...

      Returns boolean

      true if contains

    • Returns the number of items in the Enumerable, even if it has to enumerate all items to do it

      Returns number

      count

    • Not implemented

      Returns never

      if empty

    • Returns distinct elements from a sequence. WARNING: using a comparer makes this slower. Not specifying it uses a Set to determine distinctiveness.

      Parameters

      • OptionalequalityComparer: IEqualityComparer<T>

      Returns default<T>

      distinct

    • Returns the element at a specified index in a sequence

      Parameters

      • index: number

      Returns T

      at

    • Returns the element at a specified index in a sequence or undefined if the index is out of range.

      Parameters

      • index: number

      Returns T | undefined

      at or default

    • Produces the set difference of two sequences WARNING: using the comparer is slower

      Parameters

      • iterable: IterableType<T>
      • OptionalequalityComparer: IEqualityComparer<T>

      Returns default<T>

      except

    • Returns the values that have different hashes from the items of the iterable provided

      Type Parameters

      • TResult

      Parameters

      • iterable: IterableType<T>
      • hashFunc: ISelector<T, TResult>

      Returns default<T>

      by hash

    • Returns the first element of a sequence, or undefined if no element is found

      Returns T | undefined

      or default

    • Correlates the elements of two sequences based on key equality and groups the results. A specified equalityComparer is used to compare keys WARNING: using the equality comparer will be slower

      Type Parameters

      • TOther
      • TKey
      • TResult

      Parameters

      • iterable: IterableType<TOther>
      • innerKeySelector: ISelector<T, TKey>
      • outerKeySelector: ISelector<TOther, TKey>
      • resultSelector: (item1: T, item2: TOther[]) => TResult
      • OptionalequalityComparer: IEqualityComparer<TKey>

      Returns default<TResult>

      join

    • Produces the set intersection of two sequences. WARNING: using a comparer is slower

      Parameters

      • iterable: IterableType<T>
      • OptionalequalityComparer: IEqualityComparer<T>

      Returns default<T>

      intersect

    • Returns the values that have the same hashes as items of the iterable provided

      Type Parameters

      • TResult

      Parameters

      • iterable: IterableType<T>
      • hashFunc: ISelector<T, TResult>

      Returns default<T>

      by hash

    • Correlates the elements of two sequences based on matching keys WARNING: using the equality comparer will be slower

      Type Parameters

      • TOther
      • TKey
      • TResult

      Parameters

      • iterable: IterableType<TOther>
      • innerKeySelector: ISelector<T, TKey>
      • outerKeySelector: ISelector<TOther, TKey>
      • resultSelector: (item1: T, item2: TOther) => TResult
      • OptionalequalityComparer: IEqualityComparer<TKey>

      Returns default<TResult>

      join

    • Joins each item of the enumerable with previous items from the same enumerable

      Type Parameters

      • TResult

      Parameters

      • offset: number
      • zipper: (item1: T, item2?: T) => TResult

      Returns default<TResult>

      lag

    • Joins each item of the enumerable with previous items from the same enumerable

      Parameters

      • offset: number

      Returns default<[T, T | undefined]>

      lag

    • Returns the last element of a sequence, or undefined if no element is found

      Returns T | undefined

      or default

    • Joins each item of the enumerable with next items from the same enumerable

      Type Parameters

      • TResult

      Parameters

      • offset: number
      • zipper: (item1: T, item2?: T) => TResult

      Returns default<TResult>

      lead

    • Joins each item of the enumerable with next items from the same enumerable

      Parameters

      • offset: number

      Returns default<[T, T | undefined]>

      lead

    • Returns the maximum value in a sequence of values. A custom function can be used to establish order (the result 0 means equal, 1 means larger, -1 means smaller)

      Parameters

      • Optionalcomparer: IComparer<T>

      Returns T | undefined

      max

    • Returns the minimum value in a sequence of values. A custom function can be used to establish order (the result 0 means equal, 1 means larger, -1 means smaller)

      Parameters

      • Optionalcomparer: IComparer<T>

      Returns T | undefined

      min

    • Filters the elements of a sequence based on their type If type is a string, it will filter based on typeof, else it will use instanceof

      Parameters

      • type: any

      Returns default<T>

      type

    • Sorts the elements of a sequence in ascending order

      Type Parameters

      • TOther

      Parameters

      Returns OrderedEnumerable<T>

      by

    • Sorts the elements of a sequence in ascending order

      Returns OrderedEnumerable<T>

      by

    • Sorts the elements of a sequence in descending order

      Type Parameters

      • TOther

      Parameters

      Returns OrderedEnumerable<T>

      by descending

    • Sorts the elements of a sequence in descending order

      Returns OrderedEnumerable<T>

      by descending

    • Returns an enumerable of at least minLength, padding the end with a value or the result of a function

      Parameters

      • minLength: number
      • filler: T | ((index: number) => T)

      Returns default<T>

      end

    • Returns an enumerable of at least minLength, padding the start with a value or the result of a function if the enumerable cannot seek, then it will be iterated minLength time

      Parameters

      • minLength: number
      • filler: T | ((index: number) => T)

      Returns default<T>

      start

    • Implements random reservoir sampling of k items, with the option to specify a maximum limit for the items

      Parameters

      • k: number
      • Optionallimit: number = Number.MAX_SAFE_INTEGER

      Returns default<T>

      sample

    • Projects each element of a sequence to an iterable and flattens the resulting sequences into one sequence

      Type Parameters

      • TResult

      Parameters

      • Optionalselector: ISelector<T, Iterable<TResult, any, any>>

      Returns default<TResult>

      many

    • Determines whether two sequences are equal and in the same order according to an equality comparer

      Parameters

      • iterable: IterableType<T>
      • OptionalequalityComparer: IEqualityComparer<T> = ...

      Returns boolean

      true if equal

    • Returns the single element of a sequence and throws if it doesn't have exactly one

      Returns T

      single

    • Returns the single element of a sequence or undefined if none found. It throws if the sequence contains multiple items

      Returns T | undefined

      or default

    • Bypasses a specified number of elements in a sequence and then returns an Enumerable of the remaining elements

      Parameters

      • nr: number

      Returns default<T>

      skip

    • Returns a new enumerable collection that contains the elements from source with the last nr elements of the source collection omitted

      Parameters

      • nr: number

      Returns default<T>

      last

    • Bypasses elements in a sequence as long as a specified condition is true and then returns the remaining elements.

      Parameters

      • condition: IFilter<T>

      Returns default<T>

      while

    • Selects the elements starting at the given start argument, and ends at, but does not include, the given end argument

      Parameters

      • Optionalstart: number = 0
      • Optionalend: number

      Returns default<T>

      slice

    • Takes start elements, ignores howmany elements, continues with the new items and continues with the original enumerable Equivalent to the value of an array after performing splice on it with the same parameters

      Parameters

      • start: number
      • howmany: number
      • ...newItems: T[]

      Returns default<T>

      splice

    • Returns the count, minimum and maximum value in a sequence of values. A custom function can be used to establish order (the result 0 means equal, 1 means larger, -1 means smaller)

      Parameters

      • Optionalcomparer: IComparer<T>

      Returns { count: number; max?: T; min?: T }

      stats

    • Computes the sum of a sequence of numeric values

      Returns number | undefined

      sum

    • Computes the sum and count of a sequence of numeric values

      Returns { count: number; sum: number }

      and count

    • Returns a specified number of contiguous elements from the start of a sequence

      Parameters

      • nr: number

      Returns default<T>

      take

    • Returns a new enumerable collection that contains the last nr elements from source

      Parameters

      • nr: number

      Returns default<T>

      last

    • Returns elements from a sequence as long as a specified condition is true, and then skips the remaining elements

      Parameters

      • condition: IFilter<T>

      Returns default<T>

      while

    • Creates an array from an Enumerable

      Returns T[]

      array

    • Not implemented (use toMap)

      Returns never

      dictionary

    • Not implemented (use toSet)

      Returns never

      hash set

    • Similar to toArray, but returns a seekable Enumerable (itself if already seekable) that can do count and elementAt without iterating

      Returns default<T>

      list

    • Not implemented (use groupBy)

      Returns never

      lookup

    • Creates a map from an Enumerable based on a key function and a value function

      Type Parameters

      • TKey
      • TResult

      Parameters

      • keySelector: ISelector<T, TKey>
      • valueSelector: ISelector<T, TResult>

      Returns Map<TKey, TResult>

      map

    • Creates a map from an Enumerable based on a key function and the value from the Enumerable

      Type Parameters

      • TKey

      Parameters

      • keySelector: ISelector<T, TKey>

      Returns Map<TKey, T>

      map

    • Creates an object from an enumerable

      Parameters

      • keySelector: ISelector<T, string>
      • OptionalvalueSelector: ISelector<T, any> = ...

      Returns { [key: string]: any }

      object

    • Produces the set union of two sequences

      Parameters

      • iterable: IterableType<T>
      • OptionalequalityComparer: IEqualityComparer<T>

      Returns default<T>

      union

    • use QuickSort for ordering (default). Recommended when take, skip, takeLast, skipLast are used after orderBy

      Returns default<T>

      quick sort

    • Filters a sequence of values based on a predicate (equivalent to Javascript filter)

      Parameters

      • condition: IFilter<T>

      Returns default<T>

      where

    • wraps an iterable item into an Enumerable if it's not already one

      Type Parameters

      • T

      Parameters

      • iterable: IterableType<T>

      Returns default<T>

      from

    • generates a sequence of integer numbers within a specified range.

      Parameters

      • start: number
      • count: number

      Returns default<number>

      range

    • generates a sequence that contains one repeated value

      Type Parameters

      • T

      Parameters

      • item: T
      • count: number

      Returns default<T>

      repeat

    • Sorts an array in place using Quicksort

      Type Parameters

      • T

      Parameters

      • arr: T[]
      • Optionalcomparer: IComparer<T>

      Returns T[]

      sort