mirror of
https://github.com/kuaifan/dootask.git
synced 2025-12-11 18:42:54 +00:00
feat: 修改 getDomain 函数以支持可选的小写转换参数;更新 getObject 函数的默认值
This commit is contained in:
parent
6a3e3c3753
commit
2f32b53d19
5
electron/lib/utils.js
vendored
5
electron/lib/utils.js
vendored
@ -274,10 +274,11 @@ const utils = {
|
|||||||
* @param weburl
|
* @param weburl
|
||||||
* @returns {string|string}
|
* @returns {string|string}
|
||||||
*/
|
*/
|
||||||
getDomain(weburl) {
|
getDomain(weburl, toLowerCase = true) {
|
||||||
const urlReg = /http(s)?:\/\/([^\/]+)/i;
|
const urlReg = /http(s)?:\/\/([^\/]+)/i;
|
||||||
const domain = `${weburl}`.match(urlReg);
|
const domain = `${weburl}`.match(urlReg);
|
||||||
return ((domain != null && domain.length > 0) ? domain[2] : "");
|
const result = ((domain != null && domain.length > 0) ? domain[2] : "");
|
||||||
|
return toLowerCase ? result.toLowerCase() : result;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
2
resources/assets/js/functions/common.js
vendored
2
resources/assets/js/functions/common.js
vendored
@ -518,7 +518,7 @@ const timezone = require("dayjs/plugin/timezone");
|
|||||||
* @param defaultValue
|
* @param defaultValue
|
||||||
* @returns {string|*}
|
* @returns {string|*}
|
||||||
*/
|
*/
|
||||||
getObject(obj, keys, defaultValue = undefined) {
|
getObject(obj, keys, defaultValue = "") {
|
||||||
let keyArray;
|
let keyArray;
|
||||||
if (typeof keys === 'string') {
|
if (typeof keys === 'string') {
|
||||||
keyArray = keys.replace(/,/g, "|").replace(/\./g, "|").split("|");
|
keyArray = keys.replace(/,/g, "|").replace(/\./g, "|").split("|");
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user