checkIfTokenFitsSubRegion function

Map checkIfTokenFitsSubRegion(
  1. dynamic subRegion,
  2. dynamic token,
  3. dynamic options
)

Implementation

Map checkIfTokenFitsSubRegion(subRegion, token, options) {
  Map getSubR = getSubRegionType(subRegion, token);
  var type = getSubR['type'];
  bool isHundred = getSubR['isHundred'];

  if (!subRegion) {
    return {'action': START_NEW_REGION, 'type': type, 'isHundred': isHundred};
  }
  if (canAddTokenToEndOfSubRegion(subRegion, token, impliedHundreds: options)) {
    return {'action': ADD, 'type': type, 'isHundred': isHundred};
  }
  return {'action': START_NEW_REGION, 'type': type, 'isHundred': isHundred};
}