Class IDMap

Hierarchy

  • DMap<string, string>
    • IDMap

Constructors

  • The DMap<K, V>() class encapsulates any object and provides utility method.

    Parameters

    • content: Record<string, string> | Record<string, string>[] | [string, string][]

    Returns IDMap

Properties

content: Record<string, string>

Methods

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

    Parameters

    • matcher: ((k: string, v: string) => boolean)

      Matching function matches records' under provided condition.

        • (k: string, v: string): boolean
        • Parameters

          • k: string
          • v: string

          Returns boolean

    Returns DMap<string, string>

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

    Parameters

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

      Matching function matches records' value under provided condition.

        • (v: string): boolean
        • Parameters

          • v: string

          Returns boolean

    Returns string[]

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

    Parameters

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

      Matching function matches records' value under provided condition.

        • (v: string): boolean
        • Parameters

          • v: string

          Returns boolean

    Returns string[]

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

    Parameters

    • key: string

      Provided key.

    Returns undefined | string

  • The getRecord() method gives the Record of the DMap.

    Returns Record<string, string>

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

    Type Parameters

    • G extends string

    Parameters

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

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

        • (v: string): G
        • Parameters

          • v: string

          Returns G

    Returns DMap<G, Record<string, string>[]>

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

    Parameters

    • c: string

      Key that being searched.

    Returns boolean

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

    Parameters

    • c: string

      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: string

      Provided value.

    Returns void

  • The iterable() method formats record to its iterable form.

    Returns [string, string][]

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

    Parameters

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

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

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

          • key: string
          • value: string
          • index: number
          • obj: Record<string, string>

          Returns Promise<void>

    Returns Promise<void>

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

    Parameters

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

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

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

          • key: string
          • value: string
          • index: number
          • obj: Record<string, string>

          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 string[]

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

    Parameters

    • comparable: string[]

      Provided keys array.

    Returns string[]

  • 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: string, value: string, index: number, obj: Record<string, string>) => R)

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

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

          • key: string
          • value: string
          • index: number
          • obj: Record<string, string>

          Returns R

    Returns R[]

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

    Parameters

    • key: string

      Provided key.

    • value: string

      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: [string, string], b: [string, string]) => 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: [string, string], b: [string, string]): number
        • Parameters

          • a: [string, string]
          • b: [string, string]

          Returns number

    Returns DMap<string, string>

  • Private

    The swapKeyVal() method swaps between the object key and value.

    Parameters

    • obj: Record<string, string>

      Object that will be swapped.

    Returns any

Generated using TypeDoc