An open API service indexing awesome lists of open source software.

https://github.com/alexmayol/emojid

Generate IDs and UUIDs the right way ๐Ÿ˜Œ๐Ÿ‘Œ
https://github.com/alexmayol/emojid

emoji generator hacktoberfest uuid

Last synced: about 1 year ago
JSON representation

Generate IDs and UUIDs the right way ๐Ÿ˜Œ๐Ÿ‘Œ

Awesome Lists containing this project

README

          

# Emojid

Generate IDs and UUIDs with emojis.

`npm i @midnight-city/emojid`

`yarn add @midnight-city/emojid`

Give your users a nice time looking at their funny URL at the cost of bloating your database with hell itself.

Some libraries shouldn't exist. This is one of them.

```js
import { emojid, uuid } from "@midnight-city/emojid";

const id = emojid(6);
//"๐Ÿ˜ฒ๐Ÿฆˆ๐ŸŒš๐ŸŽฎ๐Ÿ“€๐Ÿšฉ"

const uuid = uuid();
// "๐Ÿน๐Ÿ”ด๐ŸŽง๐Ÿฆฅ-๐Ÿ‘€๐Ÿ˜‚-๐Ÿ”ช๐Ÿ”‘-๐Ÿ˜›๐Ÿง„๐Ÿฆˆ๐Ÿœ๐Ÿงป๐ŸŒ๐Ÿ”ด๐ŸŽฑ"
```

# API

You can also use the public API if you don't feel like installing yet another dependency:

[https://emojid-generator.vercel.app/api/uuid](https://emojid-generator.vercel.app/api/uuid)

[https://emojid-generator.vercel.app/api/id](https://emojid-generator.vercel.app/api/id)

[https://emojid-generator.vercel.app/api/id/:number](https://emojid-generator.vercel.app/api/id/:number)

## Caveats and gotchas

It turns out the lenght of most emojis is 2, but some of them have a lenght of 1 and even length of 5. [Check it out using this list](https://www.freecodecamp.org/news/all-emojis-emoji-list-for-copy-and-paste/)

`'โšก'.length == 1`
`'๐Ÿ˜„'.length == 2`
`'๐Ÿ‘ฉโ€๐Ÿฆฐ'.length == 5`
`'๐Ÿ‘ฉโ€๐Ÿ‘ฉโ€๐Ÿ‘ฉโ€๐Ÿ‘งโ€๐Ÿ‘ง'.length == 14`

๐Ÿค”๐Ÿค”