Skip to content

feat: isISO15924 #2215

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

Merged
merged 7 commits into from
Mar 16, 2025
Merged

feat: isISO15924 #2215

merged 7 commits into from
Mar 16, 2025

Conversation

xDivisionByZerox
Copy link
Contributor

@xDivisionByZerox xDivisionByZerox commented Apr 11, 2023

Description

This PR adds the validator isISO15924 to validate for correct ISO-15924 script codes.

Additional Information

Closes #2214.

Checklist

  • PR contains only changes related; no stray files, etc.
  • README updated (where applicable)
  • Tests written (where applicable)
  • References provided in PR (where applicable)

@codecov
Copy link

codecov bot commented Apr 11, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.95%. Comparing base (b958bd7) to head (deb7c40).
Report is 67 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #2215   +/-   ##
=======================================
  Coverage   99.95%   99.95%           
=======================================
  Files         107      108    +1     
  Lines        2454     2456    +2     
  Branches      619      620    +1     
=======================================
+ Hits         2453     2455    +2     
  Partials        1        1           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Member

@WikiRik WikiRik left a comment

Choose a reason for hiding this comment

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

Thanks for opening up this PR! Overall it looks good. I wrote down one small suggestion.

Also; I did also notice new codes were added in the meantime. Could you add them as well?

@@ -0,0 +1,37 @@
import assertString from './util/assertString';

// from https://en.wikipedia.org/wiki/ISO_15924
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
// from https://en.wikipedia.org/wiki/ISO_15924
// from https://www.unicode.org/iso15924/iso15924-codes.html

Personally I prefer linking to the more official links instead of Wikipedia. It's fine in the README where more context is useful, but for the actual code this is better for me.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure thing. I'm completly with you here. I think I was a bit lazy when I created this PR 😅

@xDivisionByZerox
Copy link
Contributor Author

Also; I did also notice new codes were added in the meantime. Could you add them as well?

I added the missing codes. The dataset is up to date now.

Copy link
Member

@WikiRik WikiRik left a comment

Choose a reason for hiding this comment

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

Thanks!

Copy link
Member

@profnandaa profnandaa left a comment

Choose a reason for hiding this comment

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

Thanks for your contrib.

However, I'm trying to understand this feature. What would be an example of real-world usage?

@xDivisionByZerox
Copy link
Contributor Author

xDivisionByZerox commented Mar 5, 2024

At FakerJS we would use this, to verify that our locale metadata have a valid "script" property (defined by ISO-15924) applied to them.

https://github.com/faker-js/faker/blob/489bbc243f3094464888bdf7fb90835fcfa57691/test/locale-imports.spec.ts#L46-L61

Hope this applies for "real-world usage".

@WikiRik WikiRik requested a review from profnandaa May 7, 2024 20:24
@xDivisionByZerox
Copy link
Contributor Author

I don't want to be pushy, but could I get an update if this PR is considered to be merged into the lib? 😅

@rubiin rubiin merged commit a41c8de into validatorjs:master Mar 16, 2025
@xDivisionByZerox xDivisionByZerox deleted the feat/is-iso-15924 branch March 16, 2025 14:29
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.

Add ISO-15924 validation
4 participants