Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/0xadada/random-emoji
🍗 random emoji function with zero dependencies
https://github.com/0xadada/random-emoji
emoji typescript unicode
Last synced: about 2 months ago
JSON representation
🍗 random emoji function with zero dependencies
- Host: GitHub
- URL: https://github.com/0xadada/random-emoji
- Owner: 0xadada
- License: mit
- Created: 2019-10-05T14:12:36.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2024-02-09T01:32:26.000Z (11 months ago)
- Last Synced: 2024-10-18T08:24:51.500Z (2 months ago)
- Topics: emoji, typescript, unicode
- Language: JavaScript
- Homepage: https://0xadada.github.io/random-emoji/
- Size: 695 KB
- Stars: 3
- Watchers: 4
- Forks: 0
- Open Issues: 15
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# @0xadada/random-emoji
_random emoji function with zero dependencies_
## Benefits
- zero dependencies
- doesn't define a range of emoji, just uses math## Usage
```bash
$ npm i @0xadada/random-emoji
$ npm run -s start
> 🙄
$ npm run -s start
> 😜
$ node
> const { random } = require('@0xadada/random-emoji');
> random()
'😁'
> let a = random(); // defaults to 'emoticons'
> let b = random('emoticons');
> let c = random('food');
> let d = random('animals');
> let e = random('expressions');
> console.log(a, b, c, d, e);
😍 🙄 🍗 🐥 🤢
```## Arguments
Invoked without arguments, the function will return an emoji character within
the `'emoticons'` range of unicode characters.**Range**
`random` accepts an optional `String` argument. This string describes the
characters within a subset of the unicode block that `random` will be limited
to. Current options are:- `'emoticons'` [1F600-1F64F](https://apps.timwhitlock.info/unicode/inspect/hex/1F600-1F64F)
- `'food'` [1F32D-1F37F](https://apps.timwhitlock.info/unicode/inspect/hex/1F32D-1F37F)
- `'animals'` [1F400-1F4D3](https://apps.timwhitlock.info/unicode/inspect/hex/1F400-1F4D3)
- `'expressions'` [1F910-1F92F](https://apps.timwhitlock.info/unicode/inspect/hex/1F910-1F92F)