packages/jollof/lib/data/jollofql/index.js
function jql(queryChunks, ...injects) {
    try {
        let res = '';


        for (let i = 0; i < injects.length; i++) {

            let value = injects[i];
            let q = queryChunks[i];

            if (typeof value === 'string') {
                //make string value safe

                value = cleanString(value);
            }
            else if (Array.isArray(value)) {

                //We do not support nested arrays or objects
                value = value.map((it) => {
                    if (Array.isArray(it))
                        throw new Error('JQL: Nested arrays not supported . Consider using a nativeFunction for that query instead.')

                    if (typeof it === 'string') {
                        //make string value safe

                        it = cleanString(it);
                    }

                    return it;
                })

                value = "(" + value.join(', ') + ")";
            }

            res += q + value;

        }

        res += queryChunks[queryChunks.length - 1];

        //console.log('query:', res);

        return res;
    } catch (err) {
        throw new Boom.badRequest('Bad JQL:', err)
    }
}
function jql(queryChunks, ...injects) {
    try {
        let res = '';


        for (let i = 0; i < injects.length; i++) {

            let value = injects[i];
            let q = queryChunks[i];

            if (typeof value === 'string') {
                //make string value safe

                value = cleanString(value);
            }
            else if (Array.isArray(value)) {

                //We do not support nested arrays or objects
                value = value.map((it) => {
                    if (Array.isArray(it))
                        throw new Error('JQL: Nested arrays not supported . Consider using a nativeFunction for that query instead.')

                    if (typeof it === 'string') {
                        //make string value safe

                        it = cleanString(it);
                    }

                    return it;
                })

                value = "(" + value.join(', ') + ")";
            }

            res += q + value;

        }

        res += queryChunks[queryChunks.length - 1];

        //console.log('query:', res);

        return res;
    } catch (err) {
        throw new Boom.badRequest('Bad JQL:', err)
    }
}
function jql ( queryChunks , ... injects ) { try { let res = '' ; for ( let i = 0 ; i < injects . length ; i ++ ) { let value = injects [ i ] ; let q = queryChunks [ i ] ; if ( typeof value === 'string' ) { //make string value safe value = cleanString ( value ) ; } else if ( Array . isArray ( value ) ) { //We do not support nested arrays or objects value = value . map ( ( it ) => { if ( Array . isArray ( it ) ) throw new Error ( 'JQL: Nested arrays not supported . Consider using a nativeFunction for that query instead.' ) if ( typeof it === 'string' ) { //make string value safe it = cleanString ( it ) ; } return it ; } ) value = "(" + value . join ( ', ' ) + ")" ; } res += q + value ; } res += queryChunks [ queryChunks . length - 1 ] ; //console.log('query:', res); return res ; } catch ( err ) { throw new Boom . badRequest ( 'Bad JQL:' , err ) } }
A tag to be used with ES6 string literals to prevent JQL injection.
Helps to build JQL queries.

@param queryChunks
@param injects
@returns {string}
A tag to be used with ES6 string literals to prevent JQL injection . Helps to build JQL queries .