function (image) {
      const imageName = path.join('images', image)
      const thumbName = path.join('images', `${image}.thumb.jpg`)

      const thumbPath = path.join(destination, thumbName)

      if (fs.existsSync(thumbPath)) return thumbName

      return imageName
    }
function (image) {
      const imageName = path.join('images', image)
      const thumbName = path.join('images', `${image}.thumb.jpg`)

      const thumbPath = path.join(destination, thumbName)

      if (fs.existsSync(thumbPath)) return thumbName

      return imageName
    }
function ( image ) { const imageName = path . join ( 'images' , image ) const thumbName = path . join ( 'images' , ` ${ image } ` ) const thumbPath = path . join ( destination , thumbName ) if ( fs . existsSync ( thumbPath ) ) return thumbName return imageName }
If a thumbnail exists, return it. Otherwise, return the base image.
If a thumbnail exists return it . Otherwise return the base image .