1.0.1 • Published 4 years ago

@konfirm/iso15924 v1.0.1

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

ISO15924:2004 - Codes for the representation of names of scripts

The ISO 15924:2004 standard specifies all of the 252 script codes. The codes are maintained by The Unicode Consortium, who also publishes the full list of codes.

Installation

ISO15924 is a scoped package, the scope needs to be provided for both the installation and usage.

$ npm install --save @konfirm/iso15924

Usage

The ISO15924 package exports a factory function, this function is used to obtain instances of the ISO15924 class.

const iso15924 = require('@konfirm/iso15924');
const latn = iso15924('Latn');

latn.code; // 'Latn'
latn.numeric; // '215'

The exported factory function in turn also has several added members for convenience

ISO15924

The ISO15924 class used to create the specified value objects.

Creating instances directly is useful to reduce the footprint of any dependent implementation, but skips lookups for the numeric code. Use this if there is a need for a full custom code (where the range Qaaa..Qabx inteded for private use does not suffice) or in case codes have been added and this module is not on par (in which case PR's are welcome).

const { ISO15924 } = require('@konfirm/iso15924');
const latn = new ISO15924('Latn');

latn.code; // 'Latn'
latn.numeric; // undefined

const cyrl = new ISO15924('Cyrl', '220');

cyrl.code; // 'Cyrl'
cyrl.numeric; // '220'

code(string code)

The same as the main exported factory function.

const { code } = require('@konfirm/iso15924');
const cyrl = code('Cyrl');

cyrl.code; // 'Cyrl'
cyrl.numeric; // '220'

numeric(string|number numeric)

Obtain the ISO15924 instance by its numeric code;

const { numeric } = require('@konfirm/iso15924');
const cyrl = numeric('220');

cyrl.code; // 'Cyrl'
cyrl.numeric; // '220'

Available codes

codenumericdescription
Adlm166Adlam
Afak439Afaka
Aghb239Caucasian Albanian
Ahom338Ahom, Tai Ahom
Arab160Arabic
Aran161Arabic (Nastaliq variant)
Armi124Imperial Aramaic
Armn230Armenian
Avst134Avestan
Bali360Balinese
Bamu435Bamum
Bass259Bassa Vah
Batk365Batak
Beng325Bengali (Bangla)
Bhks334Bhaiksuki
Blis550Blissymbols
Bopo285Bopomofo
Brah300Brahmi
Brai570Braille
Bugi367Buginese
Buhd372Buhid
Cakm349Chakma
Cans440Unified Canadian Aboriginal Syllabics
Cari201Carian
Cham358Cham
Cher445Cherokee
Chrs109Chorasmian
Cirt291Cirth
Copt204Coptic
Cpmn402Cypro-Minoan
Cprt403Cypriot syllabary
Cyrl220Cyrillic
Cyrs221Cyrillic (Old Church Slavonic variant)
Deva315Devanagari (Nagari)
Diak342Dives Akuru
Dogr328Dogra
Dsrt250Deseret (Mormon)
Dupl755Duployan shorthand, Duployan stenography
Egyd070Egyptian demotic
Egyh060Egyptian hieratic
Egyp050Egyptian hieroglyphs
Elba226Elbasan
Elym128Elymaic
Ethi430Ethiopic (Geʻez)
Geok241Khutsuri (Asomtavruli and Nuskhuri)
Geor240Georgian (Mkhedruli and Mtavruli)
Glag225Glagolitic
Gong312Gunjala Gondi
Gonm313Masaram Gondi
Goth206Gothic
Gran343Grantha
Grek200Greek
Gujr320Gujarati
Guru310Gurmukhi
Hanb503Han with Bopomofo
Hang286Hangul (Hangŭl, Hangeul)
Hani500Han (Hanzi, Kanji, Hanja)
Hano371Hanunoo (Hanunóo)
Hans501Han (Simplified variant)
Hant502Han (Traditional variant)
Hatr127Hatran
Hebr125Hebrew
Hira410Hiragana
Hluw080Anatolian Hieroglyphs (Luwian Hieroglyphs, Hittite Hieroglyphs)
Hmng450Pahawh Hmong
Hmnp451Nyiakeng Puachue Hmong
Hrkt412Japanese syllabaries
Hung176Old Hungarian (Hungarian Runic)
Inds610Indus (Harappan)
Ital210Old Italic (Etruscan, Oscan, etc.)
Jamo284Jamo
Java361Javanese
Jpan413Japanese
Jurc510Jurchen
Kali357Kayah Li
Kana411Katakana
Khar305Kharoshthi
Khmr355Khmer
Khoj322Khojki
Kitl505Khitan large script
Kits288Khitan small script
Knda345Kannada
Kore287Korean
Kpel436Kpelle
Kthi317Kaithi
Lana351Tai Tham (Lanna)
Laoo356Lao
Latf217Latin (Fraktur variant)
Latg216Latin (Gaelic variant)
Latn215Latin
Leke364Leke
Lepc335Lepcha (Róng)
Limb336Limbu
Lina400Linear A
Linb401Linear B
Lisu399Lisu (Fraser)
Loma437Loma
Lyci202Lycian
Lydi116Lydian
Mahj314Mahajani
Maka366Makasar
Mand140Mandaic, Mandaean
Mani139Manichaean
Marc332Marchen
Maya090Mayan hieroglyphs
Medf265Medefaidrin (Oberi Okaime, Oberi Ɔkaimɛ)
Mend438Mende Kikakui
Merc101Meroitic Cursive
Mero100Meroitic Hieroglyphs
Mlym347Malayalam
Modi324Modi, Moḍī
Mong145Mongolian
Moon218Moon (Moon code, Moon script, Moon type)
Mroo264Mro, Mru
Mtei337Meitei Mayek (Meithei, Meetei)
Mult323Multani
Mymr350Myanmar (Burmese)
Nand311Nandinagari
Narb106Old North Arabian (Ancient North Arabian)
Nbat159Nabataean
Newa333Newa, Newar, Newari, Nepāla lipi
Nkdb085Naxi Dongba (na²¹ɕi³³ to³³ba²¹, Nakhi Tomba)
Nkgb420Naxi Geba (na²¹ɕi³³ gʌ²¹ba²¹, 'Na-'Khi ²Ggŏ-¹baw, Nakhi Geba)
Nkoo165N’Ko
Nshu499Nüshu
Ogam212Ogham
Olck261Ol Chiki (Ol Cemet’, Ol, Santali)
Orkh175Old Turkic, Orkhon Runic
Orya327Oriya (Odia)
Osge219Osage
Osma260Osmanya
Palm126Palmyrene
Pauc263Pau Cin Hau
Perm227Old Permic
Phag331Phags-pa
Phli131Inscriptional Pahlavi
Phlp132Psalter Pahlavi
Phlv133Book Pahlavi
Phnx115Phoenician
Piqd293Klingon (KLI pIqaD)
Plrd282Miao (Pollard)
Prti130Inscriptional Parthian
Qaaa900Reserved for private use (start)
Qaab901Codes reserved for private use
Qaac902Codes reserved for private use
Qaad903Codes reserved for private use
Qaae904Codes reserved for private use
Qaaf905Codes reserved for private use
Qaag906Codes reserved for private use
Qaah907Codes reserved for private use
Qaai908Codes reserved for private use
Qaaj909Codes reserved for private use
Qaak910Codes reserved for private use
Qaal911Codes reserved for private use
Qaam912Codes reserved for private use
Qaan913Codes reserved for private use
Qaao914Codes reserved for private use
Qaap915Codes reserved for private use
Qaaq916Codes reserved for private use
Qaar917Codes reserved for private use
Qaas918Codes reserved for private use
Qaat919Codes reserved for private use
Qaau920Codes reserved for private use
Qaav921Codes reserved for private use
Qaaw922Codes reserved for private use
Qaax923Codes reserved for private use
Qaay924Codes reserved for private use
Qaaz925Codes reserved for private use
Qaba926Codes reserved for private use
Qabb927Codes reserved for private use
Qabc928Codes reserved for private use
Qabd929Codes reserved for private use
Qabe930Codes reserved for private use
Qabf931Codes reserved for private use
Qabg932Codes reserved for private use
Qabh933Codes reserved for private use
Qabi934Codes reserved for private use
Qabj935Codes reserved for private use
Qabk936Codes reserved for private use
Qabl937Codes reserved for private use
Qabm938Codes reserved for private use
Qabn939Codes reserved for private use
Qabo940Codes reserved for private use
Qabp941Codes reserved for private use
Qabq942Codes reserved for private use
Qabr943Codes reserved for private use
Qabs944Codes reserved for private use
Qabt945Codes reserved for private use
Qabu946Codes reserved for private use
Qabv947Codes reserved for private use
Qabw948Codes reserved for private use
Qabx949Reserved for private use (end)
Rjng363Rejang (Redjang, Kaganga)
Rohg167Hanifi Rohingya
RootRESERVEDReserved for the language-neutral base of the CLDR locale tree
Roro620Rongorongo
Runr211Runic
Samr123Samaritan
Sara292Sarati
Sarb105Old South Arabian
Saur344Saurashtra
Sgnw095SignWriting
Shaw281Shavian (Shaw)
Shrd319Sharada, Śāradā
Shui530Shuishu
Sidd302Siddham, Siddhaṃ, Siddhamātṛkā
Sind318Khudawadi, Sindhi
Sinh348Sinhala
Sogd141Sogdian
Sogo142Old Sogdian
Sora398Sora Sompeng
Soyo329Soyombo
Sund362Sundanese
Sylo316Syloti Nagri
Syrc135Syriac
Syre138Syriac (Estrangelo variant)
Syrj137Syriac (Western variant)
Syrn136Syriac (Eastern variant)
Tagb373Tagbanwa
Takr321Takri, Ṭākrī, Ṭāṅkrī
Tale353Tai Le
Talu354New Tai Lue
Taml346Tamil
Tang520Tangut
Tavt359Tai Viet
Telu340Telugu
Teng290Tengwar
Tfng120Tifinagh (Berber)
Tglg370Tagalog (Baybayin, Alibata)
Thaa170Thaana
Thai352Thai
Tibt330Tibetan
Tirh326Tirhuta
TrueRESERVEDReserved for the boolean value true
Ugar040Ugaritic
Vaii470Vai
Visp280Visible Speech
Wara262Warang Citi (Varang Kshiti)
Wcho283Wancho
Wole480Woleai
Xpeo030Old Persian
Xsux020Cuneiform, Sumero-Akkadian
Yezi192Yezidi
Yiii460Yi
Zanb339Zanabazar Square (Zanabazarin Dörböljin Useg, Xewtee Dörböljin Bicig, Horizontal Square Script)
Zinh994Code for inherited script
Zmth995Mathematical notation
Zsye993Symbols (Emoji variant)
Zsym996Symbols
Zxxx997Code for unwritten documents
Zyyy998Code for undetermined script
Zzzz999Code for uncoded script

ISO15924 API

The ISO15924 instances are designed to be immutable and provide only basic information

Properties

nametypedescription
codestringThe alphabetic code
numericstringThe numeric code

Casting

All ISO15924 instances allow to be cast in several shapes

nametypedescription
toStringstringCast the instance into its string representation
toJSONstringCast the instance into its JSON-able representation (string)
valueOfnumberCast the instance into a real number (0 for the reserved ones), note that this will lose the 0-padding on the left

License

MIT License Copyright (c) 2019 Rogier Spieker (Konfirm)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.