node-ipc/dao/eventParser.js
Brandon Nozaki Miller 143e23ca4d migrating to es6
2016-01-10 20:59:40 -08:00

27 lines
483 B
JavaScript

'use strict';
const parser={
parse : parseDataEvents,
format : formatData,
delimiter : '\f'
};
function formatData(message){
if(!message.data){
message.data={};
}
if(message.data['_maxListeners']){
message.data={};
}
message=message.JSON+parser.delimiter;
return message;
}
function parseDataEvents(data){
let events=data.split(parser.delimiter);
events.pop();
return events;
}
module.exports=parser;