Files: 0baf5414ce7a4d8be1f75148ec7dce869d876d66 / emoji.js
530 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 | exports.create = function (api) { |
13 | return nest({ |
14 | 'emoji.sync': { |
15 | names, |
16 | url |
17 | } |
18 | }) |
19 | |
20 | function names () { |
21 | return emojiNames |
22 | } |
23 | |
24 | function url (emoji) { |
25 | return emoji in emojis && |
26 | api.blob.sync.url(emoji).replace(/\/blobs\/get/, '/img/emoji') + '.png' |
27 | } |
28 | } |
29 |
Built with git-ssb-web