node-ipc/dao/eventParser.js

28 lines
527 B
JavaScript
Raw Normal View History

2016-01-10 23:18:14 +11:00
'use strict';
2016-01-10 23:57:08 +11:00
const parser={
parse : parseDataEvents,
format : formatData,
delimiter : '\f'
};
function formatData(message){
2016-03-16 20:46:10 +11:00
if(!message.data && message.data!==false && message.data!==0){
message.data={};
}
if(message.data['_maxListeners']){
message.data={};
}
message=message.JSON+parser.delimiter;
return message;
2016-01-10 23:18:14 +11:00
}
2014-02-22 20:13:31 +11:00
function parseDataEvents(data){
2016-01-10 23:18:14 +11:00
let events=data.split(parser.delimiter);
2014-02-22 20:13:31 +11:00
events.pop();
return events;
}
module.exports=parser;