omnidan / node-emoji

💖 simple emoji support for node.js projects
MIT License
1.31k stars 241 forks source link

Remove space on strip #100

Closed up73k closed 3 years ago

up73k commented 3 years ago

.strip method remove space with ® sign.

emoji.strip('MASCOT® Mannheim') // returns  'MASCOTMannheim'

Please fix this.

Richienb commented 3 years ago

® is being treated as an emoji.

lancedikson commented 3 years ago

I guess, the problem is with space — why is it removed and could it be fixed somehow? :)

Richienb commented 3 years ago

Spaces after emojis are automatically removed.

Emoji.strip calls the Emoji.replace function with the third parameter set to true:

https://github.com/omnidan/node-emoji/blob/4004ffe722364249643eccf493d8aea2448da1f2/lib/emoji.js#L300

That third parameter is named cleanSpaces:

https://github.com/omnidan/node-emoji/blob/4004ffe722364249643eccf493d8aea2448da1f2/lib/emoji.js#L274

lancedikson commented 3 years ago

Thanks 👍 Looks like we could use Emoji.replace instead of strip :)

up73k commented 3 years ago

Thanks!