You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

52 lines
1.2 KiB

10 months ago
export { isArray, isBoolean, isDate, isObject, isFunction, isString, isNumber, isNull } from 'lodash-es'
import { isObject } from 'lodash-es'
/**
* @description http
*/
export function isExternal(path: string) {
return /^(https?:|mailto:|tel:)/.test(path)
}
/**
* @description http
*/
export const isLinkHttp = (link: string): boolean => /^(https?:)?\/\//.test(link)
/**
* @description
*/
export const isLinkTel = (link: string): boolean => /^tel:/.test(link)
/**
* @description
*/
export const isPhone = (link: string): boolean => /^1[3|5|6|7|8|9][0-9]{9}$/.test(link)
/**
* @description
*/
export const isLinkMailto = (link: string): boolean => /^mailto:/.test(link)
/**
* @description
* @param {unknown} value
* @return {Boolean}
*/
export const isEmpty = (value: unknown) => {
return value !== null && value !== '' && typeof value !== 'undefined'
}
/**
* @description
* @param {Object} value
* @return {Boolean}
*/
export const isEmptyObject = (target: object) => {
return isObject(target) && !Object.keys(target).length
}
/**
*
*/
export const PhoneReg = /^1[3|5|6|7|8|9][0-9]{9}$/