Function createMapping

  • Creates a Mapping instance that keeps an array of result objects synchronized with an array of source objects. See Working with arrays.

    Type Parameters

    • Source

      The type of source items. A database-record for instance.

    • Target

      The type of target items. A [[MaquetteComponent]] for instance.

    Parameters

    • getSourceKey: ((source: Source) => string | number)

      function(source) that must return a key to identify each source object. The result must either be a string or a number.

        • (source: Source): string | number
        • Parameters

          • source: Source

          Returns string | number

    • createResult: ((source: Source, index: number) => Target)

      function(source, index) that must create a new result object from a given source. This function is identical to the callback argument in Array.map(callback).

        • (source: Source, index: number): Target
        • Parameters

          • source: Source
          • index: number

          Returns Target

    • updateResult: ((source: Source, target: Target, index: number) => void)

      function(source, target, index) that updates a result to an updated source.

        • (source: Source, target: Target, index: number): void
        • Parameters

          • source: Source
          • target: Target
          • index: number

          Returns void

    Returns Mapping<Source, Target>

Generated using TypeDoc