Skip to content

fix snakecase special case when acronym is pluralized

Administrator requested to merge nsc/snakecase-ids-fix into main

Created by: Strum355

Fixes error where e.g. uploadIDsWithReferences -> upload_i_ds_with_references. We special case cases of Is e.g. HTTPIsEnabled -> http_is_enabled.

The check (!isLastCapital || next != 's') in English says: "given the current letter is a capital letter:"

  • if the prev letter wasnt a capital letter, add _ (e.g. testEnabled)
  • else if the prev letter was a capital letter and the next one isnt an s (in the case of HTTPRe and not in the case of IDs), also add _ so that HTTPRe -> http_re

Merge request reports

Loading