@unikue/ts-lang-utils
    Preparing search index...

    Function maskChineseMobile

    • Returns a masked Chinese mobile phone number, which keeps the first 3 and last 4 characters

      The +86 or 86 country code prefix is kept as-is if present in the given text

      Parameters

      • Optionaltext: string | null

        The text to mask

      Returns string | undefined

      a masked Chinese mobile phone number, or undefined if the given text is invalid

      David Hsing

      maskChineseMobile(undefined);    // undefined
      maskChineseMobile('13812345678'); // '138****5678'
      maskChineseMobile('+8613812345678'); // '+86138****5678'
      maskChineseMobile('+86-13812345678'); // '+86-138****5678'
      maskChineseMobile('8613812345678'); // '86138****5678'
      maskChineseMobile('12345678901'); // undefined