@ezuikit/utils-tools 1.1.0-alpha.1 → 1.1.0

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.
@@ -0,0 +1 @@
1
+ No third parties dependencies
package/dist/index.js CHANGED
@@ -1,8 +1,7 @@
1
1
  /*
2
- *
3
- * @ezuikit/utils-tools v1.1.0-alpha.1
4
- * Copyright (c) 2025-6-11 Ezviz-OpenBiz
5
- * Released under MIT the License.
6
- *
2
+ * @ezuikit/utils-tools v1.1.0
3
+ * tools utils
4
+ * Copyright (c) 2025-08-29 Ezviz-OpenBiz
5
+ * Released under the MIT License.
7
6
  */
8
- "use strict";const e=e=>{const t=e.split("?")[1],n={};if(t){const e=t.split("&");for(let t=0;t<e.length;t++){const r=e[t].split("=");n[r[0]]=decodeURIComponent(r[1])}}return n};function t(t){const n={};if(/^ezopen:\/\//.test(t)){if(t.includes("@")){const e=t.indexOf("@"),r=t.indexOf("//");n.validateCode=t.substring(r+2,e),t=t.replace(n.validateCode+"@","")}n.protocol=t.split("//")[0],n.search=t.split("?")[1]?"?"+t.split("?")[1]:"",n.hostname=t.split("/")[2],n.origin=n.protocol+"//"+n.hostname,n.pathname=t.split("?")[0].replace(n.origin,""),n.href=t;const r=n.pathname.split("/"),o=r[2].split(".");return n.deviceSerial=r[1],n.channelNo=o[0],n.type=o[o.length-1],"live"===n.type&&(n.definition=o.length>2?o[1]:"sd"),"rec"===n.type&&(n.recType=o.length>2?o[1]:""),n.searchParams=e(t),n}return{}}const n={h264:1,h265:2,h266:4,vp8:8,vp9:16,av1:32};exports.addVc=function(e,t=["h264"]){const r=(t||["h264"]).reduce(((e,t)=>(t=t.toLowerCase(),e+(n[t]||0))),0),o=e.split("?")[0];let i=e.split("?")[1];return i=(i||"").split("&").filter((e=>!/^vc=\d?/.test(e))).join("&"),i+=`${i?"&":""}vc=${r}`,o+"?"+i},exports.getQuery=e,exports.getStaticPath=function(e,t=""){const n=/^(https?:\/\/|^\/\/)/;if(""===e||void 0===e)return"";if(n.test(e))return e;e=e.replace(/\/+/g,"/"),t=n.test(t||"")?t:window.location.href;try{return new URL(e,t).href}catch(t){return e}},exports.isHttp=function(e){return/^http[s]?:\/\//.test(e)},exports.isMobile=function(e){var t,n;return!!((null!=e?e:null==(n=window)||null==(t=n.navigator)?void 0:t.userAgent)||"").match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i)},exports.parseEzopenUrl=t,exports.pick=function(e,t){return Object.entries(e).reduce(((e,[n,r])=>(t.includes(n)&&(e[n]=r),e)),{})},exports.switchEzopenUrl=function(n,r){let{type:o,recType:i,search:s,definition:c,channelNo:l,deviceSerial:p,validateCode:a}=null!=r?r:{};const d=t(n);if(s){const t=Object.assign({},d.searchParams,e("?"+s.replace("?","")));s=Object.entries(t).reduce(((e,[t,n])=>""===n?e:e+=`${t}=${encodeURIComponent(n)}&`),"?").replace(/&$/,"")}else s=d.search;return o=o||d.type,i=null!=i?i:d.recType,c=null!=c?c:d.definition,l=l||d.channelNo,p=p||d.deviceSerial,a=null!=a?a:d.validateCode,`${d.protocol}//${a?`${a}@`:""}${d.hostname}/${p}/${l}${"rec"===o&&i?"."+i:""}${"live"===o&&"hd"===c?"."+c:""}.${o}${s}`};
7
+ "use strict";const getQuery=url=>{const query=url.split("?")[1],obj={};if(query){const vars=query.split("&");for(let i=0;i<vars.length;i++){const pair=vars[i].split("=");obj[pair[0]]=decodeURIComponent(pair[1])}}return obj};function parseEzopenUrl(url){const obj={};if(/^ezopen:\/\//.test(url)){if(url.includes("@")){const endIndex=url.indexOf("@"),startIndex=url.indexOf("//");obj.validateCode=url.substring(startIndex+2,endIndex),url=url.replace(obj.validateCode+"@","")}obj.protocol=url.split("//")[0],obj.search=url.split("?")[1]?"?"+url.split("?")[1]:"",obj.hostname=url.split("/")[2],obj.origin=obj.protocol+"//"+obj.hostname,obj.pathname=url.split("?")[0].replace(obj.origin,""),obj.href=url;const pathnames=obj.pathname.split("/"),lastPath=pathnames[2].split(".");return obj.deviceSerial=pathnames[1],obj.channelNo=lastPath[0],obj.type=lastPath[lastPath.length-1],"live"===obj.type&&(obj.definition=lastPath.length>2?lastPath[1]:"sd"),"rec"===obj.type&&pathnames[2]&&(obj.recType=pathnames[2].includes(".cloud.")?"cloud":""),obj.searchParams=getQuery(url),obj}return{}}const codec={h264:1,h265:2,h266:4,vp8:8,vp9:16,av1:32};exports.addVc=function(url){const vc=((arguments.length>1&&void 0!==arguments[1]?arguments[1]:["h264"])||["h264"]).reduce(((acc,key)=>(key=key.toLowerCase(),acc+(codec[key]||0))),0),host=url.split("?")[0];let query=url.split("?")[1];return query=(query||"").split("&").filter((item=>!/^vc=\d?/.test(item))).join("&"),query+=`${query?"&":""}vc=${vc}`,host+"?"+query},exports.getQuery=getQuery,exports.getStaticPath=function(path){let base=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";const protocolReg=/^(https?:\/\/|^\/\/)/;if(""===path||void 0===path)return"";if(protocolReg.test(path))return path;path=path.replace(/\/+/g,"/"),base=protocolReg.test(base||"")?base:window.location.href;try{return new URL(path,base).href}catch(error){return path}},exports.isHttp=function(url){return/^http[s]?:\/\//.test(url)},exports.isMobile=function(agent){var _navigator,_navigator1,_navigator2;return/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone|Opera Mini)/i.test(null!=agent?agent:null==(_navigator=navigator)?void 0:_navigator.userAgent)||/Macintosh/i.test(null==(_navigator1=navigator)?void 0:_navigator1.userAgent)&&(null==(_navigator2=navigator)?void 0:_navigator2.maxTouchPoints)>1},exports.parseEzopenUrl=parseEzopenUrl,exports.pick=function(obj,keys){return Object.entries(obj).reduce(((acc,_ref)=>{let[key,value]=_ref;return keys.includes(key)&&(acc[key]=value),acc}),{})},exports.switchEzopenUrl=function(url,options){let{type:type,recType:recType,search:search,definition:definition,channelNo:channelNo,deviceSerial:deviceSerial,validateCode:validateCode}=null!=options?options:{};const obj=parseEzopenUrl(url);if(search){const ns=Object.assign({},obj.searchParams,getQuery("?"+search.replace("?","")));search=Object.entries(ns).reduce(((acc,_ref)=>{let[key,value]=_ref;return""===value?acc:acc+=`${key}=${encodeURIComponent(value)}&`}),"?").replace(/&$/,"")}else search=obj.search;return type=type||obj.type,recType=null!=recType?recType:obj.recType,definition=null!=definition?definition:obj.definition,channelNo=channelNo||obj.channelNo,deviceSerial=deviceSerial||obj.deviceSerial,validateCode=null!=validateCode?validateCode:obj.validateCode,`${obj.protocol}//${validateCode?`${validateCode}@`:""}${obj.hostname}/${deviceSerial}/${channelNo}${"rec"===type&&recType?"."+recType:""}${"live"===type&&"hd"===definition?"."+definition:""}.${type}${search}`};
package/dist/index.mjs CHANGED
@@ -1,8 +1,7 @@
1
1
  /*
2
- *
3
- * @ezuikit/utils-tools v1.1.0-alpha.1
4
- * Copyright (c) 2025-6-11 Ezviz-OpenBiz
5
- * Released under MIT the License.
6
- *
2
+ * @ezuikit/utils-tools v1.1.0
3
+ * tools utils
4
+ * Copyright (c) 2025-08-29 Ezviz-OpenBiz
5
+ * Released under the MIT License.
7
6
  */
8
- const e=e=>{const t=e.split("?")[1],n={};if(t){const e=t.split("&");for(let t=0;t<e.length;t++){const i=e[t].split("=");n[i[0]]=decodeURIComponent(i[1])}}return n};function t(t){const n={};if(/^ezopen:\/\//.test(t)){if(t.includes("@")){const e=t.indexOf("@"),i=t.indexOf("//");n.validateCode=t.substring(i+2,e),t=t.replace(n.validateCode+"@","")}n.protocol=t.split("//")[0],n.search=t.split("?")[1]?"?"+t.split("?")[1]:"",n.hostname=t.split("/")[2],n.origin=n.protocol+"//"+n.hostname,n.pathname=t.split("?")[0].replace(n.origin,""),n.href=t;const i=n.pathname.split("/"),o=i[2].split(".");return n.deviceSerial=i[1],n.channelNo=o[0],n.type=o[o.length-1],"live"===n.type&&(n.definition=o.length>2?o[1]:"sd"),"rec"===n.type&&(n.recType=o.length>2?o[1]:""),n.searchParams=e(t),n}return{}}function n(n,i){let{type:o,recType:r,search:c,definition:l,channelNo:s,deviceSerial:a,validateCode:p}=null!=i?i:{};const d=t(n);if(c){const t=Object.assign({},d.searchParams,e("?"+c.replace("?","")));c=Object.entries(t).reduce(((e,[t,n])=>""===n?e:e+=`${t}=${encodeURIComponent(n)}&`),"?").replace(/&$/,"")}else c=d.search;return o=o||d.type,r=null!=r?r:d.recType,l=null!=l?l:d.definition,s=s||d.channelNo,a=a||d.deviceSerial,p=null!=p?p:d.validateCode,`${d.protocol}//${p?`${p}@`:""}${d.hostname}/${a}/${s}${"rec"===o&&r?"."+r:""}${"live"===o&&"hd"===l?"."+l:""}.${o}${c}`}function i(e){return/^http[s]?:\/\//.test(e)}function o(e){var t,n;return!!((null!=e?e:null==(n=window)||null==(t=n.navigator)?void 0:t.userAgent)||"").match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i)}function r(e,t){return Object.entries(e).reduce(((e,[n,i])=>(t.includes(n)&&(e[n]=i),e)),{})}function c(e,t=""){const n=/^(https?:\/\/|^\/\/)/;if(""===e||void 0===e)return"";if(n.test(e))return e;e=e.replace(/\/+/g,"/"),t=n.test(t||"")?t:window.location.href;try{return new URL(e,t).href}catch(t){return e}}const l={h264:1,h265:2,h266:4,vp8:8,vp9:16,av1:32};function s(e,t=["h264"]){const n=(t||["h264"]).reduce(((e,t)=>(t=t.toLowerCase(),e+(l[t]||0))),0);const i=e.split("?")[0];let o=e.split("?")[1];return o=(o||"").split("&").filter((e=>!/^vc=\d?/.test(e))).join("&"),o+=`${o?"&":""}vc=${n}`,i+"?"+o}export{s as addVc,e as getQuery,c as getStaticPath,i as isHttp,o as isMobile,t as parseEzopenUrl,r as pick,n as switchEzopenUrl};
7
+ const getQuery=url=>{const query=url.split("?")[1],obj={};if(query){const vars=query.split("&");for(let i=0;i<vars.length;i++){const pair=vars[i].split("=");obj[pair[0]]=decodeURIComponent(pair[1])}}return obj};function parseEzopenUrl(url){const obj={};if(/^ezopen:\/\//.test(url)){if(url.includes("@")){const endIndex=url.indexOf("@"),startIndex=url.indexOf("//");obj.validateCode=url.substring(startIndex+2,endIndex),url=url.replace(obj.validateCode+"@","")}obj.protocol=url.split("//")[0],obj.search=url.split("?")[1]?"?"+url.split("?")[1]:"",obj.hostname=url.split("/")[2],obj.origin=obj.protocol+"//"+obj.hostname,obj.pathname=url.split("?")[0].replace(obj.origin,""),obj.href=url;const pathnames=obj.pathname.split("/"),lastPath=pathnames[2].split(".");return obj.deviceSerial=pathnames[1],obj.channelNo=lastPath[0],obj.type=lastPath[lastPath.length-1],"live"===obj.type&&(obj.definition=lastPath.length>2?lastPath[1]:"sd"),"rec"===obj.type&&pathnames[2]&&(obj.recType=pathnames[2].includes(".cloud.")?"cloud":""),obj.searchParams=getQuery(url),obj}return{}}function switchEzopenUrl(url,options){let{type:type,recType:recType,search:search,definition:definition,channelNo:channelNo,deviceSerial:deviceSerial,validateCode:validateCode}=null!=options?options:{};const obj=parseEzopenUrl(url);if(search){const ns=Object.assign({},obj.searchParams,getQuery("?"+search.replace("?","")));search=Object.entries(ns).reduce(((acc,_ref)=>{let[key,value]=_ref;return""===value?acc:acc+=`${key}=${encodeURIComponent(value)}&`}),"?").replace(/&$/,"")}else search=obj.search;return type=type||obj.type,recType=null!=recType?recType:obj.recType,definition=null!=definition?definition:obj.definition,channelNo=channelNo||obj.channelNo,deviceSerial=deviceSerial||obj.deviceSerial,validateCode=null!=validateCode?validateCode:obj.validateCode,`${obj.protocol}//${validateCode?`${validateCode}@`:""}${obj.hostname}/${deviceSerial}/${channelNo}${"rec"===type&&recType?"."+recType:""}${"live"===type&&"hd"===definition?"."+definition:""}.${type}${search}`}function isHttp(url){return/^http[s]?:\/\//.test(url)}function isMobile(agent){var _navigator,_navigator1,_navigator2;return/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone|Opera Mini)/i.test(null!=agent?agent:null==(_navigator=navigator)?void 0:_navigator.userAgent)||/Macintosh/i.test(null==(_navigator1=navigator)?void 0:_navigator1.userAgent)&&(null==(_navigator2=navigator)?void 0:_navigator2.maxTouchPoints)>1}function pick(obj,keys){return Object.entries(obj).reduce(((acc,_ref)=>{let[key,value]=_ref;return keys.includes(key)&&(acc[key]=value),acc}),{})}function getStaticPath(path){let base=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";const protocolReg=/^(https?:\/\/|^\/\/)/;if(""===path||void 0===path)return"";if(protocolReg.test(path))return path;path=path.replace(/\/+/g,"/"),base=protocolReg.test(base||"")?base:window.location.href;try{return new URL(path,base).href}catch(error){return path}}const codec={h264:1,h265:2,h266:4,vp8:8,vp9:16,av1:32};function addVc(url){const vc=((arguments.length>1&&void 0!==arguments[1]?arguments[1]:["h264"])||["h264"]).reduce(((acc,key)=>(key=key.toLowerCase(),acc+(codec[key]||0))),0);const host=url.split("?")[0];let query=url.split("?")[1];return query=(query||"").split("&").filter((item=>!/^vc=\d?/.test(item))).join("&"),query+=`${query?"&":""}vc=${vc}`,host+"?"+query}export{addVc,getQuery,getStaticPath,isHttp,isMobile,parseEzopenUrl,pick,switchEzopenUrl};
package/dist/index.umd.js CHANGED
@@ -1,8 +1,7 @@
1
1
  /*
2
- *
3
- * @ezuikit/utils-tools v1.1.0-alpha.1
4
- * Copyright (c) 2025-6-11 Ezviz-OpenBiz
5
- * Released under MIT the License.
6
- *
2
+ * @ezuikit/utils-tools v1.1.0
3
+ * tools utils
4
+ * Copyright (c) 2025-08-29 Ezviz-OpenBiz
5
+ * Released under the MIT License.
7
6
  */
8
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).Tools={})}(this,(function(e){"use strict";const t=e=>{const t=e.split("?")[1],n={};if(t){const e=t.split("&");for(let t=0;t<e.length;t++){const i=e[t].split("=");n[i[0]]=decodeURIComponent(i[1])}}return n};function n(e){const n={};if(/^ezopen:\/\//.test(e)){if(e.includes("@")){const t=e.indexOf("@"),i=e.indexOf("//");n.validateCode=e.substring(i+2,t),e=e.replace(n.validateCode+"@","")}n.protocol=e.split("//")[0],n.search=e.split("?")[1]?"?"+e.split("?")[1]:"",n.hostname=e.split("/")[2],n.origin=n.protocol+"//"+n.hostname,n.pathname=e.split("?")[0].replace(n.origin,""),n.href=e;const i=n.pathname.split("/"),o=i[2].split(".");return n.deviceSerial=i[1],n.channelNo=o[0],n.type=o[o.length-1],"live"===n.type&&(n.definition=o.length>2?o[1]:"sd"),"rec"===n.type&&(n.recType=o.length>2?o[1]:""),n.searchParams=t(e),n}return{}}const i={h264:1,h265:2,h266:4,vp8:8,vp9:16,av1:32};e.addVc=function(e,t=["h264"]){const n=(t||["h264"]).reduce(((e,t)=>(t=t.toLowerCase(),e+(i[t]||0))),0),o=e.split("?")[0];let r=e.split("?")[1];return r=(r||"").split("&").filter((e=>!/^vc=\d?/.test(e))).join("&"),r+=`${r?"&":""}vc=${n}`,o+"?"+r},e.getQuery=t,e.getStaticPath=function(e,t=""){const n=/^(https?:\/\/|^\/\/)/;if(""===e||void 0===e)return"";if(n.test(e))return e;e=e.replace(/\/+/g,"/"),t=n.test(t||"")?t:window.location.href;try{return new URL(e,t).href}catch(t){return e}},e.isHttp=function(e){return/^http[s]?:\/\//.test(e)},e.isMobile=function(e){var t,n;return!!((null!=e?e:null==(n=window)||null==(t=n.navigator)?void 0:t.userAgent)||"").match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i)},e.parseEzopenUrl=n,e.pick=function(e,t){return Object.entries(e).reduce(((e,[n,i])=>(t.includes(n)&&(e[n]=i),e)),{})},e.switchEzopenUrl=function(e,i){let{type:o,recType:r,search:s,definition:l,channelNo:c,deviceSerial:a,validateCode:p}=null!=i?i:{};const d=n(e);if(s){const e=Object.assign({},d.searchParams,t("?"+s.replace("?","")));s=Object.entries(e).reduce(((e,[t,n])=>""===n?e:e+=`${t}=${encodeURIComponent(n)}&`),"?").replace(/&$/,"")}else s=d.search;return o=o||d.type,r=null!=r?r:d.recType,l=null!=l?l:d.definition,c=c||d.channelNo,a=a||d.deviceSerial,p=null!=p?p:d.validateCode,`${d.protocol}//${p?`${p}@`:""}${d.hostname}/${a}/${c}${"rec"===o&&r?"."+r:""}${"live"===o&&"hd"===l?"."+l:""}.${o}${s}`}}));
7
+ !function(global,factory){"object"==typeof exports&&"undefined"!=typeof module?factory(exports):"function"==typeof define&&define.amd?define(["exports"],factory):factory((global="undefined"!=typeof globalThis?globalThis:global||self).Tools={})}(this,(function(exports){"use strict";var getQuery=function(url){var query=url.split("?")[1],obj={};if(query)for(var vars=query.split("&"),i=0;i<vars.length;i++){var pair=vars[i].split("=");obj[pair[0]]=decodeURIComponent(pair[1])}return obj};function parseEzopenUrl(url){var obj={};if(/^ezopen:\/\//.test(url)){if(url.includes("@")){var endIndex=url.indexOf("@"),startIndex=url.indexOf("//");obj.validateCode=url.substring(startIndex+2,endIndex),url=url.replace(obj.validateCode+"@","")}obj.protocol=url.split("//")[0],obj.search=url.split("?")[1]?"?"+url.split("?")[1]:"",obj.hostname=url.split("/")[2],obj.origin=obj.protocol+"//"+obj.hostname,obj.pathname=url.split("?")[0].replace(obj.origin,""),obj.href=url;var pathnames=obj.pathname.split("/"),lastPath=pathnames[2].split(".");return obj.deviceSerial=pathnames[1],obj.channelNo=lastPath[0],obj.type=lastPath[lastPath.length-1],"live"===obj.type&&(obj.definition=lastPath.length>2?lastPath[1]:"sd"),"rec"===obj.type&&pathnames[2]&&(obj.recType=pathnames[2].includes(".cloud.")?"cloud":""),obj.searchParams=getQuery(url),obj}return{}}var codec={h264:1,h265:2,h266:4,vp8:8,vp9:16,av1:32};exports.addVc=function(url,codecs){void 0===codecs&&(codecs=["h264"]);var vc=(codecs||["h264"]).reduce((function(acc,key){return key=key.toLowerCase(),acc+(codec[key]||0)}),0),host=url.split("?")[0],query=url.split("?")[1];return query=(query||"").split("&").filter((function(item){return!/^vc=\d?/.test(item)})).join("&"),host+"?"+(query+=(query?"&":"")+"vc="+vc)},exports.getQuery=getQuery,exports.getStaticPath=function(path,base){void 0===base&&(base="");var protocolReg=/^(https?:\/\/|^\/\/)/;if(""===path||void 0===path)return"";if(protocolReg.test(path))return path;path=path.replace(/\/+/g,"/"),base=protocolReg.test(base||"")?base:window.location.href;try{return new URL(path,base).href}catch(error){return path}},exports.isHttp=function(url){return/^http[s]?:\/\//.test(url)},exports.isMobile=function(agent){var _navigator,_navigator1,_navigator2;return/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone|Opera Mini)/i.test(null!=agent?agent:null==(_navigator=navigator)?void 0:_navigator.userAgent)||/Macintosh/i.test(null==(_navigator1=navigator)?void 0:_navigator1.userAgent)&&(null==(_navigator2=navigator)?void 0:_navigator2.maxTouchPoints)>1},exports.parseEzopenUrl=parseEzopenUrl,exports.pick=function(obj,keys){return Object.entries(obj).reduce((function(acc,param){var key=param[0],value=param[1];return keys.includes(key)&&(acc[key]=value),acc}),{})},exports.switchEzopenUrl=function(url,options){var _ref=null!=options?options:{},type=_ref.type,recType=_ref.recType,search=_ref.search,definition=_ref.definition,channelNo=_ref.channelNo,deviceSerial=_ref.deviceSerial,validateCode=_ref.validateCode,obj=parseEzopenUrl(url);if(search){var ns=Object.assign({},obj.searchParams,getQuery("?"+search.replace("?","")));search=Object.entries(ns).reduce((function(acc,param){var key=param[0],value=param[1];return""===value?acc:acc+=key+"="+encodeURIComponent(value)+"&"}),"?").replace(/&$/,"")}else search=obj.search;return type=type||obj.type,recType=null!=recType?recType:obj.recType,definition=null!=definition?definition:obj.definition,channelNo=channelNo||obj.channelNo,deviceSerial=deviceSerial||obj.deviceSerial,validateCode=null!=validateCode?validateCode:obj.validateCode,obj.protocol+"//"+(validateCode?validateCode+"@":"")+obj.hostname+"/"+deviceSerial+"/"+channelNo+("rec"===type&&recType?"."+recType:"")+("live"===type&&"hd"===definition?"."+definition:"")+"."+type+search}}));
@@ -7,7 +7,7 @@
7
7
  */
8
8
  export declare const getQueryVC: (CODECS: string[]) => number;
9
9
  /**
10
- * @description 接受一个URL和一个可选的“vc”参数,并返回带有“vc”的URL` 添加或更新了参数。
10
+ * 接受一个URL和一个可选的“vc”参数,并返回带有“vc”的URL` 添加或更新了参数。
11
11
  * @param {string} url url 地址
12
12
  * @param {string[]} codecs 支持的编码格式
13
13
  * @returns {string}
@@ -1,16 +1,23 @@
1
+ /** 播放类型 live/rec */
1
2
  export type EzopenType = 'live' | 'rec' | string;
3
+ /** 现在仅支持 cloud */
2
4
  export type EzopenRecType = 'cloud' | string;
5
+ /** 直播的清晰度 */
3
6
  export type EzopenDefinition = 'sd' | 'hd' | string;
7
+ /** ezopen 协议地址 解析后的结果 */
4
8
  export interface EzopenURL {
5
9
  protocol: string;
6
10
  search?: string;
7
- searchParams?: Record<string, any>;
11
+ searchParams?: Record<string, string | number>;
8
12
  pathname: string;
9
13
  origin: string;
10
14
  href: string;
11
15
  hostname: string;
16
+ /** 设备序列号 */
12
17
  deviceSerial: string;
18
+ /** 通道号 */
13
19
  channelNo: string;
20
+ /** 验证码 */
14
21
  validateCode?: string;
15
22
  /** 播放类型 直播 | 回放 */
16
23
  type: EzopenType;
@@ -20,29 +27,34 @@ export interface EzopenURL {
20
27
  definition?: EzopenDefinition;
21
28
  }
22
29
  /**
23
- * @description 解析ezopen 协议 url
30
+ * 解析ezopen 协议 url
24
31
  * @param {string} url ezopen url
25
- * @returns {EzopenParams}
32
+ * @returns {EzopenURL}
26
33
  *
27
34
  * ```ts
28
35
  * parseEzopenUrl("ezopen://open.ys7.com/C116331000/1.cloud.rec?a=00000&b=23&c=%E4%BD%A0%E5%A5%BD%E5%95%8A")
29
36
  * ```
30
37
  */
31
38
  export declare function parseEzopenUrl(url: string): Partial<EzopenURL>;
39
+ /**
40
+ * 切换ezopen 地址配置项
41
+ */
32
42
  export interface SwitchEzpoenOptions {
33
43
  deviceSerial?: string;
34
44
  channelNo?: string;
35
45
  type?: EzopenType;
46
+ /** 仅 rec */
36
47
  recType?: EzopenRecType;
48
+ /** 仅 live */
37
49
  definition?: EzopenDefinition;
38
50
  search?: string;
39
51
  validateCode?: string;
40
52
  }
41
53
  /**
42
- * @description exopen 协议播放地址切换(search 中值为空会覆盖url中的值并移除这个参数)
54
+ * exopen 协议播放地址切换(search 中值为空会覆盖url中的值并移除这个参数)
43
55
  * @param {string} url exopen 协议播放地址
44
56
  * @param {SwitchEzpoenOptions} options
45
- * @returns
57
+ * @returns {string}
46
58
  *
47
59
  * @example
48
60
  * ```ts
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @description 采用一个路径和一个可选的基本URL,并返回一个规范化的静态路径URL。
2
+ * 采用一个路径和一个可选的基本URL,并返回一个规范化的静态路径URL。
3
3
  * @param {string} path path参数是表示静态资源路径的字符串,例如图像、脚本或样式表。
4
4
  * @param {string=} base getStaticPath 函数中的base参数是一个字符串表示将用于解析静态路径的基本URL或路径。如果相对路径是在path`参数中提供,base参数将用作要解析的基本URL
5
5
  * @return {string} 处理输入path后的最终URL路径
@@ -5,4 +5,4 @@ import { getQuery } from './query';
5
5
  import { pick } from './pick';
6
6
  import { getStaticPath } from './getStaticPath';
7
7
  import { addVc } from './addVc';
8
- export { parseEzopenUrl, switchEzopenUrl, type EzopenURL, type SwitchEzpoenOptions, type EzopenType, type EzopenRecType, type EzopenDefinition, isHttp, isMobile, getQuery, pick, getStaticPath, addVc };
8
+ export { parseEzopenUrl, switchEzopenUrl, type EzopenURL, type SwitchEzpoenOptions, type EzopenType, type EzopenRecType, type EzopenDefinition, isHttp, isMobile, getQuery, pick, getStaticPath, addVc, };
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @description 判断是不是移动端(包括pad)
2
+ * 判断是不是移动端(包括pad)
3
3
  * @returns {boolean}
4
4
  */
5
5
  export declare function isMobile(agent?: string): boolean;
@@ -1,8 +1,8 @@
1
1
  /**
2
- * @description 从对象中挑选值
3
- * @param obj
4
- * @param keys
5
- * @returns
2
+ * 从对象中挑选值
3
+ * @param {object} obj
4
+ * @param {string[]} keys
5
+ * @returns {object}
6
6
  *
7
7
  * @example
8
8
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ezuikit/utils-tools",
3
- "version": "1.1.0-alpha.1",
3
+ "version": "1.1.0",
4
4
  "description": "tools utils",
5
5
  "main": "dist/index.js",
6
6
  "umd": "dist/index.umd.js",
@@ -12,8 +12,8 @@
12
12
  "default": "./dist/index.js"
13
13
  },
14
14
  "scripts": {
15
- "dev": "cross-env NODE_ENV=development rollup --config rollup.config.js --bundleConfigAsCjs --watch",
16
- "build": "cross-env NODE_ENV=production npm run clean && rollup --config rollup.config.js --bundleConfigAsCjs && npm run types && npm run docs",
15
+ "dev": "cross-env NODE_ENV=development rollup --config rollup.config.mjs --watch",
16
+ "build": "npm run clean && cross-env NODE_ENV=production rollup --config rollup.config.mjs && npm run types && npm run docs",
17
17
  "types": "tsc src/index.ts --emitDeclarationOnly --declaration --declarationDir dist/types",
18
18
  "docs": "rimraf docs && typedoc --out docs src",
19
19
  "prebuild": "npm run clean",
@@ -21,7 +21,7 @@
21
21
  "test:watch": "jest --coverage --watch",
22
22
  "clean": "rimraf docs dist coverage",
23
23
  "lint": "eslint .",
24
- "fmt": "prettier --write \"packages/**/src/**/*.{js,ts,json,md}\""
24
+ "fmt": "prettier --write \"src/*.{ts,tsx,js,mjs,cjs,jsx,md,html}\""
25
25
  },
26
26
  "files": [
27
27
  "dist"
@@ -31,6 +31,9 @@
31
31
  "ezuikit-utils",
32
32
  "utils"
33
33
  ],
34
+ "devDependencies": {
35
+ "@config/rollup": "workspace: *"
36
+ },
34
37
  "author": "Ezviz-OpenBiz",
35
38
  "license": "MIT",
36
39
  "publishConfig": {