Skip to content

Add a .extend(...) option to expand upon the built-in dictionary #144

@JoshuaKGoldberg

Description

@JoshuaKGoldberg

Forking @bigpay-ali's #132 (comment):

Hello beautiful humans, I love what you did with this lib and thank you for providing this library for developer like me to build on top of it, is there a way we can get this fix merged? I desprately need some emojis which are missing from your lib. Maybe we can add a .extend(":emoji-code","✅") function, just in case some emojis are missing, developer can update it and make it searchable across project?

I like this idea. Even after the latest emojilib gets merged in, it's possible folks will want to add their own context/project-specific emoji extensions.

One difficulty with this is that right now, all node-emoji APIs are exported standalone: e.g. import { findByName } from "node-emoji". This new extension API would need to either:

  • Modify the global-ish data used by the entire node-emoji module
  • Create and return a new object with APIs

I'd lean towards the latter personally, as modifying global state is a worrisome thing to me.

My starting API proposal:

import { extend } from "node-emoji";

const emojiBank = extend({
  emojis: [
    { code: "yeehaw", emoji: "🤠" }
  ]
});

This differs from the original comment by being more explicit and open to later expansion, at the cost of extra verbosity.

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: accepting prsPlease, send a pull request to resolve this!type: featureNew enhancement or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions