Skip to content

Commit 35efea5

Browse files
authored
feat(unicode): strip additional rune ranges (#1575)
1 parent 9021f09 commit 35efea5

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

helper/unicode.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,12 @@ const MISC_UNSUPPORTED_SYMBOLS = regenerate()
7373
.addRange(0x1D400, 0x1D7FF) // Mathematical Alphanumeric Symbols (1D400-1D7FF)
7474

7575
// emojis
76+
.addRange(0x1F1E6, 0x1F1FF) // Regional indicator symbol (1F1E6-1F1FF)
7677
.addRange(0x1F300, 0x1F5FF) // Miscellaneous Symbols and Pictographs (1F300-1F5FF)
7778
.addRange(0x1F3FB, 0x1F3FF) // Emoji Modifier Fitzpatrick (skin tones) (1F3FB–1F3FF)
7879
.addRange(0x1F600, 0x1F64F) // Emoticons (1F600–1F64F)
7980
.addRange(0x1F680, 0x1F6FF) // Transport and Map Symbols (1F680-1F6FF)
81+
.addRange(0x1F780, 0x1F7FF) // Geometric Shapes Extended (1F780-1F7FF)
8082
.addRange(0x1F900, 0x1F9FF) // Supplemental Symbols and Pictographs (1F900-1F9FF)
8183
.toRegExp('g');
8284

test/unit/helper/unicode.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,13 @@ module.exports.tests.normalize = function (test) {
4747
t.equal(norm('👩‍❤️‍👩'), '', 'complex emoji ZWJ sequence (6 codepoints)');
4848
t.end();
4949
});
50+
51+
// https://github.com/pelias/api/issues/1574
52+
test('normalize: issue 1574', function (t) {
53+
const input = 'ASDFJK СТРАНЫ БЫЛИ КТО СЛУШАЕТ МЕНЯФ1💒🌋🚭🚱⬆️↗️➡️↘️⬇️↙️⬅️↖️↕️↔️↩↪⤴️👯‍♂️🇰🇿⤵️🔃🔄🛐⚛🕉✡☸♍☯️☸✡🕉🛐⚛🔅🔆🔴🟠🟡🟢НЗЕВИ Л К ВО УНТВА854У32Й1🔵🟣🟤⚪⚫⚫🟥🟧🟨🔶️🟩🟦🟪🟫⬛⬜◼◻◾◽💠'; // jshint ignore:line
54+
t.equal(norm(input), 'ASDFJK СТРАНЫ БЫЛИ КТО СЛУШАЕТ МЕНЯФ1НЗЕВИ Л К ВО УНТВА854У32Й1', 'issue 1574');
55+
t.end();
56+
});
5057
};
5158

5259
module.exports.all = function (tape, common) {

0 commit comments

Comments
 (0)