Advertisement
Guest User

Untitled

a guest
Feb 27th, 2020
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  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. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement