wgt-node-utils 1.2.59 → 1.2.60
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/dist/bundle.js +1 -1
- package/package.json +1 -1
- package/src/index.js +9 -12
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -320,20 +320,17 @@ class wgtNodeUtils {
|
|
|
320
320
|
// 获取主域名
|
|
321
321
|
getMainDomainByHostname = (hostname) => {
|
|
322
322
|
// 如果hostname为空,直接返回空字符串
|
|
323
|
-
|
|
324
|
-
// 使用正则表达式匹配主域名
|
|
325
|
-
const match = hostname.match(/(?:.*\.)?([^.]+\.[^.]+)$/);
|
|
326
|
-
// 如果没有匹配到主域名,返回默认的主域名
|
|
327
|
-
if (!match || match.length < 2) {
|
|
328
|
-
return '';
|
|
329
|
-
}
|
|
330
|
-
// 返回匹配到的主域名
|
|
331
|
-
return match[1];
|
|
332
|
-
} catch (e) {
|
|
333
|
-
console.log(e, 'getMainDomainByHostnameError')
|
|
323
|
+
if (!hostname) {
|
|
334
324
|
return hostname;
|
|
335
325
|
}
|
|
336
|
-
|
|
326
|
+
// 使用正则表达式匹配主域名
|
|
327
|
+
const match = hostname.match(/(?:.*\.)?([^.]+\.[^.]+)$/);
|
|
328
|
+
// 如果没有匹配到主域名,返回默认的主域名
|
|
329
|
+
if (!match || match.length < 2) {
|
|
330
|
+
return '';
|
|
331
|
+
}
|
|
332
|
+
// 返回匹配到的主域名
|
|
333
|
+
return match[1];
|
|
337
334
|
}
|
|
338
335
|
/***
|
|
339
336
|
* node 端发送日志
|