Class ClubRecord<T, V>

The ClubRecord<T extends SystemClubIDType | MainClubIDType>() class encapsulate any object with DataType value and provides utility method.

Type Parameters

Hierarchy

  • DMap<T, V>
    • ClubRecord

Constructors

Properties

content: Record<T, V>

Methods

  • The filter() method filters records' key, value, which the matching function returned true.

    Parameters

    • matcher: ((k: T, v: V) => boolean)

      Matching function matches records' under provided condition.

        • (k: T, v: V): boolean
        • Parameters

          • k: T
          • v: V

          Returns boolean

    Returns DMap<T, V>

  • The findKeys() method finds records' key, which the matching function returned true.

    Parameters

    • matcher: ((v: V) => boolean)

      Matching function matches records' value under provided condition.

        • (v: V): boolean
        • Parameters

          • v: V

          Returns boolean

    Returns T[]

  • The findValues() method finds records' value, which the matching function returned true.

    Parameters

    • matcher: ((v: V) => boolean)

      Matching function matches records' value under provided condition.

        • (v: V): boolean
        • Parameters

          • v: V

          Returns boolean

    Returns V[]

  • The get() method accesses the value of the given key.

    Parameters

    • key: T

      Provided key.

    Returns undefined | V

  • The groupBy() method groups records by located values using keyLocator.

    Type Parameters

    • G extends string

    Parameters

    • keyLocator: ((v: V) => G)

      Key locator function finds the value that will be an object key.

        • (v: V): G
        • Parameters

          • v: V

          Returns G

    Returns DMap<G, Record<T, V>[]>

  • The hasKey() method checks if the record contained a given key.

    Parameters

    • c: T

      Key that being searched.

    Returns boolean

  • The hasValue() method checks if the record contained a given value.

    Parameters

    • c: V

      Value that being searched.

    Returns boolean

  • The insert() method insert new value to the map and assign temporary uuid. For the document-based database, an inserted key-value will be created after changes are pushed to the server.

    Parameters

    • value: V

      Provided value.

    Returns void

  • The iterate() method iterates through record's key and value.

    Parameters

    • c: ((key: T, value: V, index: number, obj: Record<T, V>) => Promise<void>)

      Function that is called for every element of arr. Each time callbackFn executes.

        • (key: T, value: V, index: number, obj: Record<T, V>): Promise<void>
        • Parameters

          • key: T
          • value: V
          • index: number
          • obj: Record<T, V>

          Returns Promise<void>

    Returns Promise<void>

  • The iterateSync() method synchronously iterates through record's key and value.

    Parameters

    • c: ((key: T, value: V, index: number, obj: Record<T, V>) => void)

      Function that is called for every element of arr. Each time callbackFn executes.

        • (key: T, value: V, index: number, obj: Record<T, V>): void
        • Parameters

          • key: T
          • value: V
          • index: number
          • obj: Record<T, V>

          Returns void

    Returns void

  • The keyDiff() method finds records' key, which different from elements in the given array.

    Parameters

    • comparable: string[]

      Provided keys array.

    Returns T[]

  • The keyMatch() method finds records' key, which matched with elements in the given array.

    Parameters

    • comparable: string[]

      Provided keys array.

    Returns T[]

  • The map() method creates a new array populated with the results of calling a provided function on every element in the calling array.

    Type Parameters

    • R

    Parameters

    • c: ((key: T, value: V, index: number, obj: Record<T, V>) => R)

      Function that is called for every element of arr. Each time callbackFn executes, the returned value is added to newArray.

        • (key: T, value: V, index: number, obj: Record<T, V>): R
        • Parameters

          • key: T
          • value: V
          • index: number
          • obj: Record<T, V>

          Returns R

    Returns R[]

  • Parameters

    • mergeFunc: ((prevValue: V, newValue: V) => V) = ...
        • (prevValue: V, newValue: V): V
        • Parameters

          • prevValue: V
          • newValue: V

          Returns V

    Returns ClubRecord<string, V>

  • The set() method set new key to the map.

    Parameters

    • key: T

      Provided key.

    • value: V

      Provided value.

    Returns void

  • The sort() method sorts the elements of an array in place and returns the sorted array. The default sort order is ascending, built upon converting the elements into strings, then comparing their sequences of UTF-16 code units values.

    Parameters

    • c: ((a: [T, V], b: [T, V]) => number)

      Specifies a function that defines the sort order. If omitted, the array elements are converted to strings, then sorted according to each character's Unicode code point value.

        • (a: [T, V], b: [T, V]): number
        • Parameters

          • a: [T, V]
          • b: [T, V]

          Returns number

    Returns DMap<T, V>

  • The transformToMainClubs() method transforms ClubRecord with SystemClubID indexes to new ClubRecord with MainClubID indexes by merging its properties using mergeFunc.

    Parameters

    • mergeFunc: ((prevValue: V, newValue: V) => V) = ...

      Merge function controls how an existed object will be merged. Look defaultMergeFunc for example.

        • (prevValue: V, newValue: V): V
        • Parameters

          • prevValue: V
          • newValue: V

          Returns V

    Returns ClubRecord<string, V>

Generated using TypeDoc