Skip to content

Commit

Permalink
Update dev-dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
wooorm committed Mar 26, 2021
1 parent e5c44f4 commit 6470bf8
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 17 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"remark-preset-wooorm": "^8.0.0",
"tape": "^5.0.0",
"tinyify": "^3.0.0",
"xo": "^0.37.0"
"xo": "^0.38.0"
},
"scripts": {
"generate": "node script/build-data",
Expand Down
22 changes: 14 additions & 8 deletions script/build-data.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,11 @@ var data = Object.keys(schema)

// Detect if emoticons are classified multiple times.
var known = {}
var info
var emoticon

data.forEach(function (info) {
info.emoticons.forEach(function (emoticon) {
for (info of data) {
for (emoticon of info.emoticons) {
if (own.call(known, emoticon)) {
console.log(
'Duplicate emoticon `%s` in `%s` and `%s`',
Expand All @@ -75,19 +77,23 @@ data.forEach(function (info) {
}

known[emoticon] = info.name
})
})
}
}

// Write.
fs.writeFileSync('index.json', JSON.stringify(data, null, 2) + '\n')

function unpack(value) {
var result = []
value[0].forEach(function (first) {
value[1].forEach(function (second) {
var first
var second

for (first of value[0]) {
for (second of value[1]) {
result.push(first + second)
})
})
}
}

return result
}

Expand Down
24 changes: 16 additions & 8 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,31 +8,39 @@ test('emoticon', function (t) {
t.ok(Array.isArray(emoticon), 'should be an array')

t.doesNotThrow(function () {
emoticon.forEach(function (info) {
var info

for (info of emoticon) {
assert.strictEqual(typeof info.emoji, 'string', JSON.stringify(info))
})
}
}, 'each entry should have an `emoji` string field')

t.doesNotThrow(function () {
emoticon.forEach(function (info) {
var info

for (info of emoticon) {
assert.strictEqual(
typeof info.description,
'string',
JSON.stringify(info)
)
})
}
}, 'each entry should have an `description` string field')

t.doesNotThrow(function () {
emoticon.forEach(function (info) {
var info

for (info of emoticon) {
assert.ok(Array.isArray(info.tags), JSON.stringify(info))
})
}
}, 'each entry should have an `tags` array field')

t.doesNotThrow(function () {
emoticon.forEach(function (info) {
var info

for (info of emoticon) {
assert.ok(Array.isArray(info.emoticons), JSON.stringify(info))
})
}
}, 'each entry should have an `emoticons` array field')

t.end()
Expand Down

0 comments on commit 6470bf8

Please sign in to comment.