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

feat: Add an updated field to the card field (#460)

This commit is contained in:
2024-05-12 00:51:56 +02:00
committed by GitHub
parent e4aba3bf1c
commit c476d82618
6 changed files with 76 additions and 5 deletions

View File

@ -56,6 +56,20 @@ function simplify(base: ObjectExpression): ObjectField {
}
}
function exists(path: ObjectExpression | ArrayExpression, key: string | number) {
if (path.type === 'ObjectExpression') {
path.properties.forEach((p) => {
const prop = p as Property
if ((prop.key as Identifier).name === (key + '')) {
return true
}
})
return false
} else {
}
}
function set(j: JSCodeshift, path: ObjectExpression | ArrayExpression, value: Possible, key: string | number, options?: {override?: boolean}) {
let exists = false