Add keywords to emojis data

release
Etienne Lemay 2016-07-21 16:06:13 -04:00
parent 2d3f789079
commit 18e0f2039e
3 changed files with 12 additions and 1 deletions

File diff suppressed because one or more lines are too long

View File

@ -30,6 +30,7 @@
"babel-preset-es2015": "6.6.0",
"babel-preset-react": "6.5.0",
"emoji-data": "git://github.com/iamcal/emoji-data.git#6daffc10d8e8fd06b80ec24c9bdcb65218f71563",
"emojilib": "2.0.2",
"inflection": "1.10.0",
"lunr": "0.7.1",
"mkdirp": "0.5.1",

View File

@ -1,8 +1,11 @@
var fs = require('fs'),
emojiData = require('emoji-data'),
emojiLib = require('emojilib'),
inflection = require('inflection'),
mkdirp = require('mkdirp')
// console.log(emojiLib.lib);
var categories = ['People', 'Nature', 'Foods', 'Activity', 'Places', 'Objects', 'Symbols', 'Flags'],
data = { categories: [], emojis: {}, skins: {} },
categoriesIndex = {}
@ -22,6 +25,7 @@ emojiData.sort((a, b) => {
emojiData.forEach((datum) => {
var category = datum.category,
shortName = datum.short_name,
keywords = [],
categoryIndex
if (!datum.category) {
@ -47,6 +51,12 @@ emojiData.forEach((datum) => {
delete datum.text
delete datum.texts
if (emojiLib.lib[datum.short_name]) {
keywords = emojiLib.lib[datum.short_name].keywords
}
datum.keywords = keywords
if (datum.category == 'Skin Tones') {
data.skins[datum.short_name] = datum
} else {