lnked/react-starter

View on GitHub
src/helpers/utils/prepare-phone.ts

Summary

Maintainability
A
0 mins
Test Coverage
export const preparePhone = (str: string) => {
  let phone = str && str.replace(/\s/g, '')

  if (phone && phone.substring(0, 1) !== '+') {
    phone = `+${phone}`
  }

  return phone
}