index.js
/**
     * Function for image search
     *
     * @param  {string} query   Image search filed query
     * @return {Promise}        Returns a promise, with an array of found image URL's
     */
Function for image search
@param  {string} query   Image search filed query
@return {Promise}        Returns a promise, with an array of found image URL's
Function for image search @param { string } query Image search filed query @return { Promise } Returns a promise with an array of found image URL ' s
static searchImage(query) {
        query = encodeURIComponent(query)
        return new Promise( (resolve, reject) => {
            fetch(`https://www.google.com.ua/search?q=${query}&tbm=isch&ie=UTF-8&gbv=1&sei=PwQ8Xdn-AtTA3LUPoLWKkAg`)
            .then( res => res.text() )
            .then( res => {
                let parser = new JSDOM(res);
                let images = parser.window.document.querySelectorAll(`img[alt*='Image result for ${query}']`);
                images=Array.from(images);
                images=images.map((v)=>{return v.src});
                resolve(images);
            })
            .catch( err => reject(err) )
        })
    }
static searchImage ( query ) { query = encodeURIComponent ( query ) return new Promise ( ( resolve , reject ) => { fetch ( ` ${ query } ` ) . then ( res => res . text ( ) ) . then ( res => { let parser = new JSDOM ( res ) ; let images = parser . window . document . querySelectorAll ( ` ${ query } ` ) ; images = Array . from ( images ) ; images = images . map ( ( v ) => { return v . src } ) ; resolve ( images ) ; } ) . catch ( err => reject ( err ) ) } ) }
Function for image search
 @param  {string} query   Image search filed query
 @return {Promise}        Returns a promise, with an array of found image URL's
Function for image search @param { string } query Image search filed query @return { Promise } Returns a promise with an array of found image URL ' s
// Fetches Items from Google Image Search URL // Transforms HTML string into DOM object // Gets DOM element with image results