about summary refs log tree commit diff stats
path: root/js/puzzle-dungeon/parser.js
blob: ec7f33f99af79cbd2ea0e67e1efe0132e51d2e2a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
export function parseCommands(input) {
    const commands = input.split('\n').map(cmd => cmd.trim()).filter(cmd => cmd.length > 0);
    return commands.map(command => {
        const parts = command.split(' ');
        return {
            command: parts[0],
            args: parts.slice(1)
        };
    });
}