test/umd/test.js
/**
  Validate ID number of Taiwan Resident Certificate (Uniform ID Numbers).
  Only validate ID in or before 2020.
  @module core/twrc
  @param {string} id
  @return {boolean}

  Format of the id: AB12345678

  In Taiwan, there is another system called National Identification Card
  @see module:core/twid-legacy
  */
Validate ID number of Taiwan Resident Certificate (Uniform ID Numbers).
Only validate ID in or before 2020.
Validate ID number of Taiwan Resident Certificate ( Uniform ID Numbers ) . Only validate ID in or before 2020 .
function twrcLegacy (id) {
    var isFormatValid; 
    isFormatValid = function isFormatValid(id) {
      return /^[A-Z][A-D][0-9]{8}$/.test(id);
    };
    id = normalize(id); 
    return isFormatValid(id) && isTwidChecksumValid(id, 2);
  }
function twrcLegacy ( id ) { var isFormatValid ; isFormatValid = function isFormatValid ( id ) { return / ^[A-Z][A-D][0-9]{8}$ / . test ( id ) ; } ; id = normalize ( id ) ; return isFormatValid ( id ) && isTwidChecksumValid ( id , 2 ) ; }
Validate ID number of Taiwan Resident Certificate (Uniform ID Numbers).
Validate ID number of Taiwan Resident Certificate ( Uniform ID Numbers ) .
// isLengthValid = (id) -> id.length is 10 // return isLengthValid(id) and isFormatValid(id) and isChecksumValid(id, 2)