Open danielweck opened 4 years ago
Shouldn't the i in fact be an a?
i
a
['آ', 'a'], ['أ', 'a'], ['إ', 'i'], ['ا', 'a'],
You may run the following tests in your shell / Javascript console:
["ا", "a"]
node -e "console.log('ا'.codePointAt(0).toString(16)); console.log('ا'.normalize('NFD').replace(/[\u0300-\u036f]/g, '').codePointAt(0).toString(16));" =>
node -e "console.log('ا'.codePointAt(0).toString(16)); console.log('ا'.normalize('NFD').replace(/[\u0300-\u036f]/g, '').codePointAt(0).toString(16));"
627 627
["أ", "a"]
node -e "console.log('أ'.codePointAt(0).toString(16)); console.log('أ'.normalize('NFD').replace(/[\u0300-\u036f]/g, '').codePointAt(0).toString(16));" =>
623 627
["آ", "a"]
node -e "console.log('آ'.codePointAt(0).toString(16)); console.log('آ'.normalize('NFD').replace(/[\u0300-\u036f]/g, '').codePointAt(0).toString(16));" =>
622 627
["إ", "i"]
node -e "console.log('إ'.codePointAt(0).toString(16)); console.log('إ'.normalize('NFD').replace(/[\u0300-\u036f]/g, '').codePointAt(0).toString(16));" =>
625 627
Why i, when 627 (same as all other variants) which resolves to a when mapped?
627
https://github.com/sindresorhus/transliterate/blob/master/replacements.js
Shouldn't the
i
in fact be ana
?You may run the following tests in your shell / Javascript console:
The base / non-accented "a":
["ا", "a"]
node -e "console.log('ا'.codePointAt(0).toString(16)); console.log('ا'.normalize('NFD').replace(/[\u0300-\u036f]/g, '').codePointAt(0).toString(16));"
=>First diacritic variant:
["أ", "a"]
node -e "console.log('أ'.codePointAt(0).toString(16)); console.log('أ'.normalize('NFD').replace(/[\u0300-\u036f]/g, '').codePointAt(0).toString(16));" =>
Second diacritic variant:
["آ", "a"]
node -e "console.log('آ'.codePointAt(0).toString(16)); console.log('آ'.normalize('NFD').replace(/[\u0300-\u036f]/g, '').codePointAt(0).toString(16));" =>
Third diacritic variant:
["إ", "i"]
node -e "console.log('إ'.codePointAt(0).toString(16)); console.log('إ'.normalize('NFD').replace(/[\u0300-\u036f]/g, '').codePointAt(0).toString(16));" =>
Why
i
, when627
(same as all other variants) which resolves toa
when mapped?https://github.com/sindresorhus/transliterate/blob/master/replacements.js