Skip to main content

Map

In order to map an iterable to a list of scalar- or component values which can then be, say, passed to another tag via attribute-binding, this built-in tag supports doing so through special notation. Similar to some intrinsic attributes like Code-Blocks are only available within the browser and Code-Blocks are only available within the browser, the map tag specifies the binding-name of the resulting list after the dash in it's tag-name, i.e. Code-Blocks are only available within the browser; said variable is then introduced into the scope of the tag.

Other than that, one simply needs to specify an Code-Blocks are only available within the browser and a so-called Code-Blocks are only available within the browser, which is being evaluated at each iteration, with the current item being introduced as Code-Blocks are only available within the browser, including a Code-Blocks are only available within the browser-variable analogous to that of the Code-Blocks are only available within the browser intrinsic attribute.

The mapper-attribute may either be an expression to become a scalar value or markup to become a rendered, platform-native component.

Examples

Word-Wrapping Dynamic Counts

Let there be a map containing an arbitrary number of named counts - fruit in this case, but one could easily imagine them being Minecraft item-types instead. Now, these are to be displayed in an item's lore, which by itself does not wrap text.

Each entry is first formatted as desired by the mapper, such that we can then pass the list of formatted entry-strings to the Code-Blocks are only available within the browser-tag, using the spread-operator. Last but not least, tokens are highlighted based on a regex.

Code-Blocks are only available within the browser

Alternatively, one can also build the whole string at once using plain-text markup, which is arguably the more direct approach to this issue (the solution above is but an example to show off the functionality of the map-tag; there may be other cases where one absolutely requires items to be mapped individually, though).

Code-Blocks are only available within the browser