-
Notifications
You must be signed in to change notification settings - Fork 219
/
index.js
35 lines (33 loc) · 1.04 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// npm module entry
//
// Provides OpenMoji data in a web developer friendly fashion.
//
const version = require('./package.json').version;
const openmojisRaw = require('./data/openmoji.json');
const colorPalette = require('./data/color-palette.json');
// For path joining
const path = require('path');
// Path to SVG directories
// TODO expose svg files under src/:group/:subgroups?
const baseBlackDir = path.join(__dirname, 'black');
const baseColorDir = path.join(__dirname, 'color');
// Enrich the emoji data objects with image file paths.
const openmojisWithPaths = openmojisRaw.map(om => {
return Object.assign({}, om, {
// The absolute file paths to SVG files
openmoji_images: {
black: {
svg: path.join(baseBlackDir, 'svg', om.hexcode + '.svg')
},
color: {
svg: path.join(baseColorDir, 'svg', om.hexcode + '.svg')
}
}
});
});
// Version to help track bugs
exports.version = version;
// Emoji data objects
exports.openmojis = openmojisWithPaths;
// Colors available
exports.color_palette = colorPalette;