tsevdos/elUtils

ValidationUtils: add validateLisencePlate function

Opened this issue · 1 comments

Add validateLisencePlate function to validationUtils.ts module.

I was thinking about normalizing all the license plate data in an object of its own so we can avoid the filtering upon filtering in all administrative regions which can cause performance issues. We could add other data as well that might be leveraged in future utils(e.g. returning the region/unit if a license plate is valid).

Normalized data could look something like this. The pattern field will have the same values as carPlatesPattern array.

{
  "PM": {
    "key": "PM",
    "pattern": "PM*",
    "region": 1,
    "unitId": 1
  },
  "TO": {
    "key": "TO",
    "pattern": "TO*",
    "regionId": 1,
    "unitId": 1
  },
  "EB": { 
    "key": "EB",
    "pattern": "EB*",
    "regionId": 1,
    "unitId": 2
  }
}

We can transfer this to a discussion for further details about specific implementation.