JavaScript
// g26-local-catalog.js
// Contoh modul parsing lokal untuk katalog game g26
const catalogData = require('./g26-catalog.json');
function getGameDetails(gameId) {
const game = catalogData.games.find(item => item.id === gameId);
if (!game) {
return { status: 'error', message: 'Game tidak ditemukan dalam metadata lokal' };
}
return {
status: 'success',
platform: catalogData.platform,
data: {
name: game.name,
category: game.category,
description: game.description
}
};
}
// Pengujian pemetaan game lokal
const testGladiGlory = getGameDetails('140');
console.log('Detail Game 140:', testGladiGlory);
const testDoubleFortune = getGameDetails('039');
console.log('Detail Game 039:', testDoubleFortune);
JSON
{
"brand": "g26",
"platform": "android",
"games": [
{
"id": "140",
"name": "Gladi Glory",
"category": "Aksi",
"description": "Permainan bertema gladiator dengan pertarungan seru dan putaran dinamis."
},
{
"id": "156",
"name": "Zombie Outbrk",
"category": "Petualangan",
"description": "Permainan bertema bertahan hidup melawan serangan zombi yang menegangkan."
},
{
"id": "039",
"name": "Double Fortune",
"category": "Kasual",
"description": "Permainan bertema keberuntungan ganda dengan simbol-simbol klasik."
},
{
"id": "024",
"name": "Prosperity Lion",
"category": "Kasual",
"description": "Permainan bertema tarian barongsai yang menghadirkan suasana meriah."
},
{
"id": "076",
"name": "Queen Bounty",
"category": "Petualangan",
"description": "Permainan bertema bajak laut dengan perburuan harta karun di lautan."
}
]
}