Skip to content

Commit

Permalink
Switch to maintained xml parser
Browse files Browse the repository at this point in the history
  • Loading branch information
muan committed Mar 28, 2024
1 parent 4c26b9d commit 574b14c
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 87 deletions.
127 changes: 43 additions & 84 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@
"promptly": "^3.2.0",
"tape": "^5.1.1",
"unicode-emoji-json": "0.6.0",
"xml2json": "^0.7.1"
"fast-xml-parser": "^4.3.6"
}
}
4 changes: 2 additions & 2 deletions scripts/i18n.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ function createFileFromCldr() {
}

function parse(content) {
const parser = require('xml2json')
const parser = new (require('fast-xml-parser')).XMLParser()
const data = require(`../${basefilePath}`)
Object.keys(data).forEach(k => (data[k] = []))

for (const group of JSON.parse(parser.toJson(content)).ldml.annotations.annotation) {
for (const group of parser.parse(content).ldml.annotations.annotation) {
const emoji = group.cp
const emojiWithOptionalVariation16 = data[emoji] ? emoji : emoji + VARIATION_16
if (!data[emojiWithOptionalVariation16]) continue
Expand Down

0 comments on commit 574b14c

Please sign in to comment.