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

    Function maskChineseName

    • Returns a masked Chinese name, which keeps the surname only

      The surname is kept as 2 characters for the common compound surnames, otherwise 1 character. For minority names separated by the middle dot, each segment is masked individually

      Parameters

      • Optionaltext: string | null

        The text to mask

      Returns string | undefined

      a masked Chinese name, or undefined if the given text is invalid

      David Hsing

      maskChineseName(undefined);    // undefined
      maskChineseName('张三'); // '张*'
      maskChineseName('张三丰'); // '张**'
      maskChineseName('欧阳修'); // '欧阳*'
      maskChineseName('欧阳修文'); // '欧阳**'
      maskChineseName('阿依古丽·买买提'); // '阿***·买**'
      maskChineseName('Tom'); // undefined