Files: 0b68762e851dab73abc45fa60add0d96d3b5c7ac / emoji.js
533 bytesRaw
1 | const emojis = require('emoji-named-characters') |
2 | const emojiNames = Object.keys(emojis) |
3 | const nest = require('depnest') |
4 | |
5 | exports.needs = nest('blob.sync.url', 'first') |
6 | exports.gives = nest({ |
7 | 'emoji.sync': [ |
8 | 'names', |
9 | 'url' |
10 | ] |
11 | }) |
12 | |
13 | exports.create = function (api) { |
14 | return nest({ |
15 | 'emoji.sync': { |
16 | names, |
17 | url |
18 | } |
19 | }) |
20 | |
21 | function names () { |
22 | return emojiNames |
23 | } |
24 | |
25 | function url (emoji) { |
26 | return emoji in emojis && |
27 | api.blob.sync.url(emoji).replace(/\/blobs\/get/, '/img/emoji') + '.png' |
28 | } |
29 | } |
30 |
Built with git-ssb-web