• Preserves the given data attribute as the given view attribute. Thus, it provides a mapper for toView renaming attribute given by dataAttributeName to attribute named viewAttributeName.

    If a data attribute has alias names, you may specify them in dataAttributeAliases. Note, that the first existing attributes value in [dataAttributeName, ...dataAttributeAliases] will be taken into account. All other attributes will be lost in this processing.

    Parameters

    • dataAttributeName: string

      the name of the attribute in data

    • viewAttributeName: string

      the name of the attribute in data view

    • Rest ...dataAttributeAliases: string[]

      aliases for the attribute in data, which shall be mapped to the same data view attribute

    Returns AttributeMapper

    Example: **Simple Use Case:** Mapper to store data attribute `xlink:type` in view as `data-xlink-type`:

    mapper = preserveAttributeAs("xlink:type", "data-xlink-type");
    

    Example: **Extended Use Case:** Mapper to store data attribute `lang` with alias `xml:lang` in view as `lang`:

    mapper = preserveAttributeAs("lang", "lang", "xml:lang");