Options
Menu

Class ListUnit<Item, Item>

ListUnit is a reactive storage Unit that emulates array.

ListUnit only accepts array data type as its value. It ensures that at any point of time the value would always be an array.

ListUnit is based on array, it implements all the Array.prototype methods that are available in the environment/browser its running, including polyfills. e.g.: find, filter, includes, etc.

Learn more about Units here.
Learn more about ListUnit here.

Just like every other Non-Primitive ActiveJS Unit:

Hierarchy

Constructors

constructor

Properties

Array

Array: ArrayConstructor

Readonly cacheSize

cacheSize: number

Size of the cache, dictating how many values can be cached at a given time.

default

2

minimum

1

maximum

Infinity

Readonly config

config: Readonly<UnitConfig<Item[]>>

Configured options. Combination of global-options GlobalUnitConfig and the options passed on instantiation.

Readonly events$

events$: Observable<ListUnitEvents<Item>>

On-demand observable events.

Readonly future$

future$: Observable<Item[]> = this.futureSubject.asObservable()

An Observable to observe future values, unlike the default Observable it doesn't replay when subscribed to, rather it waits for the next value.

length

  • get length(): number

Accessors

cacheIndex

  • get cacheIndex(): number

cachedValuesCount

  • get cachedValuesCount(): number

emitCount

  • get emitCount(): number

isEmpty

  • get isEmpty(): boolean

isFrozen

  • get isFrozen(): boolean

isMuted

  • get isMuted(): boolean

Access Value Methods

cachedValues

  • cachedValues(): Item[][]

initialValue

  • initialValue(): Item[]

rawValue

  • rawValue(): Item[]
  • If the Unit has a non-primitive value, use it to get access to the current value, without creating a deep-copy.

    This can come in handy if the Unit is configured to be immutable, and you want to perform a non-mutating action without creating a deep-copy of the value.

    Returns Item[]

value

  • value(): Item[]

Cache Navigation Methods

goBack

  • goBack(): boolean

goForward

  • goForward(): boolean
  • After going back in the cache (ie: re-emitting an old value from the cache),
    use this method to go to the next value, without creating a new entry in the cache.

    It can be used as Redo.

    It doesn't work if the Unit is frozen isFrozen. It only works if the current value is not the last value in the cache.
    ie: the cacheIndex is not equal to cachedValuesCount - 1

    triggers

    EventUnitJump

    Returns boolean

    true if the cache-navigation was successful, otherwise false

jump

  • jump(steps: number): boolean
  • Use this method to re-emit a value from the cache, by jumping specific steps backwards or forwards,
    without creating a new entry in the cache.

    It doesn't work if the Unit is frozen isFrozen or steps is not a number. It only works if the new calculated index is in the bounds of cachedValues,
    ie: the new-index is >= 0, and less than cachedValuesCount, but
    not equal to current cacheIndex.

    triggers

    EventUnitJump

    Parameters

    • steps: number

      Number of steps to jump in the cache, negative to jump backwards, positive to jump forwards

    Returns boolean

    true if the cache-navigation was successful, otherwise false.

jumpToEnd

  • jumpToEnd(): boolean

jumpToStart

  • jumpToStart(): boolean

Common Methods

asObservable

  • asObservable(): Observable<Item[]>
  • Creates a new Observable using the default Observable as source. Use this to conceal other aspects of a Unit, System, Action or Cluster except the Observable part.

    Returns Observable<Item[]>

    An Observable with the value of a Unit, System, Action or Cluster.

createStream

  • A helper method that creates a stream by subscribing to the Observable returned by the param observableProducer callback.

    Ideally the callback function creates an Observable by applying Observable.pipe.

    Just know that you should catch the error in a sub-pipe (ie: do not let it propagate to the main-pipe), otherwise as usual the stream will stop working, and will not react on any further emissions.

    Type parameters

    • R

    Parameters

    Returns Stream

replay

  • replay(): boolean

toJsonString

  • toJsonString(): string

Common Action/Units Methods

dispatch

  • Method to dispatch new value by passing the value directly, or
    by passing a value-producer-function that produces the value using the current value.

    Given a value, it either gets dispatched if it's allowed by wouldDispatch,
    or it gets ignored if not allowed.

    If the Unit is not configured to be immutable, then
    the value-producer-function (param valueOrProducer) should not mutate the current value,
    which is provided as an argument to the function.

    If you mutate the value, then the cached-value might also get mutated,
    as the cached-value is saved by reference, which can result in unpredictable state.

    triggers

    EventUnitDispatch, or EventUnitDispatchFail, depending on the success of dispatch.

    Parameters

    Returns boolean | undefined

    true if value got dispatched, otherwise false. If UnitConfig.dispatchDebounce is enabled, then it'll return undefined.

  • Method to dispatch new value by passing the value directly, or
    by passing a value-producer-function that produces the value using the current value.

    Given a value, it either gets dispatched if it's allowed by wouldDispatch,
    or it gets ignored if not allowed.

    If the Unit is not configured to be immutable, then
    the value-producer-function (param valueOrProducer) should not mutate the current value,
    which is provided as an argument to the function.

    If you mutate the value, then the cached-value might also get mutated,
    as the cached-value is saved by reference, which can result in unpredictable state.

    triggers

    EventUnitDispatch, or EventUnitDispatchFail, depending on the success of dispatch.

    Parameters

    Returns boolean | undefined

    true if value got dispatched, otherwise false. If UnitConfig.dispatchDebounce is enabled, then it'll return undefined.

Common List/Dict/Generic Units Methods

objectEntries

  • objectEntries(): [string, T[K]][]

objectKeys

  • objectKeys(): string[]

objectValues

  • objectValues(): T[K][]

select

  • select<K1>(k1: K1): Selection<Item[][K1], this>
  • select<K1, K2>(k1: K1, k2: K2): Selection<Item[][K1][K2], this>
  • select<K1, K2, K3>(k1: K1, k2: K2, k3: K3): Selection<Item[][K1][K2][K3], this>
  • select<K1, K2, K3, K4>(k1: K1, k2: K2, k3: K3, k4: K4): Selection<Item[][K1][K2][K3][K4], this>
  • select<K1, K2, K3, K4, K5>(k1: K1, k2: K2, k3: K3, k4: K4, k5: K5): Selection<Item[][K1][K2][K3][K4][K5], this>
  • select<K1, K2, K3, K4, K5>(k1: K1, k2: K2, k3: K3, k4: K4, k5: K5, ...path: (string | number)[]): Selection<any, this>
  • Select a nested property at a certain path in the Unit's value. It doesn't fail even if a value in middle of the path is undefined.

    It can be used to create an Observable to listen to changes in a nested property using Selection.asObservable method.

    It provides static value access through the Selection.value method. It can be helpful when the Unit is configured to be immutable, as you only clone the nested property instead of the whole value.

    example
    // create a Unit
    const unit = new DictUnit();
    
    // create a selection
    const selection = unit.select('a', 'b', 0);
    // create an Observable
    const selection$ = selection.asObservable();
    // subscribe to the selector
    selection.subscribe(value => console.log(value)) // logs undefined immediately
    
    // dispatch a value
    unit.dispatch({a: {b: ['hi', 'there']}});
    // 'hi' will get logged to the console
    
    // update a value on a different path
    unit.set('c', 'other');
    // the selector won't be triggered by this

    Type parameters

    • K1: KOf<Item[]>

    Parameters

    • k1: K1

    Returns Selection<Item[][K1], this>

    A Selection object of the selected property or path.

  • Select a nested property at a certain path in the Unit's value. It doesn't fail even if a value in middle of the path is undefined.

    It can be used to create an Observable to listen to changes in a nested property using Selection.asObservable method.

    It provides static value access through the Selection.value method. It can be helpful when the Unit is configured to be immutable, as you only clone the nested property instead of the whole value.

    example
    // create a Unit
    const unit = new DictUnit();
    
    // create a selection
    const selection = unit.select('a', 'b', 0);
    // create an Observable
    const selection$ = selection.asObservable();
    // subscribe to the selector
    selection.subscribe(value => console.log(value)) // logs undefined immediately
    
    // dispatch a value
    unit.dispatch({a: {b: ['hi', 'there']}});
    // 'hi' will get logged to the console
    
    // update a value on a different path
    unit.set('c', 'other');
    // the selector won't be triggered by this

    Type parameters

    • K1: KOf<Item[]>

    • K2: KOf<Item[][K1]>

    Parameters

    • k1: K1
    • k2: K2

    Returns Selection<Item[][K1][K2], this>

    A Selection object of the selected property or path.

  • Select a nested property at a certain path in the Unit's value. It doesn't fail even if a value in middle of the path is undefined.

    It can be used to create an Observable to listen to changes in a nested property using Selection.asObservable method.

    It provides static value access through the Selection.value method. It can be helpful when the Unit is configured to be immutable, as you only clone the nested property instead of the whole value.

    example
    // create a Unit
    const unit = new DictUnit();
    
    // create a selection
    const selection = unit.select('a', 'b', 0);
    // create an Observable
    const selection$ = selection.asObservable();
    // subscribe to the selector
    selection.subscribe(value => console.log(value)) // logs undefined immediately
    
    // dispatch a value
    unit.dispatch({a: {b: ['hi', 'there']}});
    // 'hi' will get logged to the console
    
    // update a value on a different path
    unit.set('c', 'other');
    // the selector won't be triggered by this

    Type parameters

    • K1: KOf<Item[]>

    • K2: KOf<Item[][K1]>

    • K3: KOf<Item[][K1][K2]>

    Parameters

    • k1: K1
    • k2: K2
    • k3: K3

    Returns Selection<Item[][K1][K2][K3], this>

    A Selection object of the selected property or path.

  • Select a nested property at a certain path in the Unit's value. It doesn't fail even if a value in middle of the path is undefined.

    It can be used to create an Observable to listen to changes in a nested property using Selection.asObservable method.

    It provides static value access through the Selection.value method. It can be helpful when the Unit is configured to be immutable, as you only clone the nested property instead of the whole value.

    example
    // create a Unit
    const unit = new DictUnit();
    
    // create a selection
    const selection = unit.select('a', 'b', 0);
    // create an Observable
    const selection$ = selection.asObservable();
    // subscribe to the selector
    selection.subscribe(value => console.log(value)) // logs undefined immediately
    
    // dispatch a value
    unit.dispatch({a: {b: ['hi', 'there']}});
    // 'hi' will get logged to the console
    
    // update a value on a different path
    unit.set('c', 'other');
    // the selector won't be triggered by this

    Type parameters

    • K1: KOf<Item[]>

    • K2: KOf<Item[][K1]>

    • K3: KOf<Item[][K1][K2]>

    • K4: keyof Item[][K1][K2][K3]

    Parameters

    • k1: K1
    • k2: K2
    • k3: K3
    • k4: K4

    Returns Selection<Item[][K1][K2][K3][K4], this>

    A Selection object of the selected property or path.

  • Select a nested property at a certain path in the Unit's value. It doesn't fail even if a value in middle of the path is undefined.

    It can be used to create an Observable to listen to changes in a nested property using Selection.asObservable method.

    It provides static value access through the Selection.value method. It can be helpful when the Unit is configured to be immutable, as you only clone the nested property instead of the whole value.

    example
    // create a Unit
    const unit = new DictUnit();
    
    // create a selection
    const selection = unit.select('a', 'b', 0);
    // create an Observable
    const selection$ = selection.asObservable();
    // subscribe to the selector
    selection.subscribe(value => console.log(value)) // logs undefined immediately
    
    // dispatch a value
    unit.dispatch({a: {b: ['hi', 'there']}});
    // 'hi' will get logged to the console
    
    // update a value on a different path
    unit.set('c', 'other');
    // the selector won't be triggered by this

    Type parameters

    • K1: KOf<Item[]>

    • K2: KOf<Item[][K1]>

    • K3: KOf<Item[][K1][K2]>

    • K4: keyof Item[][K1][K2][K3]

    • K5: keyof Item[][K1][K2][K3][K4]

    Parameters

    • k1: K1
    • k2: K2
    • k3: K3
    • k4: K4
    • k5: K5

    Returns Selection<Item[][K1][K2][K3][K4][K5], this>

    A Selection object of the selected property or path.

  • Select a nested property at a certain path in the Unit's value. It doesn't fail even if a value in middle of the path is undefined.

    It can be used to create an Observable to listen to changes in a nested property using Selection.asObservable method.

    It provides static value access through the Selection.value method. It can be helpful when the Unit is configured to be immutable, as you only clone the nested property instead of the whole value.

    example
    // create a Unit
    const unit = new DictUnit();
    
    // create a selection
    const selection = unit.select('a', 'b', 0);
    // create an Observable
    const selection$ = selection.asObservable();
    // subscribe to the selector
    selection.subscribe(value => console.log(value)) // logs undefined immediately
    
    // dispatch a value
    unit.dispatch({a: {b: ['hi', 'there']}});
    // 'hi' will get logged to the console
    
    // update a value on a different path
    unit.set('c', 'other');
    // the selector won't be triggered by this

    Type parameters

    • K1: KOf<Item[]>

    • K2: KOf<Item[][K1]>

    • K3: KOf<Item[][K1][K2]>

    • K4: keyof Item[][K1][K2][K3]

    • K5: keyof Item[][K1][K2][K3][K4]

    Parameters

    • k1: K1
    • k2: K2
    • k3: K3
    • k4: K4
    • k5: K5
    • Rest ...path: (string | number)[]

    Returns Selection<any, this>

    A Selection object of the selected property or path.

Common Units Methods

clear

clearCache

  • Clears the cached values, current value stays intact, but it gets removed from the cache.
    Meaning, if you dispatch a new value you can't goBack.
    To keep the last value in the cache, pass {leaveLast: true} in the param options.

    It only works if the Unit is not frozen and there's something left to clear after evaluating the param options.

    Similar to preserving the last value, you can preserve the first value by passing {leaveFirst: true}. Or preserve both first and last value by passing both options together.

    triggers

    EventUnitClearCache

    Parameters

    Returns boolean

    true if the cache was cleared, otherwise false

clearPersistedValue

  • clearPersistedValue(): boolean

clearValue

  • clearValue(): boolean

freeze

  • freeze(): void

getCachedValue

  • getCachedValue(index: number): Item[] | undefined

mute

  • mute(): void
  • Mute the Unit, to stop emitting values as well as events, so that the subscribers are not triggered.
    All other functionalities stay unaffected. ie: cache it still updated, value is still updated.

    Note: If you subscribe to the default Observable while the Unit is muted,
    it will replay the last value emitted before muting the Unit,
    because new values are not being emitted.

    Returns void

reset

resetValue

  • resetValue(): boolean

unfreeze

  • unfreeze(): void

unmute

  • unmute(): void
  • Unmute the Unit, to resume emitting values, and events.
    If a value was dispatched while the Unit was muted, the most recent value immediately gets emitted,
    so that subscribers can be in sync again.
    However, other events$ are lost, and they will only emit on the next event.

    It only works if the Unit is muted.
    Moreover, it works even if the Unit is frozen,
    but no value will be emitted because no values would have been dispatched while the Unit was frozen.

    triggers

    EventUnitUnmute

    Returns void

wouldDispatch

  • wouldDispatch(value: Item[], force?: boolean): boolean
  • Extends UnitBase.wouldDispatch and adds additional check for type array {@see {@link Array.isArray}},
    which cannot be bypassed even by using {@link force}.

    Parameters

    • value: Item[]

      The value to be dispatched.

    • Optional force: boolean

      Whether dispatch-checks should be bypassed or not.

    Returns boolean

    A boolean indicating whether the param value would pass the dispatch-checks if dispatched.

Custom ListUnit Methods

delete

  • delete(...indices: number[]): Item[]
  • Deletes items at given indices in the list-value.
    Dispatches a new copy of the value, without mutating the current-value.
    It doesn't modify the length of the list as these indices are only deleted, not removed.

    It only works if the Unit is not frozen, and the list is not empty, and at least 1 valid-numeric index is provided.

    triggers

    EventListUnitDelete

    Parameters

    • Rest ...indices: number[]

      The indices of the items to be deleted.
      A negative index is normalized as following: \

      • If the index is less than negative of list-length it's treated as 0.
      • Otherwise, it's subtracted from the list-length. eg: If list length is 5, negative index -5 will be normalized to 0,
        negative index -6 will be normalized to 0, and so on.

    Returns Item[]

    The removed items or an empty array.

deleteIf

  • deleteIf(predicate: (item: Item, index: number) => boolean): Item[]
  • Deletes items from the list-value where the predicate returns true.
    Dispatches a new copy of the value, without mutating the current-value.
    It doesn't modify the length of the list as these indices are only deleted, not removed.

    It only works if the Unit is not frozen, and the predicate is a function, and the list is not empty.

    triggers

    EventListUnitDelete

    Parameters

    • predicate: (item: Item, index: number) => boolean

      A callback function that gets called for every item in the list with the item and index as arguments.

        • (item: Item, index: number): boolean
        • Parameters

          • item: Item
          • index: number

          Returns boolean

    Returns Item[]

    The removed items or an empty array.

findByProp

  • findByProp<k>(key: k, value: string | number | boolean, strictEquality?: boolean): [number, Item][]
  • Finds items of the list that have a direct child property that matches with key and value passed as params.

    example
    const initialValue = [{b: 1}, {b: 1, b2: 2}, {c: 1}, {b: null}];
    const list = new ListUnit({initialValue});
    const itemsFound = list.findByProp('b', 1);
    console.log(itemsFound); // logs [[0, {b: 1}], [1, {b: 1, b2: 2}]]

    Type parameters

    • k: KOf<Item>

    Parameters

    • key: k

      The key of the property whose value needs to be matched against param value.

    • value: string | number | boolean

      A value that will be matched against every item's prop-value using equality operator.

    • Default value strictEquality: boolean = true

      A flag governing whether the value be matched using === or == operator. Default is true, ie: strict equality ===. Pass false to use == instead.

    Returns [number, Item][]

    An array of key/values of the matched properties, an empty array otherwise.

first

  • first(): Item | undefined

get

  • get(index: number): Item | undefined
  • Returns the item at the given index in the list-value.
    Negative index returns items from the end of the list.

    Parameters

    • index: number

      The index of the item.
      A negative index is normalized as following: \

      • If the index is less than negative of list-length it's treated as 0.
      • Otherwise, it's subtracted from the list-length. eg: If list length is 5, negative index -5 will be normalized to 0,
        negative index -6 will be normalized to 0, and so on.

    Returns Item | undefined

    The item at the given index.

insert

  • insert(start: number, ...items: Item[]): number
  • Inserts items to the list-value.
    Dispatches a new copy of the value, without mutating the current-value.

    It only works if the Unit is not frozen and there's at least 1 item to be inserted.

    triggers

    EventListUnitSplice

    Parameters

    • start: number

      The zero-based index in the list from which to start adding items.
      A negative index is normalized as following: \

      • If the index is less than negative of list-length it's treated as 0.
      • Otherwise, it's subtracted from the list-length. eg: If list length is 5, negative index -5 will be normalized to 0,
        negative index -6 will be normalized to 0, and so on.
    • Rest ...items: Item[]

      The items to be insert.

    Returns number

    The new length of the list.

jsonJoin

  • jsonJoin(separator?: string): string
  • Adds all the items of the list separated by the specified separator string, and all the items are converted into string first using JSON.stringify

    Parameters

    • Optional separator: string

      A string used to separate one item of the list from the next in the resulting String. If omitted, the list items are separated with a comma.

    Returns string

    Concatenated JSON.stringifyd list items.

last

  • last(): Item | undefined

remove

  • remove(...indices: number[]): Item[]
  • Removes items at given indices from the list-value.
    Dispatches a new copy of the value, without mutating the current-value.
    It modifies the length of the list as these indices are not deleted, rather removed using Array.prototype.splice.

    It only works if the Unit is not frozen, and the list is not empty, and at least 1 valid-numeric index is provided.

    Notes:

    • The indices are removed in descending order.
    • The indices are deduplicated.
    • Negative indices are normalized before starting the removal.
      A negative index is normalized as following: \
    • If the index is less than negative of list-length, it's treated as 0.
    • Otherwise, it's subtracted from the list-length. eg: If list length is 5, negative index -5 will be normalized to 0,
      negative index -6 will be normalized to 0, and so on.
    triggers

    EventListUnitRemove

    Parameters

    • Rest ...indices: number[]

      The indices of the items to be removed.

    Returns Item[]

    The removed items or an empty array.

removeIf

  • removeIf(predicate: (item: Item, index: number) => boolean): Item[]
  • Removes items from the list-value where the predicate returns truthy value.
    Dispatches a new copy of the value, without mutating the current-value.
    It modifies the length of the list as these indices are not deleted, rather removed using Array.prototype.splice.

    It only works if the Unit is not frozen, and the predicate is a function, and the list is not empty.
    It uses remove internally, for actual removal.

    triggers

    EventListUnitRemove

    Parameters

    • predicate: (item: Item, index: number) => boolean

      A callback function that gets called for every item in the list with the item and index as arguments.

        • (item: Item, index: number): boolean
        • Parameters

          • item: Item
          • index: number

          Returns boolean

    Returns Item[]

    The removed items or an empty array.

set

  • set(index: number, item: Item): void
  • Sets the item on the given index in the list-value.
    Dispatches a new copy of the value, without mutating the current-value.

    It only works if the Unit is not frozen, and the index is valid-numeric.

    triggers

    EventListUnitSet

    Parameters

    • index: number

      The index of the item.
      A negative index is normalized as following: \

      • If the index is less than negative of list-length it's treated as 0.
      • Otherwise, it's subtracted from the list-length. eg: If list length is 5, negative index -5 will be normalized to 0,
        negative index -6 will be normalized to 0, and so on.
    • item: Item

      The item.

    Returns void

Customised Array.prototype Methods

copyWithin

  • copyWithin(target: number, start: number, end?: number): this
  • Returns the this object after copying a section of the array identified by start and end to the same array starting at position target

    It only works if the Unit is not frozen, and the list is not empty isEmpty.

    Parameters

    • target: number

      If target is negative, it is treated as length+target where length is the length of the list.

    • start: number

      If start is negative, it is treated as length+start. If end is negative, it is treated as length+end.

    • Optional end: number

      If end is not specified, length of the list is used as its default value.

    Returns this

    Nothing, unlike Array.prototype.copyWithin

fill

  • fill(value: Item, start?: number, end?: number): this
  • Returns the this object after filling the section identified by start and end with value

    It only works if the Unit is not frozen, and the list is not empty isEmpty.

    Parameters

    • value: Item

      value to fill array section with

    • Optional start: number

      The index to start filling the list at. If start is negative, it is treated as length+start where length is the length of the list.

    • Optional end: number

      The index to stop filling the list at. If end is negative, it is treated as length+end.

    Returns this

    Nothing, unlike Array.prototype.fill

forEvery

  • forEvery(callbackFn: (item: Item, index: number, array: Item[]) => void, thisArg?: any): void
  • Performs the specified action for each item in the list-value.
    It's a drop-in replacement for the Array.prototype.forEach method.

    Parameters

    • callbackFn: (item: Item, index: number, array: Item[]) => void

      A function that accepts up to three arguments. forEvery calls the callbackFn function one time for each element in the list.

        • (item: Item, index: number, array: Item[]): void
        • Parameters

          • item: Item
          • index: number
          • array: Item[]

          Returns void

    • Optional thisArg: any

      An object to which this keyword can refer in the callbackFn function. If thisArg is omitted, undefined is used as this value.

    Returns void

pop

  • pop(): Item | undefined
  • Removes the last element from an array and returns it.

    It only works if the Unit is not frozen, and the list is not empty isEmpty.

    triggers

    EventListUnitPop

    Returns Item | undefined

    The popped item.

push

  • push(...items: Item[]): number
  • Appends new elements to an array, and returns the new length of the array.

    It only works if the Unit is not frozen, and at least 1 item is provided.

    Parameters

    • Rest ...items: Item[]

      The items to be appended to the list.

    Returns number

    The new length of the list.

reverse

  • reverse(): Item[]
  • Reverses the elements in an Array.

    It only works if the Unit is not frozen, and the list is not empty isEmpty.

    triggers

    EventListUnitReverse

    Returns Item[]

    Nothing, unlike Array.prototype.reverse

shift

  • shift(): Item | undefined
  • Removes the first element from an array and returns it.

    It only works if the Unit is not frozen, and the list is not empty isEmpty.

    triggers

    EventListUnitShift

    Returns Item | undefined

    The shifted item.

slice

  • slice(start?: number, end?: number): Item[]
  • Returns a section of an array.

    Parameters

    • Optional start: number

      The beginning of the specified portion of the list.

    • Optional end: number

      The end of the specified portion of the list.

    Returns Item[]

    A section of the list.

sort

  • sort(compareFn?: (a: Item, b: Item) => number): this
  • Sorts an array.

    It only works if the Unit is not frozen, and the list is not empty isEmpty.

    Parameters

    • Optional compareFn: (a: Item, b: Item) => number

      The name of the function used to determine the order of the items. If omitted, the items are sorted in ascending, ASCII character order.

        • (a: Item, b: Item): number
        • Parameters

          • a: Item
          • b: Item

          Returns number

    Returns this

    Nothing, unlike Array.prototype.sort

splice

  • splice(start: number, deleteCount?: number): Item[]
  • splice(start: number, deleteCount: number, ...items: Item[]): Item[]
  • Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements.

    It only works if the Unit is not frozen, and
    either deleteCount is not 0 (loose comparison) and the list is not empty isEmpty, or
    there's at least 1 item to be added.

    Parameters

    • start: number

      The zero-based location in the list from which to start removing items.

    • Optional deleteCount: number

      The number of items to remove.

    Returns Item[]

    The deleted Items or an empty array.

  • Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements.

    It only works if the Unit is not frozen, and
    either deleteCount is not 0 (loose comparison) and the list is not empty isEmpty, or
    there's at least 1 item to be added.

    Parameters

    • start: number

      The zero-based location in the list from which to start removing items.

    • deleteCount: number

      The number of items to remove.

    • Rest ...items: Item[]

      Items to insert into the list in place of the deleted items.

    Returns Item[]

    The deleted Items or an empty array.

unshift

  • unshift(...items: Item[]): number
  • Inserts new elements at the start of an array.

    It only works if the Unit is not frozen, and at least 1 item is provided.

    Parameters

    • Rest ...items: Item[]

      The items to be insert at the start of the list

    Returns number

    The new length of the list.

Other Methods

[Symbol.iterator]

  • [Symbol.iterator](): IterableIterator<Item>
  • Iterator

    Returns IterableIterator<Item>

[Symbol.unscopables]

  • [Symbol.unscopables](): { copyWithin: boolean; entries: boolean; fill: boolean; find: boolean; findIndex: boolean; keys: boolean; values: boolean }
  • Returns an object whose properties have the value 'true' when they will be absent when used in a 'with' statement.

    Returns { copyWithin: boolean; entries: boolean; fill: boolean; find: boolean; findIndex: boolean; keys: boolean; values: boolean }

    • copyWithin: boolean
    • entries: boolean
    • fill: boolean
    • find: boolean
    • findIndex: boolean
    • keys: boolean
    • values: boolean

concat

  • concat(...items: ConcatArray<Item>[]): Item[]
  • concat(...items: (Item | ConcatArray<Item>)[]): Item[]
  • Combines two or more arrays.

    Parameters

    • Rest ...items: ConcatArray<Item>[]

      Additional items to add to the end of array1.

    Returns Item[]

  • Combines two or more arrays.

    Parameters

    • Rest ...items: (Item | ConcatArray<Item>)[]

      Additional items to add to the end of array1.

    Returns Item[]

entries

  • entries(): IterableIterator<[number, Item]>
  • Returns an iterable of key, value pairs for every entry in the array

    Returns IterableIterator<[number, Item]>

every

  • every<S>(predicate: (value: Item, index: number, array: Item[]) => value is S, thisArg?: any): this is S[]
  • every(predicate: (value: Item, index: number, array: Item[]) => unknown, thisArg?: any): boolean
  • Determines whether all the members of an array satisfy the specified test.

    Type parameters

    • S: Item

    Parameters

    • predicate: (value: Item, index: number, array: Item[]) => value is S

      A function that accepts up to three arguments. The every method calls the predicate function for each element in the array until the predicate returns a value which is coercible to the Boolean value false, or until the end of the array.

        • (value: Item, index: number, array: Item[]): value is S
        • Parameters

          • value: Item
          • index: number
          • array: Item[]

          Returns value is S

    • Optional thisArg: any

      An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value.

    Returns this is S[]

  • Determines whether all the members of an array satisfy the specified test.

    Parameters

    • predicate: (value: Item, index: number, array: Item[]) => unknown

      A function that accepts up to three arguments. The every method calls the predicate function for each element in the array until the predicate returns a value which is coercible to the Boolean value false, or until the end of the array.

        • (value: Item, index: number, array: Item[]): unknown
        • Parameters

          • value: Item
          • index: number
          • array: Item[]

          Returns unknown

    • Optional thisArg: any

      An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value.

    Returns boolean

filter

  • filter<S>(predicate: (value: Item, index: number, array: Item[]) => value is S, thisArg?: any): S[]
  • filter(predicate: (value: Item, index: number, array: Item[]) => unknown, thisArg?: any): Item[]
  • Returns the elements of an array that meet the condition specified in a callback function.

    Type parameters

    • S: Item

    Parameters

    • predicate: (value: Item, index: number, array: Item[]) => value is S

      A function that accepts up to three arguments. The filter method calls the predicate function one time for each element in the array.

        • (value: Item, index: number, array: Item[]): value is S
        • Parameters

          • value: Item
          • index: number
          • array: Item[]

          Returns value is S

    • Optional thisArg: any

      An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value.

    Returns S[]

  • Returns the elements of an array that meet the condition specified in a callback function.

    Parameters

    • predicate: (value: Item, index: number, array: Item[]) => unknown

      A function that accepts up to three arguments. The filter method calls the predicate function one time for each element in the array.

        • (value: Item, index: number, array: Item[]): unknown
        • Parameters

          • value: Item
          • index: number
          • array: Item[]

          Returns unknown

    • Optional thisArg: any

      An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value.

    Returns Item[]

find

  • find<S>(predicate: (this: void, value: Item, index: number, obj: Item[]) => value is S, thisArg?: any): S | undefined
  • find(predicate: (value: Item, index: number, obj: Item[]) => unknown, thisArg?: any): Item | undefined
  • Returns the value of the first element in the array where predicate is true, and undefined otherwise.

    Type parameters

    • S: Item

    Parameters

    • predicate: (this: void, value: Item, index: number, obj: Item[]) => value is S

      find calls predicate once for each element of the array, in ascending order, until it finds one where predicate returns true. If such an element is found, find immediately returns that element value. Otherwise, find returns undefined.

        • (this: void, value: Item, index: number, obj: Item[]): value is S
        • Parameters

          • this: void
          • value: Item
          • index: number
          • obj: Item[]

          Returns value is S

    • Optional thisArg: any

      If provided, it will be used as the this value for each invocation of predicate. If it is not provided, undefined is used instead.

    Returns S | undefined

  • Parameters

    • predicate: (value: Item, index: number, obj: Item[]) => unknown
        • (value: Item, index: number, obj: Item[]): unknown
        • Parameters

          • value: Item
          • index: number
          • obj: Item[]

          Returns unknown

    • Optional thisArg: any

    Returns Item | undefined

findIndex

  • findIndex(predicate: (value: Item, index: number, obj: Item[]) => unknown, thisArg?: any): number
  • Returns the index of the first element in the array where predicate is true, and -1 otherwise.

    Parameters

    • predicate: (value: Item, index: number, obj: Item[]) => unknown

      find calls predicate once for each element of the array, in ascending order, until it finds one where predicate returns true. If such an element is found, findIndex immediately returns that element index. Otherwise, findIndex returns -1.

        • (value: Item, index: number, obj: Item[]): unknown
        • Parameters

          • value: Item
          • index: number
          • obj: Item[]

          Returns unknown

    • Optional thisArg: any

      If provided, it will be used as the this value for each invocation of predicate. If it is not provided, undefined is used instead.

    Returns number

flat

  • flat<A, D>(this: A, depth?: D): FlatArray<A, D>[]
  • Returns a new array with all sub-array elements concatenated into it recursively up to the specified depth.

    Type parameters

    • A

    • D: number

    Parameters

    • this: A
    • Optional depth: D

      The maximum recursion depth

    Returns FlatArray<A, D>[]

flatMap

  • flatMap<U, This>(callback: (this: This, value: Item, index: number, array: Item[]) => U | ReadonlyArray<U>, thisArg?: This): U[]
  • Calls a defined callback function on each element of an array. Then, flattens the result into a new array. This is identical to a map followed by flat with depth 1.

    Type parameters

    • U

    • This

    Parameters

    • callback: (this: This, value: Item, index: number, array: Item[]) => U | ReadonlyArray<U>

      A function that accepts up to three arguments. The flatMap method calls the callback function one time for each element in the array.

        • (this: This, value: Item, index: number, array: Item[]): U | ReadonlyArray<U>
        • Parameters

          • this: This
          • value: Item
          • index: number
          • array: Item[]

          Returns U | ReadonlyArray<U>

    • Optional thisArg: This

      An object to which the this keyword can refer in the callback function. If thisArg is omitted, undefined is used as the this value.

    Returns U[]

forEach

  • forEach(callbackfn: (value: Item, index: number, array: Item[]) => void, thisArg?: any): void
  • Performs the specified action for each element in an array.

    Parameters

    • callbackfn: (value: Item, index: number, array: Item[]) => void

      A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array.

        • (value: Item, index: number, array: Item[]): void
        • Parameters

          • value: Item
          • index: number
          • array: Item[]

          Returns void

    • Optional thisArg: any

      An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.

    Returns void

includes

  • includes(searchElement: Item, fromIndex?: number): boolean
  • Determines whether an array includes a certain element, returning true or false as appropriate.

    Parameters

    • searchElement: Item

      The element to search for.

    • Optional fromIndex: number

      The position in this array at which to begin searching for searchElement.

    Returns boolean

indexOf

  • indexOf(searchElement: Item, fromIndex?: number): number
  • Returns the index of the first occurrence of a value in an array.

    Parameters

    • searchElement: Item

      The value to locate in the array.

    • Optional fromIndex: number

      The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0.

    Returns number

join

  • join(separator?: string): string
  • Adds all the elements of an array separated by the specified separator string.

    Parameters

    • Optional separator: string

      A string used to separate one element of an array from the next in the resulting String. If omitted, the array elements are separated with a comma.

    Returns string

keys

  • keys(): IterableIterator<number>
  • Returns an iterable of keys in the array

    Returns IterableIterator<number>

lastIndexOf

  • lastIndexOf(searchElement: Item, fromIndex?: number): number
  • Returns the index of the last occurrence of a specified value in an array.

    Parameters

    • searchElement: Item

      The value to locate in the array.

    • Optional fromIndex: number

      The array index at which to begin the search. If fromIndex is omitted, the search starts at the last index in the array.

    Returns number

map

  • map<U>(callbackfn: (value: Item, index: number, array: Item[]) => U, thisArg?: any): U[]
  • Calls a defined callback function on each element of an array, and returns an array that contains the results.

    Type parameters

    • U

    Parameters

    • callbackfn: (value: Item, index: number, array: Item[]) => U

      A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array.

        • (value: Item, index: number, array: Item[]): U
        • Parameters

          • value: Item
          • index: number
          • array: Item[]

          Returns U

    • Optional thisArg: any

      An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.

    Returns U[]

pipe

  • pipe(): Observable<Item[]>
  • pipe<A>(op1: OperatorFunction<Item[], A>): Observable<A>
  • pipe<A, B>(op1: OperatorFunction<Item[], A>, op2: OperatorFunction<A, B>): Observable<B>
  • pipe<A, B, C>(op1: OperatorFunction<Item[], A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>): Observable<C>
  • pipe<A, B, C, D>(op1: OperatorFunction<Item[], A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>, op4: OperatorFunction<C, D>): Observable<D>
  • pipe<A, B, C, D, E>(op1: OperatorFunction<Item[], A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>, op4: OperatorFunction<C, D>, op5: OperatorFunction<D, E>): Observable<E>
  • pipe<A, B, C, D, E, F>(op1: OperatorFunction<Item[], A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>, op4: OperatorFunction<C, D>, op5: OperatorFunction<D, E>, op6: OperatorFunction<E, F>): Observable<F>
  • pipe<A, B, C, D, E, F, G>(op1: OperatorFunction<Item[], A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>, op4: OperatorFunction<C, D>, op5: OperatorFunction<D, E>, op6: OperatorFunction<E, F>, op7: OperatorFunction<F, G>): Observable<G>
  • pipe<A, B, C, D, E, F, G, H>(op1: OperatorFunction<Item[], A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>, op4: OperatorFunction<C, D>, op5: OperatorFunction<D, E>, op6: OperatorFunction<E, F>, op7: OperatorFunction<F, G>, op8: OperatorFunction<G, H>): Observable<H>
  • pipe<A, B, C, D, E, F, G, H, I>(op1: OperatorFunction<Item[], A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>, op4: OperatorFunction<C, D>, op5: OperatorFunction<D, E>, op6: OperatorFunction<E, F>, op7: OperatorFunction<F, G>, op8: OperatorFunction<G, H>, op9: OperatorFunction<H, I>): Observable<I>
  • pipe<A, B, C, D, E, F, G, H, I>(op1: OperatorFunction<Item[], A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>, op4: OperatorFunction<C, D>, op5: OperatorFunction<D, E>, op6: OperatorFunction<E, F>, op7: OperatorFunction<F, G>, op8: OperatorFunction<G, H>, op9: OperatorFunction<H, I>, ...operations: OperatorFunction<any, any>[]): Observable<{}>
  • Returns Observable<Item[]>

  • Type parameters

    • A

    Parameters

    • op1: OperatorFunction<Item[], A>

    Returns Observable<A>

  • Type parameters

    • A

    • B

    Parameters

    • op1: OperatorFunction<Item[], A>
    • op2: OperatorFunction<A, B>

    Returns Observable<B>

  • Type parameters

    • A

    • B

    • C

    Parameters

    • op1: OperatorFunction<Item[], A>
    • op2: OperatorFunction<A, B>
    • op3: OperatorFunction<B, C>

    Returns Observable<C>

  • Type parameters

    • A

    • B

    • C

    • D

    Parameters

    • op1: OperatorFunction<Item[], A>
    • op2: OperatorFunction<A, B>
    • op3: OperatorFunction<B, C>
    • op4: OperatorFunction<C, D>

    Returns Observable<D>

  • Type parameters

    • A

    • B

    • C

    • D

    • E

    Parameters

    • op1: OperatorFunction<Item[], A>
    • op2: OperatorFunction<A, B>
    • op3: OperatorFunction<B, C>
    • op4: OperatorFunction<C, D>
    • op5: OperatorFunction<D, E>

    Returns Observable<E>

  • Type parameters

    • A

    • B

    • C

    • D

    • E

    • F

    Parameters

    • op1: OperatorFunction<Item[], A>
    • op2: OperatorFunction<A, B>
    • op3: OperatorFunction<B, C>
    • op4: OperatorFunction<C, D>
    • op5: OperatorFunction<D, E>
    • op6: OperatorFunction<E, F>

    Returns Observable<F>

  • Type parameters

    • A

    • B

    • C

    • D

    • E

    • F

    • G

    Parameters

    • op1: OperatorFunction<Item[], A>
    • op2: OperatorFunction<A, B>
    • op3: OperatorFunction<B, C>
    • op4: OperatorFunction<C, D>
    • op5: OperatorFunction<D, E>
    • op6: OperatorFunction<E, F>
    • op7: OperatorFunction<F, G>

    Returns Observable<G>

  • Type parameters

    • A

    • B

    • C

    • D

    • E

    • F

    • G

    • H

    Parameters

    • op1: OperatorFunction<Item[], A>
    • op2: OperatorFunction<A, B>
    • op3: OperatorFunction<B, C>
    • op4: OperatorFunction<C, D>
    • op5: OperatorFunction<D, E>
    • op6: OperatorFunction<E, F>
    • op7: OperatorFunction<F, G>
    • op8: OperatorFunction<G, H>

    Returns Observable<H>

  • Type parameters

    • A

    • B

    • C

    • D

    • E

    • F

    • G

    • H

    • I

    Parameters

    • op1: OperatorFunction<Item[], A>
    • op2: OperatorFunction<A, B>
    • op3: OperatorFunction<B, C>
    • op4: OperatorFunction<C, D>
    • op5: OperatorFunction<D, E>
    • op6: OperatorFunction<E, F>
    • op7: OperatorFunction<F, G>
    • op8: OperatorFunction<G, H>
    • op9: OperatorFunction<H, I>

    Returns Observable<I>

  • Type parameters

    • A

    • B

    • C

    • D

    • E

    • F

    • G

    • H

    • I

    Parameters

    • op1: OperatorFunction<Item[], A>
    • op2: OperatorFunction<A, B>
    • op3: OperatorFunction<B, C>
    • op4: OperatorFunction<C, D>
    • op5: OperatorFunction<D, E>
    • op6: OperatorFunction<E, F>
    • op7: OperatorFunction<F, G>
    • op8: OperatorFunction<G, H>
    • op9: OperatorFunction<H, I>
    • Rest ...operations: OperatorFunction<any, any>[]

    Returns Observable<{}>

reduce

  • reduce(callbackfn: (previousValue: Item, currentValue: Item, currentIndex: number, array: Item[]) => Item): Item
  • reduce(callbackfn: (previousValue: Item, currentValue: Item, currentIndex: number, array: Item[]) => Item, initialValue: Item): Item
  • reduce<U>(callbackfn: (previousValue: U, currentValue: Item, currentIndex: number, array: Item[]) => U, initialValue: U): U
  • Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.

    Parameters

    • callbackfn: (previousValue: Item, currentValue: Item, currentIndex: number, array: Item[]) => Item

      A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array.

        • (previousValue: Item, currentValue: Item, currentIndex: number, array: Item[]): Item
        • Parameters

          • previousValue: Item
          • currentValue: Item
          • currentIndex: number
          • array: Item[]

          Returns Item

    Returns Item

  • Parameters

    • callbackfn: (previousValue: Item, currentValue: Item, currentIndex: number, array: Item[]) => Item
        • (previousValue: Item, currentValue: Item, currentIndex: number, array: Item[]): Item
        • Parameters

          • previousValue: Item
          • currentValue: Item
          • currentIndex: number
          • array: Item[]

          Returns Item

    • initialValue: Item

    Returns Item

  • Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.

    Type parameters

    • U

    Parameters

    • callbackfn: (previousValue: U, currentValue: Item, currentIndex: number, array: Item[]) => U

      A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array.

        • (previousValue: U, currentValue: Item, currentIndex: number, array: Item[]): U
        • Parameters

          • previousValue: U
          • currentValue: Item
          • currentIndex: number
          • array: Item[]

          Returns U

    • initialValue: U

      If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.

    Returns U

reduceRight

  • reduceRight(callbackfn: (previousValue: Item, currentValue: Item, currentIndex: number, array: Item[]) => Item): Item
  • reduceRight(callbackfn: (previousValue: Item, currentValue: Item, currentIndex: number, array: Item[]) => Item, initialValue: Item): Item
  • reduceRight<U>(callbackfn: (previousValue: U, currentValue: Item, currentIndex: number, array: Item[]) => U, initialValue: U): U
  • Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.

    Parameters

    • callbackfn: (previousValue: Item, currentValue: Item, currentIndex: number, array: Item[]) => Item

      A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array.

        • (previousValue: Item, currentValue: Item, currentIndex: number, array: Item[]): Item
        • Parameters

          • previousValue: Item
          • currentValue: Item
          • currentIndex: number
          • array: Item[]

          Returns Item

    Returns Item

  • Parameters

    • callbackfn: (previousValue: Item, currentValue: Item, currentIndex: number, array: Item[]) => Item
        • (previousValue: Item, currentValue: Item, currentIndex: number, array: Item[]): Item
        • Parameters

          • previousValue: Item
          • currentValue: Item
          • currentIndex: number
          • array: Item[]

          Returns Item

    • initialValue: Item

    Returns Item

  • Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.

    Type parameters

    • U

    Parameters

    • callbackfn: (previousValue: U, currentValue: Item, currentIndex: number, array: Item[]) => U

      A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array.

        • (previousValue: U, currentValue: Item, currentIndex: number, array: Item[]): U
        • Parameters

          • previousValue: U
          • currentValue: Item
          • currentIndex: number
          • array: Item[]

          Returns U

    • initialValue: U

      If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.

    Returns U

some

  • some(predicate: (value: Item, index: number, array: Item[]) => unknown, thisArg?: any): boolean
  • Determines whether the specified callback function returns true for any element of an array.

    Parameters

    • predicate: (value: Item, index: number, array: Item[]) => unknown

      A function that accepts up to three arguments. The some method calls the predicate function for each element in the array until the predicate returns a value which is coercible to the Boolean value true, or until the end of the array.

        • (value: Item, index: number, array: Item[]): unknown
        • Parameters

          • value: Item
          • index: number
          • array: Item[]

          Returns unknown

    • Optional thisArg: any

      An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value.

    Returns boolean

subscribe

  • subscribe(observer?: PartialObserver<Item[]>): Subscription
  • subscribe(next: null | undefined, error: null | undefined, complete: () => void): Subscription
  • subscribe(next: null | undefined, error: (error: any) => void, complete?: () => void): Subscription
  • subscribe(next: (value: Item[]) => void, error: null | undefined, complete: () => void): Subscription
  • subscribe(next?: (value: Item[]) => void, error?: (error: any) => void, complete?: () => void): Subscription
  • Parameters

    • Optional observer: PartialObserver<Item[]>

    Returns Subscription

  • deprecated

    Use an observer instead of a complete callback

    Parameters

    • next: null | undefined
    • error: null | undefined
    • complete: () => void
        • (): void
        • Returns void

    Returns Subscription

  • deprecated

    Use an observer instead of an error callback

    Parameters

    • next: null | undefined
    • error: (error: any) => void
        • (error: any): void
        • Parameters

          • error: any

          Returns void

    • Optional complete: () => void
        • (): void
        • Returns void

    Returns Subscription

  • deprecated

    Use an observer instead of a complete callback

    Parameters

    • next: (value: Item[]) => void
        • (value: Item[]): void
        • Parameters

          • value: Item[]

          Returns void

    • error: null | undefined
    • complete: () => void
        • (): void
        • Returns void

    Returns Subscription

  • Parameters

    • Optional next: (value: Item[]) => void
        • (value: Item[]): void
        • Parameters

          • value: Item[]

          Returns void

    • Optional error: (error: any) => void
        • (error: any): void
        • Parameters

          • error: any

          Returns void

    • Optional complete: () => void
        • (): void
        • Returns void

    Returns Subscription

toLocaleString

  • toLocaleString(): string
  • Returns a string representation of an array. The elements are converted to string using their toLocalString methods.

    Returns string

toPromise

  • toPromise<T>(this: Observable<T>): Promise<T>
  • toPromise<T>(this: Observable<T>, PromiseCtor: typeof Promise): Promise<T>
  • toPromise<T>(this: Observable<T>, PromiseCtor: PromiseConstructorLike): Promise<T>
  • Type parameters

    • T

    Parameters

    • this: Observable<T>

    Returns Promise<T>

  • Type parameters

    • T

    Parameters

    • this: Observable<T>
    • PromiseCtor: typeof Promise

    Returns Promise<T>

  • Type parameters

    • T

    Parameters

    • this: Observable<T>
    • PromiseCtor: PromiseConstructorLike

    Returns Promise<T>

toString

  • toString(): string
  • Returns a string representation of an array.

    Returns string

values

  • values(): IterableIterator<Item>
  • Returns an iterable of values in the array

    Returns IterableIterator<Item>