mirror of
https://github.com/tribufu/node-gamedig
synced 2026-05-06 15:17:36 +00:00
* 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
27 lines
508 B
JavaScript
27 lines
508 B
JavaScript
import { games } from './games.js'
|
|
|
|
export const lookup = (options) => {
|
|
const type = options.type
|
|
|
|
if (!type) { throw Error('No game specified') }
|
|
|
|
if (type.startsWith('protocol-')) {
|
|
return {
|
|
protocol: type.substring(9)
|
|
}
|
|
}
|
|
|
|
let game = games[type]
|
|
|
|
if (options.checkOldIDs) {
|
|
Object.keys(games).forEach((id) => {
|
|
if (games[id]?.extra.old_id) {
|
|
game = games[id]
|
|
}
|
|
})
|
|
}
|
|
|
|
if (!game) { throw Error('Invalid game: ' + type) }
|
|
|
|
return game.options
|
|
}
|