UNPKG

teeworlds-econ

Version:
21 lines (18 loc) 504 B
var parseStatus; parseStatus = function(output) { if (output === '') { return null; } return output.split('\n').map(function(line) { var matches; matches = /^\[Server\]: id=([0-9]+) addr=(.+?):([0-9]+) name='(.+?)' score=([0-9-]+).*?(\(Admin\))?$/.exec(line); return { cid: parseInt(matches[1]), client: matches[2] + ":" + matches[3], player: matches[4], score: parseInt(matches[5]), admin: !!matches[6] }; }); }; module.exports = parseStatus;