2015-09-27 20:32:14 +10:00
|
|
|
var Message = require('js-message');
|
|
|
|
|
|
|
|
function formatData(message){
|
|
|
|
if(!message.data){
|
|
|
|
message.data={};
|
|
|
|
}
|
|
|
|
if(message.data['_maxListeners']){
|
|
|
|
message.data={};
|
|
|
|
}
|
|
|
|
|
|
|
|
message=message.JSON+parser.delimiter;
|
|
|
|
return message;
|
2014-02-22 20:13:31 +11:00
|
|
|
};
|
|
|
|
|
|
|
|
function parseDataEvents(data){
|
|
|
|
var events=data.split(parser.delimiter);
|
|
|
|
events.pop();
|
|
|
|
return events;
|
|
|
|
}
|
|
|
|
|
|
|
|
var parser={
|
|
|
|
parse : parseDataEvents,
|
|
|
|
format : formatData,
|
|
|
|
delimiter : '\f'
|
|
|
|
}
|
|
|
|
|
2015-09-27 20:32:14 +10:00
|
|
|
module.exports=parser;
|