resolveFeature static method

Map<String, String> resolveFeature({
  1. required String rawFeatureName,
})

Resolves feature name variants.

Implementation

static Map<String, String> resolveFeature({
  required String rawFeatureName,
}) {
  final trimmed = rawFeatureName.trim();
  if (trimmed.isEmpty) {
    throw const ValidationException('Feature name cannot be empty.');
  }

  final words = _extractWords(trimmed);
  if (words.isEmpty) {
    throw ValidationException('Invalid feature name: "$rawFeatureName"');
  }

  final snakeCase = words.map((w) => w.toLowerCase()).join('_');
  final pascalCase = words.map((w) => _capitalize(w)).join('');
  final camelCase = words.first.toLowerCase() +
      words.sublist(1).map((w) => _capitalize(w)).join('');

  return {
    'feature_name': trimmed,
    'feature_name_snake_case': snakeCase,
    'feature_name_pascal_case': pascalCase,
    'feature_name_camel_case': camelCase,
  };
}