export const notNullAndEmpty = (s: string | null) => { return s != null && s.length > 0; }; export const numberWithCommas = (x: number = 0): string => { return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ','); }; export const joinWorkspaceImg = (img: string): string => { return `${window.location.origin}/workspace/${ img.startsWith('/') ? img.substring(1) : img }`; }; export const isUrl = (url: string): boolean => { const regexp = /^(ht|f)tp(s?):\/\/[0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*(:(0-9)*)*(\/?)([a-zA-Z0-9\-.?,'/\\+&%$#_]*)?$/; return regexp.test(url); };