taiwan-validator - v1.2.0
    Preparing search index...

    Function validatePostalCode

    • 驗證台灣郵遞區號格式 支援 3 碼、5 碼 (3+2) 及新式 6 碼 (3+3) 格式(可包含減號,如 100-001 或 100001) 第一碼必須為 1-9

      Parameters

      • code: string | number

        要驗證的郵遞區號

      Returns ValidationResult

      驗證結果

      validatePostalCode('100');     // { isValid: true }
      validatePostalCode('100-01'); // { isValid: true }
      validatePostalCode('100001'); // { isValid: true }