compiler function

dynamic compiler(
  1. List regions,
  2. String text
)

Implementation

dynamic compiler(List regions, String text) {
  if (regions.isEmpty) return text;
  if (regions[0]['end'] - regions[0]['start'] == text.length - 1) {
    return getNumber(regions[0]);
  }
  return replaceRegionInText(regions, text);
}