SHARE
TWEET

Untitled

a guest Feb 27th, 2020 74 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const getDomainInfos = (url) => {
  2.     return axios.get(url)
  3.     .then(r => {
  4.       const {status} = r
  5.       const $ = cheerio.load(r.data)
  6.       const title = $("title").text()
  7.       const lang = $("html").attr("lang")
  8.       const split = lang ? lang.split("-") : [null]
  9.       return [status, title, ...split]
  10.     })
  11.     .catch(err => `Error with ${url}`)
  12.   }
  13.  
  14.  
  15. module.exports = (res1, res2) => {
  16.   if (Array.isArray(res2) && !Array.isArray(res1)) return true
  17.   if (!Array.isArray(res2)) return false
  18.   if (res1.length >= res2.length) return false
  19.   return true
  20. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top