Skip to content

Commit 5117839

Browse files
author
liguanliang
committed
chore: add a comment
1 parent eabb5c2 commit 5117839

File tree

3 files changed

+21
-3
lines changed

3 files changed

+21
-3
lines changed

object/Constructor.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,4 +62,4 @@ function test() {
6262
console.log(result);
6363
}
6464

65-
test();
65+
// test();

src/index.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,6 @@ import object from '../object'
1818

1919
// designPattern
2020
import designPattern from "../designPattern"
21+
22+
// url parser
23+
import url from "../url"

url/index.js

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
export const parser = {
1+
export const Url = {
22
parse(url) {
33
let ret = {};
4-
4+
// []中的 ^ 表示取非, 这里[^:]代表取非 : 的字符
55
let regex = /^([^:]+):\/\/([^\/]+)(.*)$/; //protocol, login, urlpath
66
let result = regex.exec(url);
77

@@ -63,3 +63,18 @@ export const parser = {
6363
return 0;
6464
}
6565
};
66+
// test
67+
(()=>{
68+
let result
69+
result = Url.parse('http://localhost:8080/');
70+
console.log(result)
71+
72+
result = Url.parse('^://localhost:8080/');
73+
console.log(result)
74+
75+
result = Url.isAbsolute('://localhost:8080/');
76+
console.log(result)
77+
78+
debugger;
79+
80+
})(window)

0 commit comments

Comments
 (0)