1
0
mirror of https://github.com/tcgdex/cards-database.git synced 2025-06-13 00:09:18 +00:00

fix: Add Diamond & Pearl French translations (#179)

* fix: Add the two first sets

Signed-off-by: Avior <github@avior.me>

* fix: Add DP, DP Black Star and Mysterious Treasures

Signed-off-by: Avior <github@avior.me>
This commit is contained in:
2021-11-22 18:11:03 +00:00
committed by GitHub
parent b70c73d43e
commit d4be6fa84f
505 changed files with 4907 additions and 2204 deletions

View File

@ -78,6 +78,18 @@ function set(j: JSCodeshift, path: ObjectExpression | ArrayExpression, value: Po
}
}
function remove(path: ObjectExpression | ArrayExpression, key: string | number) {
if (path.type === 'ObjectExpression') {
const index = path.properties.findIndex((p) => ((p as Property).key as Identifier).name === (key + ''))
if (index === -1) {
return
}
path.properties.splice(index)
} else {
}
}
/**
* Start editing here !
*/
@ -90,9 +102,14 @@ const transformer: Transform = (file, api) => {
.forEach((path, index) => {
if (index !== 0) return
let simplified = simplify(path.node)
const name = simplified.items.name as ObjectField
name.items.fr
// Example remove field
remove(name.item as ObjectExpression, 'fr')
// Example Set/Add regulationMArk to cards
set(j, simplified.item, j.literal('D'), 'regulationMark')
// set(j, name.items.fr, j.literal('D'), 'regulationMark')
})
.toSource({useTabs: true, lineTerminator: '\n'}).replace(/ /g, ' ')