1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | 1× 13× 2× 13× 9× 9× 9× 9× 9× 9× 9× 1× | 'use strict'; const Defaults = require('./Defaults.js'); class Parser{ constructor(config){ if(!config){ config=new Defaults; } this.delimiter=config.delimiter; } format(message){ Iif(!message.data && message.data!==false && message.data!==0){ message.data={}; } Iif(message.data['_maxListeners']){ message.data={}; } message=message.JSON+this.delimiter; return message; } parse(data){ let events=data.split(this.delimiter); events.pop(); return events; } } module.exports=Parser; |