@cclr/utils 0.0.8 → 0.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/index.js +1 -32
- package/lib/esm/index.js +1 -29
- package/package.json +6 -2
package/lib/cjs/index.js
CHANGED
|
@@ -1,32 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const urlREG = new RegExp([
|
|
4
|
-
"^(https?:)//", // protocol
|
|
5
|
-
"(([^:/?#]*)(?::([0-9]+))?)", // host (hostname and port)
|
|
6
|
-
"(/{0,1}[^?#]*)", // pathname
|
|
7
|
-
"(\\?[^#]*|)", // search
|
|
8
|
-
"(#.*|)$", // hash
|
|
9
|
-
].join(""));
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* 解析url
|
|
13
|
-
* @param url
|
|
14
|
-
*/
|
|
15
|
-
function urlParse(url) {
|
|
16
|
-
const match = url.match(urlREG);
|
|
17
|
-
return match
|
|
18
|
-
? {
|
|
19
|
-
href: url,
|
|
20
|
-
protocol: match[1],
|
|
21
|
-
host: match[2],
|
|
22
|
-
hostname: match[3],
|
|
23
|
-
port: match[4],
|
|
24
|
-
pathname: match[5],
|
|
25
|
-
search: match[6],
|
|
26
|
-
hash: match[7],
|
|
27
|
-
}
|
|
28
|
-
: {};
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
exports.urlParse = urlParse;
|
|
32
|
-
exports.urlREG = urlREG;
|
|
1
|
+
"use strict";const t=new RegExp(["^(https?:)//","(([^:/?#]*)(?::([0-9]+))?)","(/{0,1}[^?#]*)","(\\?[^#]*|)","(#.*|)$"].join(""));exports.urlParse=function(o){const r=o.match(t);return r?{href:o,protocol:r[1],host:r[2],hostname:r[3],port:r[4],pathname:r[5],search:r[6],hash:r[7]}:{}},exports.urlREG=t;
|
package/lib/esm/index.js
CHANGED
|
@@ -1,29 +1 @@
|
|
|
1
|
-
const
|
|
2
|
-
"^(https?:)//", // protocol
|
|
3
|
-
"(([^:/?#]*)(?::([0-9]+))?)", // host (hostname and port)
|
|
4
|
-
"(/{0,1}[^?#]*)", // pathname
|
|
5
|
-
"(\\?[^#]*|)", // search
|
|
6
|
-
"(#.*|)$", // hash
|
|
7
|
-
].join(""));
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* 解析url
|
|
11
|
-
* @param url
|
|
12
|
-
*/
|
|
13
|
-
function urlParse(url) {
|
|
14
|
-
const match = url.match(urlREG);
|
|
15
|
-
return match
|
|
16
|
-
? {
|
|
17
|
-
href: url,
|
|
18
|
-
protocol: match[1],
|
|
19
|
-
host: match[2],
|
|
20
|
-
hostname: match[3],
|
|
21
|
-
port: match[4],
|
|
22
|
-
pathname: match[5],
|
|
23
|
-
search: match[6],
|
|
24
|
-
hash: match[7],
|
|
25
|
-
}
|
|
26
|
-
: {};
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export { urlParse, urlREG };
|
|
1
|
+
const t=new RegExp(["^(https?:)//","(([^:/?#]*)(?::([0-9]+))?)","(/{0,1}[^?#]*)","(\\?[^#]*|)","(#.*|)$"].join(""));function o(o){const h=o.match(t);return h?{href:o,protocol:h[1],host:h[2],hostname:h[3],port:h[4],pathname:h[5],search:h[6],hash:h[7]}:{}}export{o as urlParse,t as urlREG};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cclr/utils",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.9",
|
|
4
4
|
"description": "> TODO: description",
|
|
5
5
|
"author": "cclr <18843152354@163.com>",
|
|
6
6
|
"homepage": "",
|
|
@@ -15,6 +15,10 @@
|
|
|
15
15
|
"files": [
|
|
16
16
|
"lib"
|
|
17
17
|
],
|
|
18
|
+
"publishConfig": {
|
|
19
|
+
"access": "public",
|
|
20
|
+
"registry": "https://registry.npmjs.org/"
|
|
21
|
+
},
|
|
18
22
|
"repository": {
|
|
19
23
|
"type": "git",
|
|
20
24
|
"url": "git@gitee.com:cclr/toolkit.git"
|
|
@@ -22,5 +26,5 @@
|
|
|
22
26
|
"scripts": {
|
|
23
27
|
"test": "node ./__tests__/utils.test.js"
|
|
24
28
|
},
|
|
25
|
-
"gitHead": "
|
|
29
|
+
"gitHead": "ad2e0a50411f99a529d84eb5901748d9c3cf5f3a"
|
|
26
30
|
}
|