lib/parser.js
/**
	 * Handles partial match at end of provided buffer.
	 *
	 * @param {Buffer} buffer
	 * @param {int} firstMatchIndex inclusive offset of first matching byte in buffer
	 * @returns {Promise.<ParserResult>}
	 * @protected
	 */
Handles partial match at end of provided buffer.
@param {Buffer} buffer
@param {int} firstMatchIndex inclusive offset of first matching byte in buffer
@returns {Promise.}
@protected
Handles partial match at end of provided buffer . @param { Buffer } buffer @param { int } firstMatchIndex inclusive offset of first matching byte in buffer @returns { Promise . } @protected
_partialMatch( buffer, firstMatchIndex ) {
		let parsed = [];
		if ( firstMatchIndex > -1 ) {
			parsed = this._matchingBuffers;
			this._matchingBuffers = [];
			if ( firstMatchIndex > 0 ) {
				parsed.push( buffer.slice( 0, firstMatchIndex ) );
			}
		}
		if ( firstMatchIndex < buffer.length ) {
			this._matchingBuffers.push( buffer.slice( Math.max( 0, firstMatchIndex ) ) );
		}
		return Promise.resolve( {
			parsed
		} );
	}
_partialMatch ( buffer , firstMatchIndex ) { let parsed = [ ] ; if ( firstMatchIndex > - 1 ) { parsed = this . _matchingBuffers ; this . _matchingBuffers = [ ] ; if ( firstMatchIndex > 0 ) { parsed . push ( buffer . slice ( 0 , firstMatchIndex ) ) ; } } if ( firstMatchIndex < buffer . length ) { this . _matchingBuffers . push ( buffer . slice ( Math . max ( 0 , firstMatchIndex ) ) ) ; } return Promise . resolve ( { parsed } ) ; }
Handles partial match at end of provided buffer.
Handles partial match at end of provided buffer .