# 基础工具方法
function _typeOf(obj) {
var val = Object.prototype.toString.call(obj);
return val.match(/\[object (.*?)\]/)[1].toLowerCase()
}
1
2
3
4
5
2
3
4
5
import { parse } from 'querystring';
function getPageQuery(){
return parse(window.location.href.split('?')[1])
};
1
2
3
4
5
2
3
4
5
const reg = /(((^https?:(?:\/\/)?)(?:[-;:&=\+\$,\w]+@)?[A-Za-z0-9.-]+(?::\d+)?|(?:www.|[-;:&=\+\$,\w]+@)[A-Za-z0-9.-]+)((?:\/[\+~%\/.\w-_]*)?\??(?:[-\+=&;%@.\w_]*)#?(?:[\w]*))?)$/;
function isUrl = (path: string): boolean => reg.test(path);
1
2
2
← zod使用文档总结汇总 数据结构和算法 →