Skip to content
On this page

isPhoneNum

Definition:

js
/**
 * Determine whether the input string or number is a phone number
 * @param v - The string or number to be determined
 * @returns Return a boolean value, where true represents it is a phone number, and false represents it is not
*/

Demo

Is this a phone number?

Usage Example

  1. For Number
ts
import { onMounted, ref } from 'vue'
import { isPhoneNum } from 'utils-snap-fn'

const ifPhoneNum = ref()

onMounted(() => {
  ifPhoneNum.value = isPhoneNum(13345673241) // true
})
  1. For String
js
import { onMounted, ref } from 'vue'
import { isPhoneNum } from 'utils-snap-fn'

const ifPhoneNum = ref()

onMounted(() => {
  ifPhoneNum.value = isPhoneNum('133456732412') // false
})

Source Code

utils-snap-fn-docs