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

  Format of the id:
  - A123456789 (new ID in 2020)
  - AB12345678 (legacy but still valid)

  In Taiwan, there is another system called National Identification Card
  @see module:core/twid
  */
Validate ID number of Taiwan Resident Certificate (Uniform ID Numbers).
Validate ID number of Taiwan Resident Certificate ( Uniform ID Numbers ) .
function twrc (id) {
    var idFormat; 
    id = normalize(id);
    idFormat = getTwrcFormat(id);
    if (idFormat === 'old') {
      return isTwidChecksumValid(id, 2);
    }
    if (idFormat === 'new') {
      return isTwidChecksumValid(id, 1);
    } 
    return false;
  }
function twrc ( id ) { var idFormat ; id = normalize ( id ) ; idFormat = getTwrcFormat ( id ) ; if ( idFormat === 'old' ) { return isTwidChecksumValid ( id , 2 ) ; } if ( idFormat === 'new' ) { return isTwidChecksumValid ( id , 1 ) ; } return false ; }
Validate ID number of Taiwan Resident Certificate (Uniform ID Numbers).
Validate ID number of Taiwan Resident Certificate ( Uniform ID Numbers ) .
/** @type {string|boolean} - Either 'new', 'old' or false */ // isLengthValid = (id) -> id.length is 10 // else: idFormat is false