Class ModelCollection<T>

Type Parameters

Hierarchy

Constructors

Properties

length: number = 0

The length of the collection.

Methods

  • Protected

    Accepts ModelCollection, array of models, numbers and strings in array format. All other values are discarded. Returns a collection of ids in a string format.

    Parameters

    • values: any

    Returns Collection<string>

  • Protected

    Throw error if not every item is a Model.

    Parameters

    • Optional iterable: any

    Returns void

  • See

    Array.prototype.every

    Type Parameters

    Parameters

    • predicate: ((value, index, array) => value is S)
        • (value, index, array): value is S
        • Parameters

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

          Returns value is S

    • Optional thisArg: any

    Returns this is S[]

  • Parameters

    • predicate: ((value, index, array) => unknown)
        • (value, index, array): unknown
        • Parameters

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

          Returns unknown

    • Optional thisArg: any

    Returns boolean

  • See

    Array.prototype.find

    Parameters

    • predicate: ((value, index, obj) => unknown)
        • (value, index, obj): unknown
        • Parameters

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

          Returns unknown

    • Optional thisArg: any

    Returns undefined | T

  • See

    Array.prototype.findIndex

    Parameters

    • predicate: ((value, index, obj) => unknown)
        • (value, index, obj): unknown
        • Parameters

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

          Returns unknown

    • Optional thisArg: any

    Returns number

  • Return the first element in the collection, if callback given the first element that passes the truth test. Otherwise, undefined.

    Parameters

    • Optional callback: ((item, index) => boolean)
        • (item, index): boolean
        • Parameters

          • item: T
          • index: number

          Returns boolean

    Returns undefined | T

  • See

    Array.prototype.flatMap

    Type Parameters

    • U

    • This = undefined

    Parameters

    • callback: ((this, value, index, array) => U | readonly U[])
        • (this, value, index, array): U | readonly U[]
        • Parameters

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

          Returns U | readonly U[]

    • Optional thisArg: This

    Returns Collection<U>

  • See

    Array.prototype.join

    Parameters

    • Optional key: string | ((item) => any)
    • separator: undefined | string | ((item) => any) = key

    Returns string

  • Return the last element in the collection, if callback given the last element that passes the truth test. Otherwise, undefined.

    Parameters

    • Optional callback: ((item, index) => boolean)
        • (item, index): boolean
        • Parameters

          • item: T
          • index: number

          Returns boolean

    Returns undefined | T

  • See

    Array.prototype.reduce

    Parameters

    • callback: ((previousValue, currentValue, currentIndex, array) => T)
        • (previousValue, currentValue, currentIndex, array): T
        • Parameters

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

          Returns T

    • Optional initialValue: T

    Returns T

  • See

    Array.prototype.reduceRight

    Parameters

    • callback: ((previousValue, currentValue, currentIndex, array) => T)
        • (previousValue, currentValue, currentIndex, array): T
        • Parameters

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

          Returns T

    • Optional initialValue: T

    Returns T

  • See

    Array.prototype.some

    Parameters

    • predicate: ((value, index, array) => unknown)
        • (value, index, array): unknown
        • Parameters

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

          Returns unknown

    • Optional thisArg: any

    Returns boolean

  • Protected

    Check whether the given argument is (probably) model or not.

    Type Parameters

    Parameters

    • arg: any

    Returns arg is M

  • Protected

    Determine if the given array is a Model array.

    Type Parameters

    Parameters

    • array: any

    Returns array is M[]

Generated using TypeDoc