import { isSidOfType , SidPrefix } from './sids' ; const URL_REGEX = /^(https?:\/\/)?(www\.)?[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(:[0-9]{1,5})?(\/.*)?$/ ; const GITHUB_REGEX = /github\.com/ ; param input export const isInputNotEmpty = ( input ) : boolean => Boolean ( input && input . length > 0 ) ; param str export const validateAccountSid = ( str ) : string | boolean => { if ( ! isInputNotEmpty ( str ) ) { return false ; } if ( ! isSidOfType ( str , SidPrefix . AccountSid ) ) { return 'Invalid Account Sid was provided' ; } return true ; } ; param str export const validateApiKey = ( str ) : string | boolean => { if ( ! isInputNotEmpty ( str ) ) { return false ; } if ( ! isSidOfType ( str , SidPrefix . ApiKey ) ) { return 'Invalid Account Sid was provided' ; } return true ; } ; param url { string } return private export const isValidUrl = ( url ) : boolean => URL_REGEX . test ( url ) ; param url { string } return private export const isGitHubUrl = ( url ) : boolean => GITHUB_REGEX . test ( url ) ; param url export const validateGitHubUrl = ( url ) : string | boolean => { if ( ! isValidUrl ( url ) ) { return 'Please enter a valid URL' ; } if ( ! isGitHubUrl ( url ) ) { return 'Only GitHub URLs are currently supported' ; } return true ; } ; export default { } ;