Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: simplify isUenValid logic #2156

Merged
merged 2 commits into from
Jun 15, 2021
Merged

Conversation

mantariksh
Copy link
Contributor

Simplifies the logic to validate UENs. Implementation can be cross-referenced against the docs.

Manual tests as per #2100.

@mantariksh mantariksh requested review from karrui and tshuli June 14, 2021 08:50
@yong-jie
Copy link
Member

watch out!

// Length 9
isUenValid('1       A') // true
isUenValid('        A') // true
isUenValid('   1    A') // true

// Length 10
isUenValid('   1+1   A') // true
isUenValid(' 0.1+0.1 A') // true
isUenValid('1       1A') // true
isUenValid('-1      1A') // true

@mantariksh
Copy link
Contributor Author

@yong-jie thanks for the catch! fixed in 7c66b8b by using regex matching instead

Copy link
Contributor

@karrui karrui left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@mantariksh mantariksh merged commit 8f0eda6 into develop Jun 15, 2021
mantariksh added a commit that referenced this pull request Jun 15, 2021
mantariksh added a commit that referenced this pull request Jun 15, 2021
* Revert "refactor: simplify isUenValid logic (#2156)"

This reverts commit 8f0eda6.

* Revert "feat: add UEN field (#2100)"

This reverts commit 35eeeaf.

* Revert "feat: add and call v3 API for retrieving individual admin form (#2113)"

This reverts commit e55e1a9.

* Revert "chore: remove redundant ValidationOption object properties for short text, long text and number fields (#2040)"

This reverts commit 95b6297.

* Revert "feat: Add webhook support for storage mode attachments (#1713)"

This reverts commit 332d3ce.
@mantariksh mantariksh deleted the refactor/uen-validation branch June 15, 2021 06:00
mantariksh added a commit that referenced this pull request Jun 17, 2021
* refactor: simplify isUenValid logic

* fix: use stricter regex matching
@mantariksh mantariksh mentioned this pull request Jun 17, 2021
2 tasks
mantariksh added a commit that referenced this pull request Jun 17, 2021
* feat: add UEN field (#2100)

* add uen field in public frontend

* add essential uen types

* make sure uen field renders

* replace isUenValid with isUenField

* refactor: simplify isUenValid logic (#2156)

* refactor: simplify isUenValid logic

* fix: use stricter regex matching

Co-authored-by: Aniruddha Adhikary (Ani) <aniruddha@adhikary.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants