This PR improves the validation that was only done on the img_path property. I've started to see PRs with wrong slugs, that's why I had the idea to validate them: they must be lowercase, with only alphanumeric characters and em dashes (no underscore or uppercase letter).
I also added validation for the left/right choice's titles, so that the text is always perfectly centered.
It also fixes some typos and inconsistencies.
Tests
[x] The isSlugValid() function can self-test itself against known invalid and valid examples. The test is run when the function is exported.
What this PR is about?
This PR improves the validation that was only done on the
img_path
property. I've started to see PRs with wrong slugs, that's why I had the idea to validate them: they must be lowercase, with only alphanumeric characters and em dashes (no underscore or uppercase letter).I also added validation for the left/right choice's titles, so that the text is always perfectly centered.
It also fixes some typos and inconsistencies.
Tests
isSlugValid()
function can self-test itself against known invalid and valid examples. The test is run when the function is exported.Clean Code