https://github.com/2sem/ts-unicode-emojis
Sectioned Emoji Collection
https://github.com/2sem/ts-unicode-emojis
Last synced: 4 months ago
JSON representation
Sectioned Emoji Collection
- Host: GitHub
- URL: https://github.com/2sem/ts-unicode-emojis
- Owner: 2sem
- License: mit
- Created: 2022-08-26T07:43:21.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2022-09-09T10:46:24.000Z (almost 4 years ago)
- Last Synced: 2025-09-14T03:21:55.848Z (9 months ago)
- Language: TypeScript
- Size: 318 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ts-unicode-emojis
> Emoji unicode collection type and loader
[](https://www.npmjs.com/package/ts-unicode-emojis) [](https://standardjs.com)
## Install
### NPM
```bash
npm install --save ts-unicode-emojis
```
### Yarn
```bash
yarn add --save ts-unicode-emojis
```
## Usage
### Generate JSON
```ts
import { readFileSync } from "fs";
import { loadEmojiCategories } from "../src";
const json = readFileSync('./emoji.json').toString()
const emojiCategires = loadEmojiCategories(json, {
apple: true,
google: true,
facebook: false,
twitter: false
})
console.log(JSON.stringify(emojiCategires))
```
### Parse
```ts
import { readFileSync } from "fs";
import { EmojiCategory } from "ts-unicode-emojis";
// emoji_categories.json: generated json file
const json = readFileSync('./emoji_categories.json').toString()
console.log('json size', json.length)
const emojiCategires: EmojiCategory[] = JSON.parse(json)
console.log('emoji categiry count', emojiCategires.length)
for(const category of emojiCategires) {
console.log('emoji category', 'name', category.name, 'sub categories', category.subCategories.length)
for(const subCategory of category.subCategories){
console.log('sub category', 'name', subCategory.name, 'emoji count', subCategory.emojis.length)
for(const emoji of subCategory.emojis) {
console.log('emoji', 'name', emoji.name, `letter[${String.fromCodePoint(...emoji.unicodes)}]`)
}
}
}
```
## License
MIT © [2sem](https://github.com/2sem)