-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
rubiin
merged 7 commits into
validatorjs:master
from
xDivisionByZerox:feat/is-iso-15924
Mar 16, 2025
Merged
feat: isISO15924 #2215
Changes from 3 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
7bfcd07
feat: isISO15924
xDivisionByZerox 5e5fc1e
test: isISO15924
xDivisionByZerox 4f98b32
docs: add isISO15924 to README
xDivisionByZerox d2ce9cd
refactor(isISO15924): update data sources
xDivisionByZerox f26c454
refactor(isISO15924): update data source reference
xDivisionByZerox 97af61b
Merge remote-tracking branch 'origin/master' into feat/is-iso-15924
xDivisionByZerox deb7c40
chore: fix linting
xDivisionByZerox File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| import assertString from './util/assertString'; | ||
|
|
||
| // from https://en.wikipedia.org/wiki/ISO_15924 | ||
| const validISO15924Codes = new Set([ | ||
| 'Adlm', 'Afak', 'Aghb', 'Ahom', 'Arab', 'Aran', 'Armi', 'Armn', 'Avst', | ||
| 'Bali', 'Bamu', 'Bass', 'Batk', 'Beng', 'Bhks', 'Blis', 'Bopo', 'Brah', 'Brai', 'Bugi', 'Buhd', | ||
| 'Cakm', 'Cans', 'Cari', 'Cham', 'Cher', 'Chrs', 'Cirt', 'Copt', 'Cpmn', 'Cprt', 'Cyrl', 'Cyrs', | ||
| 'Deva', 'Diak', 'Dogr', 'Dsrt', 'Dupl', | ||
| 'Egyd', 'Egyh', 'Egyp', 'Elba', 'Elym', 'Ethi', | ||
| 'Geok', 'Geor', 'Glag', 'Gong', 'Gonm', 'Goth', 'Gran', 'Grek', 'Gujr', 'Guru', | ||
| 'Hanb', 'Hang', 'Hani', 'Hano', 'Hans', 'Hant', 'Hatr', 'Hebr', 'Hira', 'Hluw', 'Hmng', 'Hmnp', 'Hrkt', 'Hung', | ||
| 'Inds', 'Ital', | ||
| 'Jamo', 'Java', 'Jpan', 'Jurc', | ||
| 'Kali', 'Kana', 'Kawi', 'Khar', 'Khmr', 'Khoj', 'Kitl', 'Kits', 'Knda', 'Kore', 'Kpel', 'Kthi', | ||
| 'Lana', 'Laoo', 'Latf', 'Latg', 'Latn', 'Leke', 'Lepc', 'Limb', 'Lina', 'Linb', 'Lisu', 'Loma', 'Lyci', 'Lydi', | ||
| 'Mahj', 'Maka', 'Mand', 'Mani', 'Marc', 'Maya', 'Medf', 'Mend', 'Merc', 'Mero', 'Mlym', 'Modi', 'Mong', 'Moon', 'Mroo', 'Mtei', 'Mult', 'Mymr', | ||
| 'Nagm', 'Nand', 'Narb', 'Nbat', 'Newa', 'Nkdb', 'Nkgb', 'Nkoo', 'Nshu', | ||
| 'Ogam', 'Olck', 'Orkh', 'Orya', 'Osge', 'Osma', 'Ougr', | ||
| 'Palm', 'Pauc', 'Pcun', 'Pelm', 'Perm', 'Phag', 'Phli', 'Phlp', 'Phlv', 'Phnx', 'Piqd', 'Plrd', 'Prti', 'Psin', | ||
| 'Qaaa', 'Qaab', 'Qaac', 'Qaad', 'Qaae', 'Qaaf', 'Qaag', 'Qaah', 'Qaai', 'Qaaj', 'Qaak', 'Qaal', 'Qaam', 'Qaan', 'Qaao', 'Qaap', 'Qaaq', 'Qaar', 'Qaas', 'Qaat', 'Qaau', 'Qaav', 'Qaaw', 'Qaax', 'Qaay', 'Qaaz', 'Qaba', 'Qabb', 'Qabc', 'Qabd', 'Qabe', 'Qabf', 'Qabg', 'Qabh', 'Qabi', 'Qabj', 'Qabk', 'Qabl', 'Qabm', 'Qabn', 'Qabo', 'Qabp', 'Qabq', 'Qabr', 'Qabs', 'Qabt', 'Qabu', 'Qabv', 'Qabw', 'Qabx', | ||
| 'Ranj', 'Rjng', 'Rohg', 'Roro', 'Runr', | ||
| 'Samr', 'Sara', 'Sarb', 'Saur', 'Sgnw', 'Shaw', 'Shrd', 'Shui', 'Sidd', 'Sind', 'Sinh', 'Sogd', 'Sogo', 'Sora', 'Soyo', 'Sund', 'Sunu', 'Sylo', 'Syrc', 'Syre', 'Syrj', 'Syrn', | ||
| 'Tagb', 'Takr', 'Tale', 'Talu', 'Taml', 'Tang', 'Tavt', 'Telu', 'Teng', 'Tfng', 'Tglg', 'Thaa', 'Thai', 'Tibt', 'Tirh', 'Tnsa', 'Toto', | ||
| 'Ugar', | ||
| 'Vaii', 'Visp', 'Vith', | ||
| 'Wara', 'Wcho', 'Wole', | ||
| 'Xpeo', 'Xsux', | ||
| 'Yezi', 'Yiii', | ||
| 'Zanb', 'Zinh', 'Zmth', 'Zsym', 'Zsye', 'Zxxx', 'Zyyy', 'Zzzz', | ||
| ]); | ||
|
|
||
| export default function isISO15924(str) { | ||
| assertString(str); | ||
| return validISO15924Codes.has(str); | ||
| } | ||
|
|
||
| export const ScriptCodes = validISO15924Codes; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
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 😅