dazeus.js
function (message) {
    var objs = [], collector = '', chr, msglen, data;

    this.data += message;
    data = new Buffer(this.data, 'utf8');

    for (var i = 0; i < data.length; i += 1) {
        chr = data[i];
        if (chr > 47 && chr < 58) {
            collector += String.fromCharCode(chr);
        } else if (chr !== 10 && chr !== 13) {
            msglen = parseInt(collector, 10);

            if (msglen + i <= data.length) {
              objs.push(JSON.parse(data.toString('utf8', i, msglen + i)));
              data = data.slice(i + msglen);
              collector = '';
              i = 0;
            } else {
              break;
            }
        }
    }
    this.data = data.toString('utf8');
    return objs;
}
function (message) {
    var objs = [], collector = '', chr, msglen, data;

    this.data += message;
    data = new Buffer(this.data, 'utf8');

    for (var i = 0; i < data.length; i += 1) {
        chr = data[i];
        if (chr > 47 && chr < 58) {
            collector += String.fromCharCode(chr);
        } else if (chr !== 10 && chr !== 13) {
            msglen = parseInt(collector, 10);

            if (msglen + i <= data.length) {
              objs.push(JSON.parse(data.toString('utf8', i, msglen + i)));
              data = data.slice(i + msglen);
              collector = '';
              i = 0;
            } else {
              break;
            }
        }
    }
    this.data = data.toString('utf8');
    return objs;
}
function ( message ) { var objs = [ ] , collector = '' , chr , msglen , data ; this . data += message ; data = new Buffer ( this . data , 'utf8' ) ; for ( var i = 0 ; i < data . length ; i += 1 ) { chr = data [ i ] ; if ( chr > 47 && chr < 58 ) { collector += String . fromCharCode ( chr ) ; } else if ( chr !== 10 && chr !== 13 ) { msglen = parseInt ( collector , 10 ) ; if ( msglen + i <= data . length ) { objs . push ( JSON . parse ( data . toString ( 'utf8' , i , msglen + i ) ) ) ; data = data . slice ( i + msglen ) ; collector = '' ; i = 0 ; } else { break ; } } } this . data = data . toString ( 'utf8' ) ; return objs ; }
Transform a string retrieved from DaZeus to it's javascript-object-equivalents.
@param  {String} message
@return {Array} Array of parsed messages
Transform a string retrieved from DaZeus to it s javascript - object - equivalents .