const parseUrl = require('parse-url'); const url = 'git+ssh://git@softhunt.net:30/path/to/resource.git?key1=value1&key2=value2#anchor'; const parsedUrl = parseUrl(url); console.log(parsedUrl)