-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample.js
More file actions
21 lines (16 loc) · 812 Bytes
/
example.js
File metadata and controls
21 lines (16 loc) · 812 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
'use strict'
const urlParser = require('.')
const URL = urlParser.URL
const testUrl = 'http://jblas:password@mycompany.com:8080/mail/inbox?msg=1234&type=unread#msg-content'
console.log(urlParser('direct://'))
console.log(urlParser(testUrl))
console.log(urlParser('https://example.com/././foo'))
console.log(urlParser('http://example.com/foo'))
console.log(urlParser('http://測試.com'))
console.log(new URL('direct://'))
console.log(new URL(testUrl))
console.log(new URL('https://example.com/././foo'))
console.log(new URL({toString: () => { return 'http://example.com/foo' }}))
console.log(new URL('/foo', new URL('http://example.com/')))
console.log(new URL('http://測試.com'))
// console.log(urlParser('//jblas:password@mycompany.com:8080/mail/inbox?msg=1234&type=unread#msg-content')) // Throw error