18 lines
561 B
TypeScript
18 lines
561 B
TypeScript
export const DEPLOY_ADMIN_MOBILE = '09128081392'
|
|
const DEPLOY_ADMIN_MOBILE_CORE = '9128081392'
|
|
|
|
export function normalizeMobile(mobile?: string | number | null): string {
|
|
let digits = String(mobile ?? '').replace(/\D/g, '')
|
|
if (digits.startsWith('98') && digits.length >= 12) {
|
|
digits = digits.slice(2)
|
|
}
|
|
if (digits.length === 11 && digits.startsWith('0')) {
|
|
digits = digits.slice(1)
|
|
}
|
|
return digits
|
|
}
|
|
|
|
export function isDeployAdmin(mobile?: string | number | null): boolean {
|
|
return normalizeMobile(mobile) === DEPLOY_ADMIN_MOBILE_CORE
|
|
}
|