import _isString from 'lodash/isString' ; import str2int from 'str2int' ; import urlRegex from 'url-regex' ; import { config } from '../config' ; param str export function isAvailableString ( str ) { return typeof str === 'string' && str . length > 0 ; } param str export function isUrl ( str ) { return urlRegex ( { exact : true } ) . test ( str ) ; } param str export const isBlobUrl = ( str ) => { return _isString ( str ) && str . startsWith ( 'blob:' ) ; } ; param str export const getUrls = ( str ) : string [ ] => { return str . match ( urlRegex ( ) ) ?? [ ] ; } ; /**
 * 用于判定环境变量的值
 */ export function is ( it ) { return ! ! it && it !== '0' && it !== 'false' ; } param text export function getTextColorHex ( text ) { if ( ! text || ! _isString ( text ) ) { return '#ffffff' ; } const color = config . color ; const id = str2int ( text ) ; return color [ id % color . length ] ; } /**
 * 是否一个可用的字符串
 * 定义为有长度的字符串
 */ export function isValidStr ( str ) { return typeof str == 'string' && str !== '' ; }