mirror of
https://github.com/tribufu/node-gamedig
synced 2026-06-01 09:42:41 +00:00
feat: add checking for older GIDs (#496)
* feat: add new games.extra.old_id * add extra.old_id; standard release_year * add option dontCheckOldIDs * update naming, README, CHANGELOG * Update CONTRIBUTING.md * fix games.js * add tool for checking duplicates * update GAMES_LIST * fix anchor links * fix notes in generated game list * Update GAMES_LIST.md * Update GAMES_LIST.md * add Game Object Example in CONTRIBUTING * Update find_id_duplicates.js * check skipOldIDs only once * remove old ids; tweaks GAMES_LIST * add MIGRATION document WIP * Update GAMES_LIST.md * update Halo Online name * revert changes tool/generate * remove extra line * Update GAMES_LIST.md * roll back GAME_LIST * Update GAMES_LIST.md * OMG * WAT * ok... hopefully the last change * Update GAMES_LIST.md * add MIGRATION ids * roll back CONTRIBUTING * Update CHANGELOG.md * update skipOldIDs to checkOldIDs * Update MIGRATION.md * add migration note on README
This commit is contained in:
parent
67e0cd8809
commit
1f10ad0608
8 changed files with 943 additions and 349 deletions
30
tools/find_id_duplicates.js
Normal file
30
tools/find_id_duplicates.js
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
import { games } from '../lib/games.js'
|
||||
|
||||
const ids = Object.keys(games)
|
||||
|
||||
Object.keys(games).forEach((key) => {
|
||||
if (games[key].extra && games[key].extra.old_id) {
|
||||
const idOld = games[key].extra.old_id
|
||||
ids.push(idOld)
|
||||
}
|
||||
})
|
||||
|
||||
function hasDuplicates(obj) {
|
||||
const uniqueSet = new Set()
|
||||
|
||||
for (const item of obj) {
|
||||
if (uniqueSet.has(item)) {
|
||||
console.log('Duplicate:', item)
|
||||
return true
|
||||
}
|
||||
uniqueSet.add(item)
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
if (hasDuplicates(ids)) {
|
||||
console.log('Duplicates found.')
|
||||
} else {
|
||||
console.log('No duplicates found.')
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue