function addRequiredQueryFields( query ) {

    let stringCondensed = query.replace(/\s+/g, " ");
    let starti = stringCondensed.indexOf('node {') + 6;
    let endi = stringCondensed.indexOf('}', starti);
    let currentParams = ( stringCondensed.substring(starti, endi) ).split(" ");
    const requiredParams = [ "id", "number", "title", "bodyText" ];
    requiredParams.forEach( function( p ) {
        if( !currentParams.includes( p ) ) { currentParams.push(p) }
    });
    currentParams = currentParams.join(" ");

    return stringCondensed.substr(0, starti) + currentParams + stringCondensed.substr(endi);
}
function addRequiredQueryFields( query ) {

    let stringCondensed = query.replace(/\s+/g, " ");
    let starti = stringCondensed.indexOf('node {') + 6;
    let endi = stringCondensed.indexOf('}', starti);
    let currentParams = ( stringCondensed.substring(starti, endi) ).split(" ");
    const requiredParams = [ "id", "number", "title", "bodyText" ];
    requiredParams.forEach( function( p ) {
        if( !currentParams.includes( p ) ) { currentParams.push(p) }
    });
    currentParams = currentParams.join(" ");

    return stringCondensed.substr(0, starti) + currentParams + stringCondensed.substr(endi);
}
function addRequiredQueryFields ( query ) { let stringCondensed = query . replace ( / \s+ / g , " " ) ; let starti = stringCondensed . indexOf ( 'node {' ) + 6 ; let endi = stringCondensed . indexOf ( '}' , starti ) ; let currentParams = ( stringCondensed . substring ( starti , endi ) ) . split ( " " ) ; const requiredParams = [ "id" , "number" , "title" , "bodyText" ] ; requiredParams . forEach ( function ( p ) { if ( ! currentParams . includes ( p ) ) { currentParams . push ( p ) } } ) ; currentParams = currentParams . join ( " " ) ; return stringCondensed . substr ( 0 , starti ) + currentParams + stringCondensed . substr ( endi ) ; }
**
add missing query fields (if any) for custom queries;
we need id, number, title, and bodyText to deliver sentiment
** add missing query fields ( if any ) for custom queries ; we need id number title and bodyText to deliver sentiment