module author : Austin Ruby
 *  function changelog changelog function checkQueryBrackets ( queryString ) { const stack = [ ] ; const validatedSoFar = [ ] ; const openings = '{[(' ; const closings = '}])' ; for ( const el of queryString ) { if ( openings . includes ( el ) ) stack . push ( el ) ; if ( closings . includes ( el ) ) { if ( stack [ stack . length - 1 ] === openings [ closings . indexOf ( el ) ] ) stack . pop ( ) ; else break ; } validatedSoFar . push ( el ) ; } return stack . length === 0 ? queryString . slice ( 1 , queryString . length - 1 ) : new Error ( `${ `The following character makes the query unbalanced: ${ stack [ stack . length - 1 ] }\n` + 'The portion of the query that ran before the unbalance was detected was:\n' }${ validatedSoFar . join ( '' ) }\n\n` ) ; } module . exports = checkQueryBrackets ;