toMap method

Map<String, dynamic> toMap()

Converts the Parser instance to a Map.

This method is used for serializing the parser configuration to JSON or other map-based formats.

Returns:

  • Map containing all parser configuration data

Implementation

Map<String, dynamic> toMap() {
  return {
    'id': id,
    'parent': parents,
    'type': type.toString().split('.').last,
    'selectors': selectors,
    'isPrivate': isPrivate,
    'multiple': multiple,
    'parserOptions': parserOptions?.toMap(),
    'transformationOptions': transformationOptions?.toMap(),
    'cleanerName': cleanerName,

    /// Note: cleaner function is serialized via cleanerName reference
  };
}