Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

JavaScript URL Parse Seperate Parsing

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("The protocols used in the URL are :" + parsedUrl.protocols);
console.log("The port used in the URL is :" + parsedUrl.port);
console.log("The resource in the URL is :" + parsedUrl.resource);
console.log("The user in the URL is :" + parsedUrl.user);
console.log("The pathname in the URL is :" + parsedUrl.pathname);
console.log("The hash in the URL is :" + parsedUrl.hash);
console.log("The search part in the URL is :" + parsedUrl.search);
console.log("Full URL is :" + parsedUrl.href);
Source by softhunt.net #
 
PREVIOUS NEXT
Tagged: #JavaScript #URL #Parse #Seperate #Parsing
ADD COMMENT
Topic
Name
1+4 =