fix(emoji): fix ™® characters treated as emoji (#682)

fixes #679
This commit is contained in:
Nolan Lawson 2018-11-23 21:32:57 -08:00 committed by GitHub
parent 999d560703
commit e3debcc5e1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View file

@ -9,7 +9,7 @@ export function replaceEmoji (string, replacer) {
function safeReplacer (substring) { function safeReplacer (substring) {
// emoji regex matches digits and pound sign https://git.io/fpl6J // emoji regex matches digits and pound sign https://git.io/fpl6J
if (substring.match(/^[0-9#*]+$/)) { if (substring.match(/^[0-9#*™®]+$/)) {
return substring return substring
} }
return replacer(substring) return replacer(substring)

View file

@ -67,8 +67,8 @@ describe('test-emoji.js', function () {
`it's over #9000` `it's over #9000`
) )
assert.strictEqual( assert.strictEqual(
replaceEmoji(`woot !@#$%^&*()~` + '`' + `{[}]:;"'<,>.?/£`, replacer), replaceEmoji(`woot !@#$%^&*()~` + '`' + `{[}]:;"'<,>.?/£™℠®`, replacer),
`woot !@#$%^&*()~` + '`' + `{[}]:;"'<,>.?/£` `woot !@#$%^&*()~` + '`' + `{[}]:;"'<,>.?/£™℠®`
) )
}) })