BaseSerializer

BaseSerializer

Base support for serializers that escape/unescape pieces as part of their serialization key. Provides esc() and unesc*() helpers for building and parsing keys that embed other pieces. Subclasses must implement all five Serializer methods.

Constructor

new BaseSerializer()

Source:

Methods

esc(piece) → {string}

Description:
  • Escape a piece reference for embedding inside another key. Replaces "|" with "^" so the nested key does not break pipe-splitting.

Source:
Parameters:
Name Type Description
piece Piece
Returns:
Type
string

unesc(key)

Source:
Parameters:
Name Type Description
key string

@returns {Piece}

unescItem(key)

Source:
Parameters:
Name Type Description
key string

@returns {Item}

unescTerrain(key) → {Terrain}

Description:
  • Unescape a terrain reference embedded in a key arg. The Registry has already resolved "^"-escaped args into Piece instances before calling create(), so this helper is provided only for cases where manual resolution is needed outside of create().

Source:
Parameters:
Name Type Description
key string

escaped key (carets instead of pipes)

Returns:
Type
Terrain