Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
46
Task/URL-parser/JavaScript/url-parser-1.js
Normal file
46
Task/URL-parser/JavaScript/url-parser-1.js
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
(function (lstURL) {
|
||||
|
||||
var e = document.createElement('a'),
|
||||
lstKeys = [
|
||||
'hash',
|
||||
'host',
|
||||
'hostname',
|
||||
'origin',
|
||||
'pathname',
|
||||
'port',
|
||||
'protocol',
|
||||
'search'
|
||||
],
|
||||
|
||||
fnURLParse = function (strURL) {
|
||||
e.href = strURL;
|
||||
|
||||
return lstKeys.reduce(
|
||||
function (dct, k) {
|
||||
dct[k] = e[k];
|
||||
return dct;
|
||||
}, {}
|
||||
);
|
||||
};
|
||||
|
||||
return JSON.stringify(
|
||||
lstURL.map(fnURLParse),
|
||||
null, 2
|
||||
);
|
||||
|
||||
})([
|
||||
"foo://example.com:8042/over/there?name=ferret#nose",
|
||||
"urn:example:animal:ferret:nose",
|
||||
"jdbc:mysql://test_user:ouupppssss@localhost:3306/sakila?profileSQL=true",
|
||||
"ftp://ftp.is.co.za/rfc/rfc1808.txt",
|
||||
"http://www.ietf.org/rfc/rfc2396.txt#header1",
|
||||
"ldap://[2001:db8::7]/c=GB?objectClass=one&objectClass=two",
|
||||
"mailto:John.Doe@example.com",
|
||||
"news:comp.infosystems.www.servers.unix",
|
||||
"tel:+1-816-555-1212",
|
||||
"telnet://192.0.2.16:80/",
|
||||
"urn:oasis:names:specification:docbook:dtd:xml:4.1.2",
|
||||
"ssh://alice@example.com",
|
||||
"https://bob:pass@example.com/place",
|
||||
"http://example.com/?a=1&b=2+2&c=3&c=4&d=%65%6e%63%6F%64%65%64"
|
||||
]);
|
||||
142
Task/URL-parser/JavaScript/url-parser-2.js
Normal file
142
Task/URL-parser/JavaScript/url-parser-2.js
Normal file
|
|
@ -0,0 +1,142 @@
|
|||
[
|
||||
{
|
||||
"hash": "#nose",
|
||||
"host": "example.com:8042",
|
||||
"hostname": "example.com",
|
||||
"origin": "foo://example.com:8042",
|
||||
"pathname": "/over/there",
|
||||
"port": "8042",
|
||||
"protocol": "foo:",
|
||||
"search": "?name=ferret"
|
||||
},
|
||||
{
|
||||
"hash": "",
|
||||
"host": "",
|
||||
"hostname": "",
|
||||
"origin": "urn://",
|
||||
"pathname": "example:animal:ferret:nose",
|
||||
"port": "",
|
||||
"protocol": "urn:",
|
||||
"search": ""
|
||||
},
|
||||
{
|
||||
"hash": "",
|
||||
"host": "",
|
||||
"hostname": "",
|
||||
"origin": "jdbc://",
|
||||
"pathname": "mysql://test_user:ouupppssss@localhost:3306/sakila",
|
||||
"port": "",
|
||||
"protocol": "jdbc:",
|
||||
"search": "?profileSQL=true"
|
||||
},
|
||||
{
|
||||
"hash": "",
|
||||
"host": "ftp.is.co.za",
|
||||
"hostname": "ftp.is.co.za",
|
||||
"origin": "ftp://ftp.is.co.za",
|
||||
"pathname": "/rfc/rfc1808.txt",
|
||||
"port": "",
|
||||
"protocol": "ftp:",
|
||||
"search": ""
|
||||
},
|
||||
{
|
||||
"hash": "#header1",
|
||||
"host": "www.ietf.org",
|
||||
"hostname": "www.ietf.org",
|
||||
"origin": "http://www.ietf.org",
|
||||
"pathname": "/rfc/rfc2396.txt",
|
||||
"port": "",
|
||||
"protocol": "http:",
|
||||
"search": ""
|
||||
},
|
||||
{
|
||||
"hash": "",
|
||||
"host": "[2001:db8::7]",
|
||||
"hostname": "[2001:db8::7]",
|
||||
"origin": "ldap://[2001:db8::7]",
|
||||
"pathname": "/c=GB",
|
||||
"port": "",
|
||||
"protocol": "ldap:",
|
||||
"search": "?objectClass=one&objectClass=two"
|
||||
},
|
||||
{
|
||||
"hash": "",
|
||||
"host": "",
|
||||
"hostname": "",
|
||||
"origin": "mailto://",
|
||||
"pathname": "John.Doe@example.com",
|
||||
"port": "",
|
||||
"protocol": "mailto:",
|
||||
"search": ""
|
||||
},
|
||||
{
|
||||
"hash": "",
|
||||
"host": "",
|
||||
"hostname": "",
|
||||
"origin": "news://",
|
||||
"pathname": "comp.infosystems.www.servers.unix",
|
||||
"port": "",
|
||||
"protocol": "news:",
|
||||
"search": ""
|
||||
},
|
||||
{
|
||||
"hash": "",
|
||||
"host": "",
|
||||
"hostname": "",
|
||||
"origin": "tel://",
|
||||
"pathname": "+1-816-555-1212",
|
||||
"port": "",
|
||||
"protocol": "tel:",
|
||||
"search": ""
|
||||
},
|
||||
{
|
||||
"hash": "",
|
||||
"host": "192.0.2.16:80",
|
||||
"hostname": "192.0.2.16",
|
||||
"origin": "telnet://192.0.2.16:80",
|
||||
"pathname": "/",
|
||||
"port": "80",
|
||||
"protocol": "telnet:",
|
||||
"search": ""
|
||||
},
|
||||
{
|
||||
"hash": "",
|
||||
"host": "",
|
||||
"hostname": "",
|
||||
"origin": "urn://",
|
||||
"pathname": "oasis:names:specification:docbook:dtd:xml:4.1.2",
|
||||
"port": "",
|
||||
"protocol": "urn:",
|
||||
"search": ""
|
||||
},
|
||||
{
|
||||
"hash": "",
|
||||
"host": "example.com",
|
||||
"hostname": "example.com",
|
||||
"origin": "ssh://example.com",
|
||||
"pathname": "",
|
||||
"port": "",
|
||||
"protocol": "ssh:",
|
||||
"search": ""
|
||||
},
|
||||
{
|
||||
"hash": "",
|
||||
"host": "example.com",
|
||||
"hostname": "example.com",
|
||||
"origin": "https://example.com",
|
||||
"pathname": "/place",
|
||||
"port": "",
|
||||
"protocol": "https:",
|
||||
"search": ""
|
||||
},
|
||||
{
|
||||
"hash": "",
|
||||
"host": "example.com",
|
||||
"hostname": "example.com",
|
||||
"origin": "http://example.com",
|
||||
"pathname": "/",
|
||||
"port": "",
|
||||
"protocol": "http:",
|
||||
"search": "?a=1&b=2+2&c=3&c=4&d=%65%6e%63%6F%64%65%64"
|
||||
}
|
||||
]
|
||||
Loading…
Add table
Add a link
Reference in a new issue