{"id":22351107,"url":"https://github.com/koala-interactive/is-emoji-supported","last_synced_at":"2025-07-30T07:31:44.947Z","repository":{"id":42259968,"uuid":"272405604","full_name":"koala-interactive/is-emoji-supported","owner":"koala-interactive","description":"Detect if the current attached device support the specified emoji","archived":false,"fork":false,"pushed_at":"2023-07-13T02:01:11.000Z","size":1420,"stargazers_count":20,"open_issues_count":7,"forks_count":7,"subscribers_count":12,"default_branch":"master","last_synced_at":"2024-11-28T23:37:52.655Z","etag":null,"topics":["detect","emoji","emojione","joypixels","support","unicode"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/koala-interactive.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-06-15T10:11:27.000Z","updated_at":"2024-05-31T08:48:09.000Z","dependencies_parsed_at":"2024-06-18T16:57:36.212Z","dependency_job_id":"b06f1db0-2ef1-4281-9268-dd3382441e80","html_url":"https://github.com/koala-interactive/is-emoji-supported","commit_stats":{"total_commits":28,"total_committers":5,"mean_commits":5.6,"dds":0.6071428571428572,"last_synced_commit":"240c8986b18d68e113a068c0f3c4f1bc9828f5da"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/koala-interactive%2Fis-emoji-supported","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/koala-interactive%2Fis-emoji-supported/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/koala-interactive%2Fis-emoji-supported/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/koala-interactive%2Fis-emoji-supported/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/koala-interactive","download_url":"https://codeload.github.com/koala-interactive/is-emoji-supported/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228106545,"owners_count":17870437,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["detect","emoji","emojione","joypixels","support","unicode"],"created_at":"2024-12-04T12:13:02.893Z","updated_at":"2024-12-04T12:13:03.665Z","avatar_url":"https://github.com/koala-interactive.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"![Logo](https://koala-interactive.com/logo.e927957b.svg)\n\n# 🦄 is-emoji-supported\n\n![No dependency](https://img.shields.io/badge/dependencies-none-blue.svg)\n[![license: MIT](https://img.shields.io/badge/license-MIT-brightgreen.svg)](https://opensource.org/licenses/MIT)\n![lint](https://github.com/koala-interactive/is-emoji-supported/workflows/lint/badge.svg?branch=master)\n![e2e](https://github.com/koala-interactive/is-emoji-supported/workflows/e2e/badge.svg?branch=master)\n\n## Description\n\n**is-emoji-supported** is a library allowing you to detect if the running device supports the specified emoji and helps you providing a solution if it does not support it.\n\n## 📖 Table of content\n\n- [Installation](#🚀-installation)\n- [How to use](#🖥️-how-to-use)\n- [How to test](#⏳-how-to-test)\n- [How to contribute](#🤝-how-to-contribute)\n- [List of our other package](#📦-list-of-our-other-package)\n- [Join us](#⛵-join-us)\n- [License](#license)\n\n## 🚀 Installation\n\nInstall with [yarn](https://yarnpkg.com):\n\n    $ yarn add is-emoji-supported\n\nOr install using [npm](https://npmjs.org):\n\n    $ npm i is-emoji-supported\n\n## 🖥️ How to use\n\n### Basic usage\n\nThe most basic usage is to use the function directly to detect is the current device support the emoji.\n\n```ts\nimport { isEmojiSupported } from \"is-emoji-supported\";\n\nif (isEmojiSupported(\"🦄\")) {\n  alert(\"Houra 🦄 is supported\");\n} else {\n  alert(\"No support for unicorn emoji yet\");\n}\n```\n\n### Usage with your own cache handler\n\nThis library is doing pixel comparison to determine if an emoji is supported. This check can be slow so there is a memory cache implemented.\nFor some reasons you may want to use your own cache implementation to store the result in either localStorage, IndexedDB or anything else for persistent cache.\nYou only need to match the [`Map`](https://developer.mozilla.org/fr/docs/Web/JavaScript/Reference/Objets_globaux/Map) interface.\n\n```ts\nimport { setCacheHandler } from \"is-emoji-supported\";\n\nconst key = \"emoji-cache\";\nconst cache = JSON.parse(localStorage.getItem(key) || {});\n\nsetCacheHandler({\n  has: (unicode: string) =\u003e unicode in cache,\n  get: (unicode: string) =\u003e cache[unicode],\n  set: (unicode: string, supported: boolean) =\u003e {\n    cache[unicode] = supported;\n    localStorage.setItem(key, JSON.stringify(cache));\n  },\n});\n```\n\n### Fallback to images\n\nIn most of the cases, you will want to fallback to images to handle unsupported emojis. The best way for this is to build an object with a fallback to all supported images.\nYou can build your own or use the one given by [JoyPixel](https://www.joypixels.com/), [Twemoji](https://twemoji.twitter.com/) or others services.\n\n```jsx\nimport React from 'react';\nimport {isEmojiSupported} from 'is-emoji-supported';\n\nconst emojiMap = {\n  '🦄': {\n    alt: 'unicorn',\n    src: '/images/unicorn.png'\n  },\n  ...\n};\n\nexport const Emoji = ({ unicode }) =\u003e {\n  const attrs = emojiMap[unicode];\n\n  return !attrs ? null : isEmojiSupported(unicode) ? (\n    \u003cspan role=\"img\" aria-label={attrs.alt}\u003e\n      {unicode}\n    \u003c/span\u003e\n  ) : (\n    \u003cimg {...attrs} /\u003e\n  );\n};\n```\n\n## ⏳ How to test\n\n    $ npm test\n\n## 🤝 How to contribute\n\n- fork the project\n- (write how to to launch it)\n- create a branch from main/master like that\n\n      $ contribution/fix/your-github-identity\n\n  OR\n\n      $ contribution/improvment/your-github-identity\n\n- push several (if needed) clear commits\n- add tests following the way of the other ones have been wrote\n- make sure that all test runs\n- push your code\n\n## 📦 List of our other package\n\n- [frenchkiss](https://www.npmjs.com/package/frenchkiss)\n- [wowza-webrtc-player](https://www.npmjs.com/package/wowza-webrtc-player)\n- [react-rich-mentions](https://www.npmjs.com/package/react-rich-mentions)\n- [react-anchor-navigation](https://www.npmjs.com/package/react-anchor-navigation)\n\n## ⛵ Join us\n\nMay you want to share more than a pull request\ncheck our [jobs opportunity](https://www.linkedin.com/company/koala-interactive/jobs/)\n\n## License\n\nCopyright (c) 2023 [Koala-Interactive](https://koala-interactive.com/)\n\nThis project is [MIT](link-to-your-license-file) licensed.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkoala-interactive%2Fis-emoji-supported","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkoala-interactive%2Fis-emoji-supported","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkoala-interactive%2Fis-emoji-supported/lists"}