Advertisement
Guest User

Untitled

a guest
May 21st, 2019
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. test = (input) => {
  2. const regex = new RegExp ('[!@#$?]','g')
  3. input.forEach(element => {
  4.  
  5. let reworked = element.split(regex).join('')
  6. let geohash = reworked.split('=')
  7. let name = geohash.shift()
  8. geohash = geohash.join('').split('<<')
  9.  
  10. const valid =() => {
  11. if(geohash[1] !== undefined && geohash[0]!==undefined) {
  12.  
  13. if(Number(geohash[0])=== geohash[1].length && (name.match(new RegExp('[a-z0-9]','gi')).join('') === name)) {
  14. return true
  15. }else {
  16. false
  17. }
  18. }
  19. }
  20. if(valid()){
  21. console.log(`Coordinates found! ${name} -> ${geohash[1]}`)
  22. }else if(element !== 'Last note'){
  23. console.log(`Nothing found!`)
  24. }
  25. });
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement