MapStore2 icon indicating copy to clipboard operation
MapStore2 copied to clipboard

Refactor and simplify the format validator utility logic

Open DavGoeck opened this issue 11 months ago • 1 comments

Description

When working with MapStore2 in a client project I discovered that the format validator logic is more complicated than necessary. I simplified the code in various tiny-sliced commits for clarity that can be squashed when pulled.

This is Code Style Update and Refactoring (except that the API of the validators was changed, but it was only used in the tests).

Please check if the PR fulfills these requirements

  • [x] The commit message follows our guidelines: https://github.com/geosolutions-it/MapStore2/blob/master/CONTRIBUTING.md
  • [ ] Tests for the changes have been added (for bug fixes / features)
  • [ ] Docs have been added / updated (for bug fixes / features)

What kind of change does this PR introduce? (check one with "x", remove the others)

  • [ ] Bugfix
  • [ ] Feature
  • [x] Code style update (formatting, local variables)
  • [x] Refactoring (no functional changes, no api changes)
  • [ ] Build related changes
  • [ ] CI related changes
  • [ ] Other... Please describe:

Breaking change

Does this PR introduce a breaking change? (check one with "x", remove the other)

  • [ ] Yes, and I documented them in migration notes
  • [x] No

Other useful information

I am submitting this Pull Request as an external developer on behalf of DB Systel GmbH.

I found various other code segments where the build-in JS Array method "reduce(method, aggregator)" was used in a way that .filter(predicate) would have sufficed, making it more difficult than necessary to read. This was the starting point for this PR. Is there a specific reason why this is used? Do you wish more refactorings of this sort?

Kind regards!

DavGoeck avatar Mar 07 '24 09:03 DavGoeck