| | |
| | | /**
|
| | | * 判断url是否是http或https |
| | | * 路径匹配器
|
| | | * @param {string} pattern
|
| | | * @param {string} path
|
| | | * @returns {Boolean}
|
| | | */
|
| | | export function isHttp(url) {
|
| | | export function isPathMatch(pattern, path) {
|
| | | const regexPattern = pattern.replace(/\//g, '\\/').replace(/\*\*/g, '.*').replace(/\*/g, '[^\\/]*')
|
| | | const regex = new RegExp(`^${regexPattern}$`)
|
| | | return regex.test(path)
|
| | | }
|
| | |
|
| | | /**
|
| | | * 判断value字符串是否为空 |
| | | * @param {string} value
|
| | | * @returns {Boolean}
|
| | | */
|
| | | export function isEmpty(value) {
|
| | | if (value == null || value == "" || value == undefined || value == "undefined") {
|
| | | return true
|
| | | }
|
| | | return false
|
| | | }
|
| | |
|
| | | /**
|
| | | * 判断url是否是http或https |
| | | * @param {string} url
|
| | | * @returns {Boolean}
|
| | | */
|
| | | export function isHttp(url) {
|
| | | return url.indexOf('http://') !== -1 || url.indexOf('https://') !== -1
|
| | | }
|
| | |
|
| | |
| | | * @param {string} path
|
| | | * @returns {Boolean}
|
| | | */
|
| | | export function isExternal(path) {
|
| | | export function isExternal(path) {
|
| | | return /^(https?:|mailto:|tel:)/.test(path)
|
| | | }
|
| | |
|
| | |
| | | * @returns {Boolean}
|
| | | */
|
| | | export function isString(str) {
|
| | | if (typeof str === 'string' || str instanceof String) {
|
| | | return true
|
| | | }
|
| | | return false
|
| | | return typeof str === 'string' || str instanceof String
|
| | | }
|
| | |
|
| | | /**
|