index.js
function(piece, quote_char) {
            // Matches everything that is not a quote or \
            var regex = new RegExp("[^" + quote_char + "\\\\]", 'g');
            // Remove eveything that is not quote or \
            var replaced = piece.replace(regex, '');
            // Remove escaped quotes, then remove all remaining slashes, then count.
            return replaced.replace(
            	new RegExp('(\\\\' + quote_char + ')', 'g'), ''
			).replace(
				/\\/g, ''
			).length;
        }
function(piece, quote_char) {
            // Matches everything that is not a quote or \
            var regex = new RegExp("[^" + quote_char + "\\\\]", 'g');
            // Remove eveything that is not quote or \
            var replaced = piece.replace(regex, '');
            // Remove escaped quotes, then remove all remaining slashes, then count.
            return replaced.replace(
            	new RegExp('(\\\\' + quote_char + ')', 'g'), ''
			).replace(
				/\\/g, ''
			).length;
        }
function ( piece , quote_char ) { // Matches everything that is not a quote or \
 var regex = new RegExp ( "[^" + quote_char + "\\\\]" , 'g' ) ; // Remove eveything that is not quote or \
 var replaced = piece . replace ( regex , '' ) ; // Remove escaped quotes, then remove all remaining slashes, then count.
 return replaced . replace ( new RegExp ( '(\\\\' + quote_char + ')' , 'g' ) , '' ) . replace ( / \\ / g , '' ) . length ; }
Counts the number of unescaped quotes that the piece has.
@private
@param  {string} piece      The piece to evaluate.
@param  {string} quote_char The quote character, either " or '.
@return {number}            The number of unescaped quotes.
Counts the number of unescaped quotes that the piece has .