-
-
Notifications
You must be signed in to change notification settings - Fork 25
Expand file tree
/
Copy pathgenerate-zalo-reactions-emoji-pos.js
More file actions
30 lines (24 loc) · 1.08 KB
/
Copy pathgenerate-zalo-reactions-emoji-pos.js
File metadata and controls
30 lines (24 loc) · 1.08 KB
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
const fs = require('fs')
const path = require('path')
const reactionsPath = path.join(__dirname, 'assets', 'zalo-reactions.json')
const reactionsData = JSON.parse(fs.readFileSync(reactionsPath, 'utf8'))
const emojiPosPath = path.join(__dirname, 'assets', 'zalo-emoji-pos.json')
const emojiPosData = JSON.parse(fs.readFileSync(emojiPosPath, 'utf8'))
// Extract all rIcon values from reactions data into a Set for efficient lookup
const rIconSet = new Set()
reactionsData.forEach(reaction => {
if (reaction.rIcon) {
rIconSet.add(reaction.rIcon)
}
})
// Filter emoji positions that match rIcon values from reactions
const filteredData = {}
for (const [key, value] of Object.entries(emojiPosData)) {
if (rIconSet.has(key)) {
filteredData[key] = value
}
}
const outputPath = path.join(__dirname, 'assets', 'zalo-reactions-emoji-pos.json')
fs.writeFileSync(outputPath, JSON.stringify(filteredData, null, 2), 'utf8')
console.log(`Filtered ${Object.keys(filteredData).length} items from ${Object.keys(emojiPosData).length} initial items.`)
console.log(`Result written to: ${outputPath}`)