-
-
Notifications
You must be signed in to change notification settings - Fork 65
Allow emoji or image after the entry description #66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Overall, looks really solid. See my comment in #60 as Sindre has the final call on all formatting decisions like this. |
lib/trim-emoji.js
Outdated
| const emoji = match[0]; | ||
| const codePoints = [...emoji].length; | ||
| if (match.index === 0) { | ||
| text = text.substr(codePoints).trim(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer using slice instead of substr.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure. But sadly you rejected this feature, #60 (comment).
lib/trim-emoji.js
Outdated
| } | ||
| } | ||
|
|
||
| return text; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not just text.replace(emojiRegex, '')?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See my test cases. I want to trim emojis and spaces, but NOT to remove inner emojis and NOT to trim spaces if no emojis.
- t.deepEqual(trimEmoji('⭐ hello'), 'hello');
- t.deepEqual(trimEmoji(' hello '), ' hello ');
- t.deepEqual(trimEmoji('hello⭐hello'), 'hello⭐hello');
|
@chinesedfan can you update this PR to reflect the decision made in #60? Thanks! |
|
@transitive-bullshit Updated. |
|
Thanks :) |
Fixes #60.
In fact, emoji was allowed after the entry description by #29.