A clrmamepro .dat format parser for Node.js.
npm install cmpro-dat
const DAT = require('cmpro-dat');
const text = `
clrmamepro (
name "Nintendo - Super Nintendo Entertainment System"
description "Nintendo - Super Nintendo Entertainment System"
)
game (
comment "Chrono Trigger (Japan)"
origin "Japan"
rom ( crc 4D014C20 )
)
game (
comment "Ultimate Mortal Kombat 3 (Europe)"
origin "US"
rom ( crc 1C4C54D2 )
)
`;
DAT.parse(text).then(data => {
console.log(data);
});
// [
// {
// __type: 'clrmamepro',
// name: 'Nintendo - Super Nintendo Entertainment System',
// description: 'Nintendo - Super Nintendo Entertainment System'
// },
// {
// __type: 'game',
// comment: 'Chrono Trigger (Japan)',
// origin: 'Japan',
// rom: { crc: '4D014C20' }
// },
// {
// __type: 'game',
// comment: 'Ultimate Mortal Kombat 3 (Europe)',
// origin: 'US',
// rom: { crc: '1C4C54D2' }
// }
// ]
const DAT = require('cmpro-dat');
const datString = DAT.stringify([
{
__type: 'clrmamepro',
name: 'Nintendo - Super Nintendo Entertainment System',
description: 'Nintendo - Super Nintendo Entertainment System',
},
{
__type: 'game',
comment: 'Chrono Trigger (Japan)',
origin: 'Japan',
rom: { crc: '4D014C20' },
},
{
__type: 'game',
comment: 'Ultimate Mortal Kombat 3 (Europe)',
origin: 'US',
rom: { crc: '1C4C54D2' },
},
]);
// clrmamepro (
// name "Nintendo - Super Nintendo Entertainment System"
// description "Nintendo - Super Nintendo Entertainment System"
// )
//
// game (
// comment "Chrono Trigger (Japan)"
// origin Japan
// rom (
// crc "4D014C20"
// )
// )
//
// game (
// comment "Ultimate Mortal Kombat 3 (Europe)"
// origin US
// rom (
// crc "1C4C54D2"
// )
// )