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

feat: isISO15924 #2215

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

xDivisionByZerox
Copy link

@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).

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.

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
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
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
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
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
3 participants