maquette
    Preparing search index...

    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.

      • 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).

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

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

      Returns Mapping<Source, Target>