Skip to content

Feature/emoji-find#53

Merged
omnidan merged 11 commits into
omnidan:masterfrom
smeijer:feature/emoji-find
Jul 21, 2017
Merged

Feature/emoji-find#53
omnidan merged 11 commits into
omnidan:masterfrom
smeijer:feature/emoji-find

Conversation

@smeijer

@smeijer smeijer commented Jul 16, 2017

Copy link
Copy Markdown

Add Emoji.find method. This PR is build upon #52, so either that one should be merged first, or this one should be refactored.

Readme should also cover Emoji.findByName and Emoji.findByCode, but I think the readme could use a general makeover. So I wanted to postpone that change, to keep the upcoming release more agile. Emoji.find is covered by the readme update.

This PR turnes the tests below green:

  describe('find emoji', function() {

    it('Should be able to find a emoji by :name:', function() {
      var result = emoji.find(':heart:')
      should.exists(result);
      result.should.eql({ emoji: '❤️', key: 'heart' });
    });

     it('Should be able to find an emoji by name', function() {
      var result = emoji.find('heart');
      should.exists(result);
      result.should.eql({ emoji: '❤️', key: 'heart' });
    });

     it('Should be able to find an emoji by code', function() {
      var result = emoji.find('❤');
      should.exists(result);
      result.should.eql({ emoji: '❤️', key: 'heart' });
    });

     it('Should return `undefined` for unknown emojis', function() {
      var result = emoji.find('unknown_emoji');
      should.not.exists(result);
    })

  });

This was referenced Jul 16, 2017
Comment thread lib/emoji.js
* @param {string} nameOrCode The emoji to find, either `coffee`, `:coffee:` or `☕`;
* @return {object}
*/
Emoji.find = function get(nameOrCode) {

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you rename the function to find (could be confusing to see get in the stack trace when this is the find function)?

we should always ensure that the internal function name (function functionName) is the same as the API function name (Emoji.functionName):

Emoji.functionName = function functionName (arguments) {

@omnidan

omnidan commented Jul 21, 2017

Copy link
Copy Markdown
Owner

thanks for all the PRs! this PR looks good, except that the function names are not defined properly. I'll merge it and update the names 😁

@omnidan omnidan merged commit 6961d5e into omnidan:master Jul 21, 2017
@omnidan omnidan mentioned this pull request Jul 21, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants